@joebigelow / wix / commits / b5451603

Add CreateGuid() to IBackendHelper to make Uuid helper internal

Rob Mensching committed Aug 1, 2018 at 03:11 UTC b54516035b4ebbfbd8899b26de501bfa13f53e8b
4 files changed +13 -5
src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+1 -1
@@ -233,7 +233,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
233
234 // Set generated component guids.
235 {
236 - var command = new CalculateComponentGuids(this.Messaging, section);
236 + var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, section);
237 command.Execute();
238 }
239
src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs
+6 -3
@@ -16,14 +16,17 @@ namespace WixToolset.Core.WindowsInstaller.Bind
16 /// </summary>
17 internal class CalculateComponentGuids
18 {
19 - public CalculateComponentGuids(IMessaging messaging, IntermediateSection section)
19 + internal CalculateComponentGuids(IMessaging messaging, IBackendHelper helper, IntermediateSection section)
20 {
21 this.Messaging = messaging;
22 + this.BackendHelper = helper;
23 this.Section = section;
24 }
25
26 private IMessaging Messaging { get; }
27
28 + private IBackendHelper BackendHelper { get; }
29 +
30 private IntermediateSection Section { get; }
31
32 public void Execute()
@@ -64,7 +67,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
67 var is64Bit = (componentRow.Attributes & MsiInterop.MsidbComponentAttributes64bit) != 0;
68 var bitness = is64Bit ? "64" : String.Empty;
69 var regkey = String.Concat(bitness, foundRow.AsString(1), "\\", foundRow.AsString(2), "\\", foundRow.AsString(3));
67 - componentRow.ComponentId = Uuid.NewUuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant()).ToString("B").ToUpperInvariant();
70 + componentRow.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant());
71 }
72 }
73 else // must be a File KeyPath.
@@ -168,7 +171,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
171 // if the rules were followed, reward with a generated guid
172 if (!this.Messaging.EncounteredError)
173 {
171 - componentRow.ComponentId = Uuid.NewUuid(BindDatabaseCommand.WixComponentGuidNamespace, path).ToString("B").ToUpperInvariant();
174 + componentRow.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, path);
175 }
176 }
177 }
src/WixToolset.Core/ExtensibilityServices/BackendHelper.cs
+5
@@ -36,6 +36,11 @@ namespace WixToolset.Core.ExtensibilityServices
36 };
37 }
38
39 + public string CreateGuid(Guid namespaceGuid, string value)
40 + {
41 + return Uuid.NewUuid(namespaceGuid, value).ToString("B").ToUpperInvariant();
42 + }
43 +
44 private string GetValidatedFullPath(SourceLineNumber sourceLineNumbers, string path)
45 {
46 try
src/WixToolset.Core/Uuid.cs
+1 -1
@@ -10,7 +10,7 @@ namespace WixToolset
10 /// <summary>
11 /// Implementation of RFC 4122 - A Universally Unique Identifier (UUID) URN Namespace.
12 /// </summary>
13 - public static class Uuid
13 + internal static class Uuid
14 {
15 /// <summary>
16 /// Creates a version 3 name-based UUID.