diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-06-25 14:43:50 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-06-25 14:50:31 -0700 |
| commit | 38afa9e7bc7eacc021f8805f607368a05751e3c3 (patch) | |
| tree | 803b0a8d9a06a7d6f7c4df408437017ae21a883e /src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs | |
| parent | 8968578d50858721317d410549a9f9b5c62bf1f7 (diff) | |
| download | wix-38afa9e7bc7eacc021f8805f607368a05751e3c3.tar.gz wix-38afa9e7bc7eacc021f8805f607368a05751e3c3.tar.bz2 wix-38afa9e7bc7eacc021f8805f607368a05751e3c3.zip | |
The Great Tuple to Symbol Rename (tm)
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs index 8135ae2e..a1e3ac83 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs | |||
| @@ -7,7 +7,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 7 | using System.IO; | 7 | using System.IO; |
| 8 | using System.Linq; | 8 | using System.Linq; |
| 9 | using WixToolset.Data; | 9 | using WixToolset.Data; |
| 10 | using WixToolset.Data.Tuples; | 10 | using WixToolset.Data.Symbols; |
| 11 | using WixToolset.Extensibility.Data; | 11 | using WixToolset.Extensibility.Data; |
| 12 | using WixToolset.Extensibility.Services; | 12 | using WixToolset.Extensibility.Services; |
| 13 | 13 | ||
| @@ -34,38 +34,38 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 34 | 34 | ||
| 35 | public void Execute() | 35 | public void Execute() |
| 36 | { | 36 | { |
| 37 | Dictionary<string, RegistryTuple> registryKeyRows = null; | 37 | Dictionary<string, RegistrySymbol> registryKeyRows = null; |
| 38 | Dictionary<string, IResolvedDirectory> targetPathsByDirectoryId = null; | 38 | Dictionary<string, IResolvedDirectory> targetPathsByDirectoryId = null; |
| 39 | Dictionary<string, string> componentIdGenSeeds = null; | 39 | Dictionary<string, string> componentIdGenSeeds = null; |
| 40 | Dictionary<string, List<FileTuple>> filesByComponentId = null; | 40 | Dictionary<string, List<FileSymbol>> filesByComponentId = null; |
| 41 | 41 | ||
| 42 | // Find components with generatable guids. | 42 | // Find components with generatable guids. |
| 43 | foreach (var componentTuple in this.Section.Tuples.OfType<ComponentTuple>()) | 43 | foreach (var componentSymbol in this.Section.Symbols.OfType<ComponentSymbol>()) |
| 44 | { | 44 | { |
| 45 | // Skip components that do not specify generate guid. | 45 | // Skip components that do not specify generate guid. |
| 46 | if (componentTuple.ComponentId != "*") | 46 | if (componentSymbol.ComponentId != "*") |
| 47 | { | 47 | { |
| 48 | continue; | 48 | continue; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | if (String.IsNullOrEmpty(componentTuple.KeyPath) || ComponentKeyPathType.OdbcDataSource == componentTuple.KeyPathType) | 51 | if (String.IsNullOrEmpty(componentSymbol.KeyPath) || ComponentKeyPathType.OdbcDataSource == componentSymbol.KeyPathType) |
| 52 | { | 52 | { |
| 53 | this.Messaging.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(componentTuple.SourceLineNumbers)); | 53 | this.Messaging.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(componentSymbol.SourceLineNumbers)); |
| 54 | continue; | 54 | continue; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | if (ComponentKeyPathType.Registry == componentTuple.KeyPathType) | 57 | if (ComponentKeyPathType.Registry == componentSymbol.KeyPathType) |
| 58 | { | 58 | { |
| 59 | if (registryKeyRows is null) | 59 | if (registryKeyRows is null) |
| 60 | { | 60 | { |
| 61 | registryKeyRows = this.Section.Tuples.OfType<RegistryTuple>().ToDictionary(t => t.Id.Id); | 61 | registryKeyRows = this.Section.Symbols.OfType<RegistrySymbol>().ToDictionary(t => t.Id.Id); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | if (registryKeyRows.TryGetValue(componentTuple.KeyPath, out var foundRow)) | 64 | if (registryKeyRows.TryGetValue(componentSymbol.KeyPath, out var foundRow)) |
| 65 | { | 65 | { |
| 66 | var bitness = componentTuple.Win64 ? "64" : String.Empty; | 66 | var bitness = componentSymbol.Win64 ? "64" : String.Empty; |
| 67 | var regkey = String.Concat(bitness, foundRow.AsString(1), "\\", foundRow.AsString(2), "\\", foundRow.AsString(3)); | 67 | var regkey = String.Concat(bitness, foundRow.AsString(1), "\\", foundRow.AsString(2), "\\", foundRow.AsString(3)); |
| 68 | componentTuple.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant()); | 68 | componentSymbol.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant()); |
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| 71 | else // must be a File KeyPath. | 71 | else // must be a File KeyPath. |
| @@ -74,7 +74,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 74 | // of directory ids to target names do that now. | 74 | // of directory ids to target names do that now. |
| 75 | if (targetPathsByDirectoryId is null) | 75 | if (targetPathsByDirectoryId is null) |
| 76 | { | 76 | { |
| 77 | var directories = this.Section.Tuples.OfType<DirectoryTuple>().ToList(); | 77 | var directories = this.Section.Symbols.OfType<DirectorySymbol>().ToList(); |
| 78 | 78 | ||
| 79 | targetPathsByDirectoryId = new Dictionary<string, IResolvedDirectory>(directories.Count); | 79 | targetPathsByDirectoryId = new Dictionary<string, IResolvedDirectory>(directories.Count); |
| 80 | 80 | ||
| @@ -95,12 +95,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | // If the component id generation seeds have not been indexed | 97 | // If the component id generation seeds have not been indexed |
| 98 | // from the Directory tuples do that now. | 98 | // from the Directory symbols do that now. |
| 99 | if (componentIdGenSeeds is null) | 99 | if (componentIdGenSeeds is null) |
| 100 | { | 100 | { |
| 101 | // If there are any Directory tuples, build up the Component Guid | 101 | // If there are any Directory symbols, build up the Component Guid |
| 102 | // generation seeds indexed by Directory/@Id. | 102 | // generation seeds indexed by Directory/@Id. |
| 103 | componentIdGenSeeds = this.Section.Tuples.OfType<DirectoryTuple>() | 103 | componentIdGenSeeds = this.Section.Symbols.OfType<DirectorySymbol>() |
| 104 | .Where(t => !String.IsNullOrEmpty(t.ComponentGuidGenerationSeed)) | 104 | .Where(t => !String.IsNullOrEmpty(t.ComponentGuidGenerationSeed)) |
| 105 | .ToDictionary(t => t.Id.Id, t => t.ComponentGuidGenerationSeed); | 105 | .ToDictionary(t => t.Id.Id, t => t.ComponentGuidGenerationSeed); |
| 106 | } | 106 | } |
| @@ -109,15 +109,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 109 | // then do that now | 109 | // then do that now |
| 110 | if (filesByComponentId is null) | 110 | if (filesByComponentId is null) |
| 111 | { | 111 | { |
| 112 | var files = this.Section.Tuples.OfType<FileTuple>().ToList(); | 112 | var files = this.Section.Symbols.OfType<FileSymbol>().ToList(); |
| 113 | 113 | ||
| 114 | filesByComponentId = new Dictionary<string, List<FileTuple>>(files.Count); | 114 | filesByComponentId = new Dictionary<string, List<FileSymbol>>(files.Count); |
| 115 | 115 | ||
| 116 | foreach (var file in files) | 116 | foreach (var file in files) |
| 117 | { | 117 | { |
| 118 | if (!filesByComponentId.TryGetValue(file.ComponentRef, out var componentFiles)) | 118 | if (!filesByComponentId.TryGetValue(file.ComponentRef, out var componentFiles)) |
| 119 | { | 119 | { |
| 120 | componentFiles = new List<FileTuple>(); | 120 | componentFiles = new List<FileSymbol>(); |
| 121 | filesByComponentId.Add(file.ComponentRef, componentFiles); | 121 | filesByComponentId.Add(file.ComponentRef, componentFiles); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| @@ -126,16 +126,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | // validate component meets all the conditions to have a generated guid | 128 | // validate component meets all the conditions to have a generated guid |
| 129 | var currentComponentFiles = filesByComponentId[componentTuple.Id.Id]; | 129 | var currentComponentFiles = filesByComponentId[componentSymbol.Id.Id]; |
| 130 | var numFilesInComponent = currentComponentFiles.Count; | 130 | var numFilesInComponent = currentComponentFiles.Count; |
| 131 | string path = null; | 131 | string path = null; |
| 132 | 132 | ||
| 133 | foreach (var fileRow in currentComponentFiles) | 133 | foreach (var fileRow in currentComponentFiles) |
| 134 | { | 134 | { |
| 135 | if (fileRow.Id.Id == componentTuple.KeyPath) | 135 | if (fileRow.Id.Id == componentSymbol.KeyPath) |
| 136 | { | 136 | { |
| 137 | // calculate the key file's canonical target path | 137 | // calculate the key file's canonical target path |
| 138 | string directoryPath = this.PathResolver.GetDirectoryPath(targetPathsByDirectoryId, componentIdGenSeeds, componentTuple.DirectoryRef, true); | 138 | string directoryPath = this.PathResolver.GetDirectoryPath(targetPathsByDirectoryId, componentIdGenSeeds, componentSymbol.DirectoryRef, true); |
| 139 | string fileName = Common.GetName(fileRow.Name, false, true).ToLowerInvariant(); | 139 | string fileName = Common.GetName(fileRow.Name, false, true).ToLowerInvariant(); |
| 140 | path = Path.Combine(directoryPath, fileName); | 140 | path = Path.Combine(directoryPath, fileName); |
| 141 | 141 | ||
| @@ -147,13 +147,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 147 | path.StartsWith(@"StartMenuFolder\programs", StringComparison.Ordinal) || | 147 | path.StartsWith(@"StartMenuFolder\programs", StringComparison.Ordinal) || |
| 148 | path.StartsWith(@"WindowsFolder\fonts", StringComparison.Ordinal)) | 148 | path.StartsWith(@"WindowsFolder\fonts", StringComparison.Ordinal)) |
| 149 | { | 149 | { |
| 150 | this.Messaging.Write(ErrorMessages.IllegalPathForGeneratedComponentGuid(componentTuple.SourceLineNumbers, fileRow.ComponentRef, path)); | 150 | this.Messaging.Write(ErrorMessages.IllegalPathForGeneratedComponentGuid(componentSymbol.SourceLineNumbers, fileRow.ComponentRef, path)); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | // 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 |
| 154 | if (1 < numFilesInComponent && String.IsNullOrEmpty(fileRow.Version)) | 154 | if (1 < numFilesInComponent && String.IsNullOrEmpty(fileRow.Version)) |
| 155 | { | 155 | { |
| 156 | this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentUnversionedKeypath(componentTuple.SourceLineNumbers)); | 156 | this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentUnversionedKeypath(componentSymbol.SourceLineNumbers)); |
| 157 | } | 157 | } |
| 158 | } | 158 | } |
| 159 | else | 159 | else |
| @@ -161,7 +161,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 161 | // 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 |
| 162 | if (1 < numFilesInComponent && !String.IsNullOrEmpty(fileRow.Version)) | 162 | if (1 < numFilesInComponent && !String.IsNullOrEmpty(fileRow.Version)) |
| 163 | { | 163 | { |
| 164 | this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentVersionedNonkeypath(componentTuple.SourceLineNumbers)); | 164 | this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentVersionedNonkeypath(componentSymbol.SourceLineNumbers)); |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| @@ -169,7 +169,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 169 | // if the rules were followed, reward with a generated guid | 169 | // if the rules were followed, reward with a generated guid |
| 170 | if (!this.Messaging.EncounteredError) | 170 | if (!this.Messaging.EncounteredError) |
| 171 | { | 171 | { |
| 172 | componentTuple.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, path); | 172 | componentSymbol.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, path); |
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
