diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-11-29 22:03:26 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-11-29 22:03:26 -0800 |
| commit | 71c52d5af2293d3eb79882ce36b0411f81185c11 (patch) | |
| tree | 23dd116bdd6abc2b0f7b488f490d1b77faa41812 /src/WixToolset.Core/Preprocess | |
| parent | 0fa198ed8c6c6fc81e649466879752a99fe37d08 (diff) | |
| download | wix-71c52d5af2293d3eb79882ce36b0411f81185c11.tar.gz wix-71c52d5af2293d3eb79882ce36b0411f81185c11.tar.bz2 wix-71c52d5af2293d3eb79882ce36b0411f81185c11.zip | |
Fix source path and cabinet processing
Diffstat (limited to 'src/WixToolset.Core/Preprocess')
| -rw-r--r-- | src/WixToolset.Core/Preprocess/IfContext.cs | 56 | ||||
| -rw-r--r-- | src/WixToolset.Core/Preprocess/IfState.cs | 22 |
2 files changed, 32 insertions, 46 deletions
diff --git a/src/WixToolset.Core/Preprocess/IfContext.cs b/src/WixToolset.Core/Preprocess/IfContext.cs index 64b5bd91..e7c6e6f5 100644 --- a/src/WixToolset.Core/Preprocess/IfContext.cs +++ b/src/WixToolset.Core/Preprocess/IfContext.cs | |||
| @@ -1,46 +1,21 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Preprocess | 3 | namespace WixToolset.Core.Preprocess |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// Current state of the if context. | ||
| 9 | /// </summary> | ||
| 10 | internal enum IfState | ||
| 11 | { | ||
| 12 | /// <summary>Context currently in unknown state.</summary> | ||
| 13 | Unknown, | ||
| 14 | |||
| 15 | /// <summary>Context currently inside if statement.</summary> | ||
| 16 | If, | ||
| 17 | |||
| 18 | /// <summary>Context currently inside elseif statement..</summary> | ||
| 19 | ElseIf, | ||
| 20 | |||
| 21 | /// <summary>Conext currently inside else statement.</summary> | ||
| 22 | Else, | ||
| 23 | } | ||
| 24 | |||
| 25 | /// <summary> | 5 | /// <summary> |
| 26 | /// Context for an if statement in the preprocessor. | 6 | /// Context for an if statement in the preprocessor. |
| 27 | /// </summary> | 7 | /// </summary> |
| 28 | internal sealed class IfContext | 8 | internal sealed class IfContext |
| 29 | { | 9 | { |
| 30 | private bool active; | ||
| 31 | private bool keep; | 10 | private bool keep; |
| 32 | private bool everKept; | ||
| 33 | private IfState state; | ||
| 34 | 11 | ||
| 35 | /// <summary> | 12 | /// <summary> |
| 36 | /// Creates a default if context object, which are used for if's within an inactive preprocessor block | 13 | /// Creates a default if context object, which are used for if's within an inactive preprocessor block |
| 37 | /// </summary> | 14 | /// </summary> |
| 38 | public IfContext() | 15 | public IfContext() |
| 39 | { | 16 | { |
| 40 | this.active = false; | 17 | this.WasEverTrue = true; |
| 41 | this.keep = false; | 18 | this.IfState = IfState.If; |
| 42 | this.everKept = true; | ||
| 43 | this.state = IfState.If; | ||
| 44 | } | 19 | } |
| 45 | 20 | ||
| 46 | /// <summary> | 21 | /// <summary> |
| @@ -51,21 +26,17 @@ namespace WixToolset.Preprocess | |||
| 51 | /// <param name="state">State of context to start in.</param> | 26 | /// <param name="state">State of context to start in.</param> |
| 52 | public IfContext(bool active, bool keep, IfState state) | 27 | public IfContext(bool active, bool keep, IfState state) |
| 53 | { | 28 | { |
| 54 | this.active = active; | 29 | this.Active = active; |
| 55 | this.keep = keep; | 30 | this.keep = keep; |
| 56 | this.everKept = keep; | 31 | this.WasEverTrue = keep; |
| 57 | this.state = state; | 32 | this.IfState = IfState.If; |
| 58 | } | 33 | } |
| 59 | 34 | ||
| 60 | /// <summary> | 35 | /// <summary> |
| 61 | /// Gets and sets if this if context is currently active. | 36 | /// Gets and sets if this if context is currently active. |
| 62 | /// </summary> | 37 | /// </summary> |
| 63 | /// <value>true if context is active.</value> | 38 | /// <value>true if context is active.</value> |
| 64 | public bool Active | 39 | public bool Active { get; set; } |
| 65 | { | ||
| 66 | get { return this.active; } | ||
| 67 | set { this.active = value; } | ||
| 68 | } | ||
| 69 | 40 | ||
| 70 | /// <summary> | 41 | /// <summary> |
| 71 | /// Gets and sets if context is current true. | 42 | /// Gets and sets if context is current true. |
| @@ -83,7 +54,7 @@ namespace WixToolset.Preprocess | |||
| 83 | this.keep = value; | 54 | this.keep = value; |
| 84 | if (this.keep) | 55 | if (this.keep) |
| 85 | { | 56 | { |
| 86 | this.everKept = true; | 57 | this.WasEverTrue = true; |
| 87 | } | 58 | } |
| 88 | } | 59 | } |
| 89 | } | 60 | } |
| @@ -92,19 +63,12 @@ namespace WixToolset.Preprocess | |||
| 92 | /// Gets if the context was ever true. | 63 | /// Gets if the context was ever true. |
| 93 | /// </summary> | 64 | /// </summary> |
| 94 | /// <value>True if context was ever true.</value> | 65 | /// <value>True if context was ever true.</value> |
| 95 | public bool WasEverTrue | 66 | public bool WasEverTrue { get; private set; } |
| 96 | { | ||
| 97 | get { return this.everKept; } | ||
| 98 | } | ||
| 99 | 67 | ||
| 100 | /// <summary> | 68 | /// <summary> |
| 101 | /// Gets the current state of the if context. | 69 | /// Gets the current state of the if context. |
| 102 | /// </summary> | 70 | /// </summary> |
| 103 | /// <value>Current state of context.</value> | 71 | /// <value>Current state of context.</value> |
| 104 | public IfState IfState | 72 | public IfState IfState { get; set; } |
| 105 | { | ||
| 106 | get { return this.state; } | ||
| 107 | set { this.state = value; } | ||
| 108 | } | ||
| 109 | } | 73 | } |
| 110 | } | 74 | } |
diff --git a/src/WixToolset.Core/Preprocess/IfState.cs b/src/WixToolset.Core/Preprocess/IfState.cs new file mode 100644 index 00000000..f5bb3e87 --- /dev/null +++ b/src/WixToolset.Core/Preprocess/IfState.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Core.Preprocess | ||
| 4 | { | ||
| 5 | /// <summary> | ||
| 6 | /// Current state of the if context. | ||
| 7 | /// </summary> | ||
| 8 | internal enum IfState | ||
| 9 | { | ||
| 10 | /// <summary>Context currently in unknown state.</summary> | ||
| 11 | Unknown, | ||
| 12 | |||
| 13 | /// <summary>Context currently inside if statement.</summary> | ||
| 14 | If, | ||
| 15 | |||
| 16 | /// <summary>Context currently inside elseif statement..</summary> | ||
| 17 | ElseIf, | ||
| 18 | |||
| 19 | /// <summary>Conext currently inside else statement.</summary> | ||
| 20 | Else, | ||
| 21 | } | ||
| 22 | } | ||
