From b54516035b4ebbfbd8899b26de501bfa13f53e8b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 1 Aug 2018 03:11:58 -0700 Subject: Add CreateGuid() to IBackendHelper to make Uuid helper internal --- src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 2 +- .../Bind/CalculateComponentGuids.cs | 9 ++++++--- src/WixToolset.Core/ExtensibilityServices/BackendHelper.cs | 5 +++++ src/WixToolset.Core/Uuid.cs | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 3aad0709..9194c4c7 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -233,7 +233,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind // Set generated component guids. { - var command = new CalculateComponentGuids(this.Messaging, section); + var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, section); command.Execute(); } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs index 1a24b803..b8f1b2f3 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs @@ -16,14 +16,17 @@ namespace WixToolset.Core.WindowsInstaller.Bind /// internal class CalculateComponentGuids { - public CalculateComponentGuids(IMessaging messaging, IntermediateSection section) + internal CalculateComponentGuids(IMessaging messaging, IBackendHelper helper, IntermediateSection section) { this.Messaging = messaging; + this.BackendHelper = helper; this.Section = section; } private IMessaging Messaging { get; } + private IBackendHelper BackendHelper { get; } + private IntermediateSection Section { get; } public void Execute() @@ -64,7 +67,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind var is64Bit = (componentRow.Attributes & MsiInterop.MsidbComponentAttributes64bit) != 0; var bitness = is64Bit ? "64" : String.Empty; var regkey = String.Concat(bitness, foundRow.AsString(1), "\\", foundRow.AsString(2), "\\", foundRow.AsString(3)); - componentRow.ComponentId = Uuid.NewUuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant()).ToString("B").ToUpperInvariant(); + componentRow.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant()); } } else // must be a File KeyPath. @@ -168,7 +171,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind // if the rules were followed, reward with a generated guid if (!this.Messaging.EncounteredError) { - componentRow.ComponentId = Uuid.NewUuid(BindDatabaseCommand.WixComponentGuidNamespace, path).ToString("B").ToUpperInvariant(); + componentRow.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, path); } } } diff --git a/src/WixToolset.Core/ExtensibilityServices/BackendHelper.cs b/src/WixToolset.Core/ExtensibilityServices/BackendHelper.cs index 0e5c4b5b..0cda4437 100644 --- a/src/WixToolset.Core/ExtensibilityServices/BackendHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/BackendHelper.cs @@ -36,6 +36,11 @@ namespace WixToolset.Core.ExtensibilityServices }; } + public string CreateGuid(Guid namespaceGuid, string value) + { + return Uuid.NewUuid(namespaceGuid, value).ToString("B").ToUpperInvariant(); + } + private string GetValidatedFullPath(SourceLineNumber sourceLineNumbers, string path) { try diff --git a/src/WixToolset.Core/Uuid.cs b/src/WixToolset.Core/Uuid.cs index 0501c285..c93d134d 100644 --- a/src/WixToolset.Core/Uuid.cs +++ b/src/WixToolset.Core/Uuid.cs @@ -10,7 +10,7 @@ namespace WixToolset /// /// Implementation of RFC 4122 - A Universally Unique Identifier (UUID) URN Namespace. /// - public static class Uuid + internal static class Uuid { /// /// Creates a version 3 name-based UUID. -- cgit v1.2.3-55-g6feb