From 528b13ce4ccd3a585c6f4caea0ce6ff0962b7310 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 30 Dec 2017 17:05:37 -0800 Subject: Rename IBindVariableResolver to IVariableResolve and merge ILocalizer plus improve IResolveContext --- src/WixToolset.Extensibility/ILocalizer.cs | 15 ------- src/WixToolset.Extensibility/IResolveContext.cs | 6 ++- .../Services/BindVariableResolution.cs | 27 ------------- .../Services/IBindVariableResolver.cs | 17 -------- .../Services/IVariableResolver.cs | 47 ++++++++++++++++++++++ .../Services/VariableResolution.cs | 27 +++++++++++++ 6 files changed, 79 insertions(+), 60 deletions(-) delete mode 100644 src/WixToolset.Extensibility/ILocalizer.cs delete mode 100644 src/WixToolset.Extensibility/Services/BindVariableResolution.cs delete mode 100644 src/WixToolset.Extensibility/Services/IBindVariableResolver.cs create mode 100644 src/WixToolset.Extensibility/Services/IVariableResolver.cs create mode 100644 src/WixToolset.Extensibility/Services/VariableResolution.cs (limited to 'src') diff --git a/src/WixToolset.Extensibility/ILocalizer.cs b/src/WixToolset.Extensibility/ILocalizer.cs deleted file mode 100644 index 3ce29aab..00000000 --- a/src/WixToolset.Extensibility/ILocalizer.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Extensibility -{ - using WixToolset.Data; - - public interface ILocalizer - { - int Codepage { get; } - - string GetLocalizedValue(string id); - - LocalizedControl GetLocalizedControl(string dialog, string control); - } -} diff --git a/src/WixToolset.Extensibility/IResolveContext.cs b/src/WixToolset.Extensibility/IResolveContext.cs index 026e5a35..e03e6689 100644 --- a/src/WixToolset.Extensibility/IResolveContext.cs +++ b/src/WixToolset.Extensibility/IResolveContext.cs @@ -17,10 +17,14 @@ namespace WixToolset.Extensibility IEnumerable Extensions { get; set; } + IEnumerable ExtensionData { get; set; } + string IntermediateFolder { get; set; } Intermediate IntermediateRepresentation { get; set; } - IBindVariableResolver WixVariableResolver { get; set; } + IEnumerable Localizations { get; set; } + + IVariableResolver VariableResolver { get; set; } } } diff --git a/src/WixToolset.Extensibility/Services/BindVariableResolution.cs b/src/WixToolset.Extensibility/Services/BindVariableResolution.cs deleted file mode 100644 index cdd1fa19..00000000 --- a/src/WixToolset.Extensibility/Services/BindVariableResolution.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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.Extensibility.Services -{ - public class BindVariableResolution - { - /// - /// Indicates whether the variable should be delay resolved. - /// - public bool DelayedResolve { get; set; } - - /// - /// Indicates whether the value is the default value of the variable. - /// - public bool IsDefault { get; set; } - - /// - /// Indicates whether the value changed. - /// - public bool UpdatedValue { get; set; } - - /// - /// Resolved value. - /// - public string Value { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs b/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs deleted file mode 100644 index 50071658..00000000 --- a/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Extensibility.Services -{ - using WixToolset.Data; - - public interface IBindVariableResolver - { - int VariableCount { get; } - - void AddVariable(string name, string value, bool overridable); - - BindVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); - - bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); - } -} diff --git a/src/WixToolset.Extensibility/Services/IVariableResolver.cs b/src/WixToolset.Extensibility/Services/IVariableResolver.cs new file mode 100644 index 00000000..ce11aa81 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IVariableResolver.cs @@ -0,0 +1,47 @@ +// 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.Extensibility.Services +{ + using WixToolset.Data; + + public interface IVariableResolver + { + /// + /// Gets the codepage. + /// + int Codepage { get; } + + /// + /// Gets the count of variables added to the resolver. + /// + int VariableCount { get; } + + void AddLocalization(Localization localization); + + /// + /// Add a variable. + /// + /// The name of the variable. + /// The value of the variable. + /// Indicates whether the variable can be overridden by an existing variable. + void AddVariable(SourceLineNumber sourceLineNumber, string name, string value, bool overridable); + + /// + /// Resolve the wix variables in a value. + /// + /// The source line information for the value. + /// The value to resolve. + /// true to only resolve localization variables; false otherwise. + /// The resolved result. + VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); + + /// + /// Try to find localization information for dialog and (optional) control. + /// + /// Dialog identifier. + /// Optional control identifier. + /// Found localization information. + /// True if localized control was found, otherwise false. + bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); + } +} diff --git a/src/WixToolset.Extensibility/Services/VariableResolution.cs b/src/WixToolset.Extensibility/Services/VariableResolution.cs new file mode 100644 index 00000000..2974e84f --- /dev/null +++ b/src/WixToolset.Extensibility/Services/VariableResolution.cs @@ -0,0 +1,27 @@ +// 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.Extensibility.Services +{ + public class VariableResolution + { + /// + /// Indicates whether the variable should be delay resolved. + /// + public bool DelayedResolve { get; set; } + + /// + /// Indicates whether the value is the default value of the variable. + /// + public bool IsDefault { get; set; } + + /// + /// Indicates whether the value changed. + /// + public bool UpdatedValue { get; set; } + + /// + /// Resolved value. + /// + public string Value { get; set; } + } +} \ No newline at end of file -- cgit v1.2.3-55-g6feb