From 71c52d5af2293d3eb79882ce36b0411f81185c11 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 29 Nov 2017 22:03:26 -0800 Subject: Fix source path and cabinet processing --- src/WixToolset.Core/Preprocess/IfContext.cs | 56 ++++++----------------------- src/WixToolset.Core/Preprocess/IfState.cs | 22 ++++++++++++ 2 files changed, 32 insertions(+), 46 deletions(-) create mode 100644 src/WixToolset.Core/Preprocess/IfState.cs (limited to 'src/WixToolset.Core/Preprocess') 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 @@ // 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. -namespace WixToolset.Preprocess +namespace WixToolset.Core.Preprocess { - using System; - - /// - /// Current state of the if context. - /// - internal enum IfState - { - /// Context currently in unknown state. - Unknown, - - /// Context currently inside if statement. - If, - - /// Context currently inside elseif statement.. - ElseIf, - - /// Conext currently inside else statement. - Else, - } - /// /// Context for an if statement in the preprocessor. /// internal sealed class IfContext { - private bool active; private bool keep; - private bool everKept; - private IfState state; /// /// Creates a default if context object, which are used for if's within an inactive preprocessor block /// public IfContext() { - this.active = false; - this.keep = false; - this.everKept = true; - this.state = IfState.If; + this.WasEverTrue = true; + this.IfState = IfState.If; } /// @@ -51,21 +26,17 @@ namespace WixToolset.Preprocess /// State of context to start in. public IfContext(bool active, bool keep, IfState state) { - this.active = active; + this.Active = active; this.keep = keep; - this.everKept = keep; - this.state = state; + this.WasEverTrue = keep; + this.IfState = IfState.If; } /// /// Gets and sets if this if context is currently active. /// /// true if context is active. - public bool Active - { - get { return this.active; } - set { this.active = value; } - } + public bool Active { get; set; } /// /// Gets and sets if context is current true. @@ -83,7 +54,7 @@ namespace WixToolset.Preprocess this.keep = value; if (this.keep) { - this.everKept = true; + this.WasEverTrue = true; } } } @@ -92,19 +63,12 @@ namespace WixToolset.Preprocess /// Gets if the context was ever true. /// /// True if context was ever true. - public bool WasEverTrue - { - get { return this.everKept; } - } + public bool WasEverTrue { get; private set; } /// /// Gets the current state of the if context. /// /// Current state of context. - public IfState IfState - { - get { return this.state; } - set { this.state = value; } - } + public IfState IfState { get; set; } } } 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 @@ +// 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. + +namespace WixToolset.Core.Preprocess +{ + /// + /// Current state of the if context. + /// + internal enum IfState + { + /// Context currently in unknown state. + Unknown, + + /// Context currently inside if statement. + If, + + /// Context currently inside elseif statement.. + ElseIf, + + /// Conext currently inside else statement. + Else, + } +} -- cgit v1.2.3-55-g6feb