diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
| commit | 155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (patch) | |
| tree | 59d1f151bfde8068b6014b05b5c8cfea3402c974 /src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs | |
| parent | 6f1665ed759b31bd095f186f9239232c653597cd (diff) | |
| download | wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.gz wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.bz2 wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.zip | |
Integrate simplified message handling
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs index 0c0aea1f..056f92a7 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs | |||
| @@ -10,17 +10,21 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 10 | using WixToolset.Core.Native; | 10 | using WixToolset.Core.Native; |
| 11 | using WixToolset.Data; | 11 | using WixToolset.Data; |
| 12 | using WixToolset.Data.Tuples; | 12 | using WixToolset.Data.Tuples; |
| 13 | using WixToolset.Extensibility.Services; | ||
| 13 | 14 | ||
| 14 | /// <summary> | 15 | /// <summary> |
| 15 | /// Set the guids for components with generatable guids. | 16 | /// Set the guids for components with generatable guids. |
| 16 | /// </summary> | 17 | /// </summary> |
| 17 | internal class CalculateComponentGuids | 18 | internal class CalculateComponentGuids |
| 18 | { | 19 | { |
| 19 | public CalculateComponentGuids(IntermediateSection section) | 20 | public CalculateComponentGuids(IMessaging messaging, IntermediateSection section) |
| 20 | { | 21 | { |
| 22 | this.Messaging = messaging; | ||
| 21 | this.Section = section; | 23 | this.Section = section; |
| 22 | } | 24 | } |
| 23 | 25 | ||
| 26 | private IMessaging Messaging { get; } | ||
| 27 | |||
| 24 | private IntermediateSection Section { get; } | 28 | private IntermediateSection Section { get; } |
| 25 | 29 | ||
| 26 | public void Execute() | 30 | public void Execute() |
| @@ -43,7 +47,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 43 | 47 | ||
| 44 | if (String.IsNullOrEmpty(componentRow.KeyPath) || odbcDataSourceKeyPath) | 48 | if (String.IsNullOrEmpty(componentRow.KeyPath) || odbcDataSourceKeyPath) |
| 45 | { | 49 | { |
| 46 | Messaging.Instance.OnMessage(WixErrors.IllegalComponentWithAutoGeneratedGuid(componentRow.SourceLineNumbers)); | 50 | this.Messaging.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(componentRow.SourceLineNumbers)); |
| 47 | continue; | 51 | continue; |
| 48 | } | 52 | } |
| 49 | 53 | ||
| @@ -143,13 +147,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 143 | path.StartsWith(@"StartMenuFolder\programs", StringComparison.Ordinal) || | 147 | path.StartsWith(@"StartMenuFolder\programs", StringComparison.Ordinal) || |
| 144 | path.StartsWith(@"WindowsFolder\fonts", StringComparison.Ordinal)) | 148 | path.StartsWith(@"WindowsFolder\fonts", StringComparison.Ordinal)) |
| 145 | { | 149 | { |
| 146 | Messaging.Instance.OnMessage(WixErrors.IllegalPathForGeneratedComponentGuid(componentRow.SourceLineNumbers, fileRow.Component_, path)); | 150 | this.Messaging.Write(ErrorMessages.IllegalPathForGeneratedComponentGuid(componentRow.SourceLineNumbers, fileRow.Component_, path)); |
| 147 | } | 151 | } |
| 148 | 152 | ||
| 149 | // if component has more than one file, the key path must be versioned | 153 | // if component has more than one file, the key path must be versioned |
| 150 | if (1 < numFilesInComponent && String.IsNullOrEmpty(fileRow.Version)) | 154 | if (1 < numFilesInComponent && String.IsNullOrEmpty(fileRow.Version)) |
| 151 | { | 155 | { |
| 152 | Messaging.Instance.OnMessage(WixErrors.IllegalGeneratedGuidComponentUnversionedKeypath(componentRow.SourceLineNumbers)); | 156 | this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentUnversionedKeypath(componentRow.SourceLineNumbers)); |
| 153 | } | 157 | } |
| 154 | } | 158 | } |
| 155 | else | 159 | else |
| @@ -157,13 +161,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 157 | // not a key path, so it must be an unversioned file if component has more than one file | 161 | // not a key path, so it must be an unversioned file if component has more than one file |
| 158 | if (1 < numFilesInComponent && !String.IsNullOrEmpty(fileRow.Version)) | 162 | if (1 < numFilesInComponent && !String.IsNullOrEmpty(fileRow.Version)) |
| 159 | { | 163 | { |
| 160 | Messaging.Instance.OnMessage(WixErrors.IllegalGeneratedGuidComponentVersionedNonkeypath(componentRow.SourceLineNumbers)); | 164 | this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentVersionedNonkeypath(componentRow.SourceLineNumbers)); |
| 161 | } | 165 | } |
| 162 | } | 166 | } |
| 163 | } | 167 | } |
| 164 | 168 | ||
| 165 | // if the rules were followed, reward with a generated guid | 169 | // if the rules were followed, reward with a generated guid |
| 166 | if (!Messaging.Instance.EncounteredError) | 170 | if (!this.Messaging.EncounteredError) |
| 167 | { | 171 | { |
| 168 | componentRow.ComponentId = Uuid.NewUuid(BindDatabaseCommand.WixComponentGuidNamespace, path).ToString("B").ToUpperInvariant(); | 172 | componentRow.ComponentId = Uuid.NewUuid(BindDatabaseCommand.WixComponentGuidNamespace, path).ToString("B").ToUpperInvariant(); |
| 169 | } | 173 | } |
