From db3c7998c80523d8a059f7a9c3214dbc5c8c1e23 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 6 May 2020 13:42:03 +1000 Subject: Remove Heat files from Core. --- .../WixToolset.Core.Burn.csproj | 2 +- .../WixToolset.Core.TestPackage.csproj | 4 +- .../WixToolset.Core.WindowsInstaller.csproj | 2 +- .../AssemblyDefaultHeatExtensionAttribute.cs | 33 ---- .../Extensibility/HarvesterExtension.cs | 26 --- src/WixToolset.Core/Extensibility/HeatExtension.cs | 200 --------------------- .../Extensibility/IHarvesterCore.cs | 48 ----- src/WixToolset.Core/Extensibility/IHeatCore.cs | 22 --- .../Extensibility/MutatorExtension.cs | 198 -------------------- src/WixToolset.Core/Harvester.cs | 79 -------- src/WixToolset.Core/HarvesterCore.cs | 75 -------- src/WixToolset.Core/HeatCore.cs | 43 ----- src/WixToolset.Core/Mutator.cs | 115 ------------ src/WixToolset.Core/WixToolset.Core.csproj | 2 +- 14 files changed, 5 insertions(+), 844 deletions(-) delete mode 100644 src/WixToolset.Core/Extensibility/AssemblyDefaultHeatExtensionAttribute.cs delete mode 100644 src/WixToolset.Core/Extensibility/HarvesterExtension.cs delete mode 100644 src/WixToolset.Core/Extensibility/HeatExtension.cs delete mode 100644 src/WixToolset.Core/Extensibility/IHarvesterCore.cs delete mode 100644 src/WixToolset.Core/Extensibility/IHeatCore.cs delete mode 100644 src/WixToolset.Core/Extensibility/MutatorExtension.cs delete mode 100644 src/WixToolset.Core/Harvester.cs delete mode 100644 src/WixToolset.Core/HarvesterCore.cs delete mode 100644 src/WixToolset.Core/HeatCore.cs delete mode 100644 src/WixToolset.Core/Mutator.cs (limited to 'src') diff --git a/src/WixToolset.Core.Burn/WixToolset.Core.Burn.csproj b/src/WixToolset.Core.Burn/WixToolset.Core.Burn.csproj index ae0e7023..786db9be 100644 --- a/src/WixToolset.Core.Burn/WixToolset.Core.Burn.csproj +++ b/src/WixToolset.Core.Burn/WixToolset.Core.Burn.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj b/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj index e5a550f3..b58c38e8 100644 --- a/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj +++ b/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj @@ -1,4 +1,4 @@ - + @@ -22,7 +22,7 @@ - + diff --git a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj index 5d68bfe4..c631b53b 100644 --- a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj +++ b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/WixToolset.Core/Extensibility/AssemblyDefaultHeatExtensionAttribute.cs b/src/WixToolset.Core/Extensibility/AssemblyDefaultHeatExtensionAttribute.cs deleted file mode 100644 index bb53e30c..00000000 --- a/src/WixToolset.Core/Extensibility/AssemblyDefaultHeatExtensionAttribute.cs +++ /dev/null @@ -1,33 +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.Tools -{ - using System; - - /// - /// Represents a custom attribute for declaring the type to use - /// as the default heat extension in an assembly. - /// - public class AssemblyDefaultHeatExtensionAttribute : Attribute - { - private readonly Type extensionType; - - /// - /// Instantiate a new AssemblyDefaultHeatExtensionAttribute. - /// - /// The type of the default heat extension in an assembly. - public AssemblyDefaultHeatExtensionAttribute(Type extensionType) - { - this.extensionType = extensionType; - } - - /// - /// Gets the type of the default heat extension in an assembly. - /// - /// The type of the default heat extension in an assembly. - public Type ExtensionType - { - get { return this.extensionType; } - } - } -} diff --git a/src/WixToolset.Core/Extensibility/HarvesterExtension.cs b/src/WixToolset.Core/Extensibility/HarvesterExtension.cs deleted file mode 100644 index d8d0ab34..00000000 --- a/src/WixToolset.Core/Extensibility/HarvesterExtension.cs +++ /dev/null @@ -1,26 +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 -{ - using Wix = WixToolset.Data.Serialize; - - /// - /// The base harvester extension. Any of these methods can be overridden to change - /// the behavior of the harvester. - /// - public abstract class HarvesterExtension - { - /// - /// Gets or sets the harvester core for the extension. - /// - /// The harvester core for the extension. - public IHarvesterCore Core { get; set; } - - /// - /// Harvest a WiX document. - /// - /// The argument for harvesting. - /// The harvested Fragments. - public abstract Wix.Fragment[] Harvest(string argument); - } -} diff --git a/src/WixToolset.Core/Extensibility/HeatExtension.cs b/src/WixToolset.Core/Extensibility/HeatExtension.cs deleted file mode 100644 index b0da75f1..00000000 --- a/src/WixToolset.Core/Extensibility/HeatExtension.cs +++ /dev/null @@ -1,200 +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.Core.Extensibility -{ - using System; - using System.IO; - using System.Reflection; - using WixToolset.Data; - using WixToolset.Tools; - - /// - /// A command line option. - /// - public struct HeatCommandLineOption - { - public string Option; - - public string Description; - - /// - /// Instantiates a new CommandLineOption. - /// - /// The option name. - /// The description of the option. - public HeatCommandLineOption(string option, string description) - { - this.Option = option; - this.Description = description; - } - } - - /// - /// An extension for the WiX Toolset Harvester application. - /// - public abstract class HeatExtension - { - /// - /// Gets or sets the heat core for the extension. - /// - /// The heat core for the extension. - public IHeatCore Core { get; set; } - - /// - /// Gets the supported command line types for this extension. - /// - /// The supported command line types for this extension. - public virtual HeatCommandLineOption[] CommandLineTypes - { - get { return null; } - } - - /// - /// Loads a HeatExtension from a type description string. - /// - /// The extension type description string. - /// The loaded HeatExtension. - /// - /// can be in several different forms: - /// - /// AssemblyQualifiedName (TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089) - /// AssemblyName (MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089) - /// Absolute path to an assembly (C:\MyExtensions\ExtensionAssembly.dll) - /// Filename of an assembly in the application directory (ExtensionAssembly.dll) - /// Relative path to an assembly (..\..\MyExtensions\ExtensionAssembly.dll) - /// - /// To specify a particular class to use, prefix the fully qualified class name to the assembly and separate them with a comma. - /// For example: "TopNamespace.SubNameSpace.ContainingClass+NestedClass, C:\MyExtensions\ExtensionAssembly.dll" - /// - public static HeatExtension Load(string extension) - { - Type extensionType = null; - int commaIndex = extension.IndexOf(','); - string className = String.Empty; - string assemblyName = extension; - - if (0 <= commaIndex) - { - className = extension.Substring(0, commaIndex); - assemblyName = (extension.Length <= commaIndex + 1 ? String.Empty : extension.Substring(commaIndex + 1)); - } - - className = className.Trim(); - assemblyName = assemblyName.Trim(); - - if (null == extensionType && 0 < assemblyName.Length) - { - - Assembly extensionAssembly; - - // case 3: Absolute path to an assembly - if (Path.IsPathRooted(assemblyName)) - { - extensionAssembly = ExtensionLoadFrom(assemblyName); - } - else - { - try - { - // case 2: AssemblyName - extensionAssembly = Assembly.Load(assemblyName); - } - catch (IOException e) - { - if (e is FileLoadException || e is FileNotFoundException) - { - try - { - // case 4: Filename of an assembly in the application directory - extensionAssembly = Assembly.Load(Path.GetFileNameWithoutExtension(assemblyName)); - } - catch (IOException innerE) - { - if (innerE is FileLoadException || innerE is FileNotFoundException) - { - // case 5: Relative path to an assembly - - // we want to use Assembly.Load when we can because it has some benefits over Assembly.LoadFrom - // (see the documentation for Assembly.LoadFrom). However, it may fail when the path is a relative - // path, so we should try Assembly.LoadFrom one last time. We could have detected a directory - // separator character and used Assembly.LoadFrom directly, but dealing with path canonicalization - // issues is something we don't want to deal with if we don't have to. - extensionAssembly = ExtensionLoadFrom(assemblyName); - } - else - { - throw new WixException(ErrorMessages.InvalidExtension(assemblyName, innerE.Message)); - } - } - } - else - { - throw new WixException(ErrorMessages.InvalidExtension(assemblyName, e.Message)); - } - } - } - - if (0 < className.Length) - { - try - { - // case 1: AssemblyQualifiedName - extensionType = extensionAssembly.GetType(className, true /* throwOnError */, true /* ignoreCase */); - } - catch (Exception e) - { - throw new WixException(ErrorMessages.InvalidExtensionType(assemblyName, className, e.GetType().ToString(), e.Message)); - } - } - else - { - // if no class name was specified, then let's hope the assembly defined a default WixExtension - AssemblyDefaultHeatExtensionAttribute extensionAttribute = (AssemblyDefaultHeatExtensionAttribute)Attribute.GetCustomAttribute(extensionAssembly, typeof(AssemblyDefaultHeatExtensionAttribute)); - - if (null != extensionAttribute) - { - extensionType = extensionAttribute.ExtensionType; - } - else - { - throw new WixException(ErrorMessages.InvalidExtensionType(assemblyName, typeof(AssemblyDefaultHeatExtensionAttribute).ToString())); - } - } - } - - if (extensionType.IsSubclassOf(typeof(HeatExtension))) - { - return Activator.CreateInstance(extensionType) as HeatExtension; - } - else - { - throw new WixException(ErrorMessages.InvalidExtensionType(extension, extensionType.ToString(), typeof(HeatExtension).ToString())); - } - } - - /// - /// Parse the command line options for this extension. - /// - /// The active harvester type. - /// The option arguments. - public virtual void ParseOptions(string type, string[] args) - { - } - - private static Assembly ExtensionLoadFrom(string assemblyName) - { - Assembly extensionAssembly = null; - - try - { - extensionAssembly = Assembly.LoadFrom(assemblyName); - } - catch (Exception e) - { - throw new WixException(ErrorMessages.InvalidExtension(assemblyName, e.Message)); - } - - return extensionAssembly; - } - } -} diff --git a/src/WixToolset.Core/Extensibility/IHarvesterCore.cs b/src/WixToolset.Core/Extensibility/IHarvesterCore.cs deleted file mode 100644 index a9001b46..00000000 --- a/src/WixToolset.Core/Extensibility/IHarvesterCore.cs +++ /dev/null @@ -1,48 +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 -{ - using WixToolset.Extensibility.Services; - - /// - /// The WiX Toolset harvester core. - /// - public interface IHarvesterCore - { - IMessaging Messaging { get; set; } - - /// - /// Gets or sets the value of the extension argument passed to heat. - /// - /// The extension argument. - string ExtensionArgument { get; set; } - - /// - /// Gets or sets the value of the root directory that is being harvested. - /// - /// The root directory being harvested. - string RootDirectory { get; set; } - - /// - /// Create an identifier based on passed file name - /// - /// File name to generate identifer from - /// - string CreateIdentifierFromFilename(string filename); - - /// - /// Generate an identifier by hashing data from the row. - /// - /// Three letter or less prefix for generated row identifier. - /// Information to hash. - /// The generated identifier. - string GenerateIdentifier(string prefix, params string[] args); - - /// - /// Resolves a file's path if the Wix.File.Source value starts with "SourceDir\". - /// - /// The Wix.File.Source value with "SourceDir\". - /// The full path of the file. - string ResolveFilePath(string fileSource); - } -} diff --git a/src/WixToolset.Core/Extensibility/IHeatCore.cs b/src/WixToolset.Core/Extensibility/IHeatCore.cs deleted file mode 100644 index 1365dfaf..00000000 --- a/src/WixToolset.Core/Extensibility/IHeatCore.cs +++ /dev/null @@ -1,22 +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.Core.Extensibility -{ - /// - /// The WiX Toolset Harvester application core. - /// - public interface IHeatCore - { - /// - /// Gets the harvester. - /// - /// The harvester. - Harvester Harvester { get; } - - /// - /// Gets the mutator. - /// - /// The mutator. - Mutator Mutator { get; } - } -} diff --git a/src/WixToolset.Core/Extensibility/MutatorExtension.cs b/src/WixToolset.Core/Extensibility/MutatorExtension.cs deleted file mode 100644 index afc76b79..00000000 --- a/src/WixToolset.Core/Extensibility/MutatorExtension.cs +++ /dev/null @@ -1,198 +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.Core.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Text; - - using Wix = WixToolset.Data.Serialize; - - /// - /// The base mutator extension. Any of these methods can be overridden to change - /// the behavior of the mutator. - /// - public abstract class MutatorExtension - { - /// - /// Gets or sets the mutator core for the extension. - /// - /// The mutator core for the extension. - public IHarvesterCore Core { get; set; } - - /// - /// Gets the sequence of the extension. - /// - /// The sequence of the extension. - public abstract int Sequence - { - get; - } - - /// - /// Mutate a WiX document. - /// - /// The Wix document element. - public virtual void Mutate(Wix.Wix wix) - { - } - - /// - /// Mutate a WiX document as a string. - /// - /// The Wix document element as a string. - /// The mutated Wix document as a string. - public virtual string Mutate(string wixString) - { - return wixString; - } - - /// - /// Generate unique MSI identifiers. - /// - protected class IdentifierGenerator - { - public const int MaxProductIdentifierLength = 72; - public const int MaxModuleIdentifierLength = 35; - - private string baseName; - private int maxLength; - private Dictionary existingIdentifiers; - private Dictionary possibleIdentifiers; - - /// - /// Instantiate a new IdentifierGenerator. - /// - /// The base resource name to use if a resource name contains no usable characters. - public IdentifierGenerator(string baseName) - { - this.baseName = baseName; - this.maxLength = IdentifierGenerator.MaxProductIdentifierLength; - this.existingIdentifiers = new Dictionary(StringComparer.OrdinalIgnoreCase); - this.possibleIdentifiers = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - /// - /// Gets or sets the maximum length for generated identifiers. - /// - /// Maximum length for generated identifiers. (Default is 72.) - public int MaxIdentifierLength - { - get { return this.maxLength; } - set { this.maxLength = value; } - } - - /// - /// Index an existing identifier for collision detection. - /// - /// The identifier. - public void IndexExistingIdentifier(string identifier) - { - if (null == identifier) - { - throw new ArgumentNullException("identifier"); - } - - this.existingIdentifiers[identifier] = null; - } - - /// - /// Index a resource name for collision detection. - /// - /// The resource name. - public void IndexName(string name) - { - if (null == name) - { - throw new ArgumentNullException("name"); - } - - string identifier = this.CreateIdentifier(name, 0); - - if (this.possibleIdentifiers.ContainsKey(identifier)) - { - this.possibleIdentifiers[identifier] = String.Empty; - } - else - { - this.possibleIdentifiers.Add(identifier, null); - } - } - - /// - /// Get the identifier for the given resource name. - /// - /// The resource name. - /// A legal MSI identifier. - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] - public string GetIdentifier(string name) - { - if (null == name) - { - throw new ArgumentNullException("name"); - } - - for (int i = 0; i <= Int32.MaxValue; i++) - { - string identifier = this.CreateIdentifier(name, i); - - if (this.existingIdentifiers.ContainsKey(identifier) || // already used - (0 == i && 0 != this.possibleIdentifiers.Count && null != this.possibleIdentifiers[identifier]) || // needs an index because its duplicated - (0 != i && this.possibleIdentifiers.ContainsKey(identifier))) // collides with another possible identifier - { - continue; - } - else // use this identifier - { - this.existingIdentifiers.Add(identifier, null); - - return identifier; - } - } - - throw new InvalidOperationException("Could not find a unique identifier for the given resource name."); - } - - /// - /// Create a legal MSI identifier from a resource name and an index. - /// - /// The name of the resource for which an identifier should be created. - /// An index to append to the end of the identifier to make it unique. - /// A legal MSI identifier. - public string CreateIdentifier(string name, int index) - { - if (null == name) - { - throw new ArgumentNullException("name"); - } - - StringBuilder identifier = new StringBuilder(); - - // Convert the name to a standard MSI identifier - identifier.Append(Common.GetIdentifierFromName(name)); - - // no legal identifier characters were found, use the base id instead - if (0 == identifier.Length) - { - identifier.Append(this.baseName); - } - - // truncate the identifier if it's too long (reserve 3 characters for up to 99 collisions) - int adjustedMaxLength = this.MaxIdentifierLength - (index != 0 ? 3 : 0); - if (adjustedMaxLength < identifier.Length) - { - identifier.Length = adjustedMaxLength; - } - - // if the index is not zero, then append it to the identifier name - if (0 != index) - { - identifier.AppendFormat("_{0}", index); - } - - return identifier.ToString(); - } - } - } -} diff --git a/src/WixToolset.Core/Harvester.cs b/src/WixToolset.Core/Harvester.cs deleted file mode 100644 index 3399420c..00000000 --- a/src/WixToolset.Core/Harvester.cs +++ /dev/null @@ -1,79 +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.Core -{ - using System; - using System.Diagnostics.CodeAnalysis; - using WixToolset.Data; - using Wix = WixToolset.Data.Serialize; - - /// - /// The WiX Toolset harvester. - /// - public class Harvester - { - private HarvesterExtension harvesterExtension; - - /// - /// Gets or sets the harvester core for the extension. - /// - /// The harvester core for the extension. - public IHarvesterCore Core { get; set; } - - /// - /// Gets or sets the extension. - /// - /// The extension. - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] - public HarvesterExtension Extension - { - get - { - return this.harvesterExtension; - } - set - { - if (null != this.harvesterExtension) - { - throw new InvalidOperationException("Multiple harvester extensions specified."); - } - - this.harvesterExtension = value; - } - } - - /// - /// Harvest wix authoring. - /// - /// The argument for harvesting. - /// The harvested wix authoring. - public Wix.Wix Harvest(string argument) - { - if (null == argument) - { - throw new ArgumentNullException("argument"); - } - - if (null == this.harvesterExtension) - { - throw new WixException(ErrorMessages.HarvestTypeNotFound()); - } - - this.harvesterExtension.Core = this.Core; - - Wix.Fragment[] fragments = this.harvesterExtension.Harvest(argument); - if (null == fragments || 0 == fragments.Length) - { - return null; - } - - Wix.Wix wix = new Wix.Wix(); - foreach (Wix.Fragment fragment in fragments) - { - wix.AddChild(fragment); - } - - return wix; - } - } -} diff --git a/src/WixToolset.Core/HarvesterCore.cs b/src/WixToolset.Core/HarvesterCore.cs deleted file mode 100644 index 70991979..00000000 --- a/src/WixToolset.Core/HarvesterCore.cs +++ /dev/null @@ -1,75 +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.Core -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.IO; - using WixToolset.Extensibility.Services; - - /// - /// The WiX Toolset harvester core. - /// - public class HarvesterCore : IHarvesterCore - { - public IMessaging Messaging { get; set; } - - /// - /// Gets or sets the value of the extension argument passed to heat. - /// - /// The extension argument. - public string ExtensionArgument { get; set; } - - /// - /// Gets or sets the value of the root directory that is being harvested. - /// - /// The root directory being harvested. - public string RootDirectory { get; set; } - - /// - /// Create an identifier based on passed file name - /// - /// File name to generate identifer from - /// - public string CreateIdentifierFromFilename(string filename) - { - return Common.GetIdentifierFromName(filename); - } - - /// - /// Generate an identifier by hashing data from the row. - /// - /// Three letter or less prefix for generated row identifier. - /// Information to hash. - /// The generated identifier. - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] - public string GenerateIdentifier(string prefix, params string[] args) - { - return Common.GenerateIdentifier(prefix, args); - } - - /// - /// Resolves a file's path if the Wix.File.Source value starts with "SourceDir\". - /// - /// The Wix.File.Source value with "SourceDir\". - /// The full path of the file. - public string ResolveFilePath(string fileSource) - { - if (fileSource.StartsWith("SourceDir\\", StringComparison.Ordinal)) - { - string file = Path.GetFullPath(this.RootDirectory); - if (File.Exists(file)) - { - return file; - } - else - { - fileSource = fileSource.Substring(10); - fileSource = Path.Combine(Path.GetFullPath(this.RootDirectory), fileSource); - } - } - - return fileSource; - } - } -} diff --git a/src/WixToolset.Core/HeatCore.cs b/src/WixToolset.Core/HeatCore.cs deleted file mode 100644 index d43b5f3d..00000000 --- a/src/WixToolset.Core/HeatCore.cs +++ /dev/null @@ -1,43 +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.Core -{ - using WixToolset.Core.Extensibility; - - /// - /// The WiX Toolset Harvester application core. - /// - public class HeatCore : IHeatCore - { - private Harvester harvester; - private Mutator mutator; - - /// - /// Instantiates a new HeatCore. - /// - /// The message handler for the core. - public HeatCore() - { - this.harvester = new Harvester(); - this.mutator = new Mutator(); - } - - /// - /// Gets the harvester. - /// - /// The harvester. - public Harvester Harvester - { - get { return this.harvester; } - } - - /// - /// Gets the mutator. - /// - /// The mutator. - public Mutator Mutator - { - get { return this.mutator; } - } - } -} diff --git a/src/WixToolset.Core/Mutator.cs b/src/WixToolset.Core/Mutator.cs deleted file mode 100644 index cee17736..00000000 --- a/src/WixToolset.Core/Mutator.cs +++ /dev/null @@ -1,115 +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.Core -{ - using System; - using System.Collections; - using WixToolset.Core.Extensibility; - using Wix = WixToolset.Data.Serialize; - - /// - /// The WiX Toolset mutator. - /// - public class Mutator - { - private SortedList extensions; - private string extensionArgument; - - /// - /// Instantiate a new mutator. - /// - public Mutator() - { - this.extensions = new SortedList(); - } - - /// - /// Gets or sets the harvester core for the extension. - /// - /// The harvester core for the extension. - public IHarvesterCore Core { get; set; } - - /// - /// Gets or sets the value of the extension argument passed to heat. - /// - /// The extension argument. - public string ExtensionArgument - { - get { return this.extensionArgument; } - set { this.extensionArgument = value; } - } - - /// - /// Adds a mutator extension. - /// - /// The mutator extension to add. - public void AddExtension(MutatorExtension mutatorExtension) - { - this.extensions.Add(mutatorExtension.Sequence, mutatorExtension); - } - - /// - /// Mutate a WiX document. - /// - /// The Wix document element. - /// true if mutation was successful - public bool Mutate(Wix.Wix wix) - { - bool encounteredError = false; - - try - { - foreach (MutatorExtension mutatorExtension in this.extensions.Values) - { - if (null == mutatorExtension.Core) - { - mutatorExtension.Core = this.Core; - } - - mutatorExtension.Mutate(wix); - } - } - finally - { - encounteredError = this.Core.Messaging.EncounteredError; - } - - // return the Wix document element only if mutation completed successfully - return !encounteredError; - } - - /// - /// Mutate a WiX document. - /// - /// The Wix document as a string. - /// The mutated Wix document as a string if mutation was successful, else null. - public string Mutate(string wixString) - { - bool encounteredError = false; - - try - { - foreach (MutatorExtension mutatorExtension in this.extensions.Values) - { - if (null == mutatorExtension.Core) - { - mutatorExtension.Core = this.Core; - } - - wixString = mutatorExtension.Mutate(wixString); - - if (String.IsNullOrEmpty(wixString) || this.Core.Messaging.EncounteredError) - { - break; - } - } - } - finally - { - encounteredError = this.Core.Messaging.EncounteredError; - } - - return encounteredError ? null : wixString; - } - } -} diff --git a/src/WixToolset.Core/WixToolset.Core.csproj b/src/WixToolset.Core/WixToolset.Core.csproj index 4e205641..3e7bea3b 100644 --- a/src/WixToolset.Core/WixToolset.Core.csproj +++ b/src/WixToolset.Core/WixToolset.Core.csproj @@ -25,7 +25,7 @@ - + -- cgit v1.2.3-55-g6feb