diff options
| author | Rob Mensching <rob@firegiant.com> | 2023-12-06 19:48:54 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2023-12-16 14:32:21 -0800 |
| commit | eff9d4204880535f821827e5aece5068402358f6 (patch) | |
| tree | 11b8158605bf2853242321fbaf2880792cb8d6b5 /src/api | |
| parent | 379926377524951c692e8c342a49fb03da61345f (diff) | |
| download | wix-eff9d4204880535f821827e5aece5068402358f6.tar.gz wix-eff9d4204880535f821827e5aece5068402358f6.tar.bz2 wix-eff9d4204880535f821827e5aece5068402358f6.zip | |
Introducing the WiX Standard Library
Completes 7914
Diffstat (limited to 'src/api')
6 files changed, 257 insertions, 48 deletions
diff --git a/src/api/wix/WixToolset.Data/Intermediate.cs b/src/api/wix/WixToolset.Data/Intermediate.cs index 64f9810d..977f894a 100644 --- a/src/api/wix/WixToolset.Data/Intermediate.cs +++ b/src/api/wix/WixToolset.Data/Intermediate.cs | |||
| @@ -215,9 +215,11 @@ namespace WixToolset.Data | |||
| 215 | /// Updates the intermediate level to the specified level. | 215 | /// Updates the intermediate level to the specified level. |
| 216 | /// </summary> | 216 | /// </summary> |
| 217 | /// <param name="level">Intermediate level.</param> | 217 | /// <param name="level">Intermediate level.</param> |
| 218 | public void UpdateLevel(string level) | 218 | public Intermediate UpdateLevel(string level) |
| 219 | { | 219 | { |
| 220 | this.Level = String.IsNullOrEmpty(this.Level) ? level : String.Concat(this.Level, ";", level); | 220 | this.Level = String.IsNullOrEmpty(this.Level) ? level : String.Concat(this.Level, ";", level); |
| 221 | |||
| 222 | return this; | ||
| 221 | } | 223 | } |
| 222 | 224 | ||
| 223 | /// <summary> | 225 | /// <summary> |
diff --git a/src/api/wix/WixToolset.Data/IntermediateSection.cs b/src/api/wix/WixToolset.Data/IntermediateSection.cs index b9157875..16d63a4c 100644 --- a/src/api/wix/WixToolset.Data/IntermediateSection.cs +++ b/src/api/wix/WixToolset.Data/IntermediateSection.cs | |||
| @@ -70,9 +70,11 @@ namespace WixToolset.Data | |||
| 70 | /// Assigns the section to a library. | 70 | /// Assigns the section to a library. |
| 71 | /// </summary> | 71 | /// </summary> |
| 72 | /// <param name="libraryId">Identifier of the library.</param> | 72 | /// <param name="libraryId">Identifier of the library.</param> |
| 73 | public void AssignToLibrary(string libraryId) | 73 | public IntermediateSection AssignToLibrary(string libraryId) |
| 74 | { | 74 | { |
| 75 | this.LibraryId = libraryId; | 75 | this.LibraryId = libraryId; |
| 76 | |||
| 77 | return this; | ||
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | /// <summary> | 80 | /// <summary> |
diff --git a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs index 17267cf7..971a0416 100644 --- a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs +++ b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs | |||
| @@ -11,7 +11,6 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 11 | { | 11 | { |
| 12 | private static readonly Dictionary<string, WixActionSymbol> standardActionsById; | 12 | private static readonly Dictionary<string, WixActionSymbol> standardActionsById; |
| 13 | private static readonly HashSet<string> standardActionNames; | 13 | private static readonly HashSet<string> standardActionNames; |
| 14 | private static readonly Dictionary<string, DirectorySymbol> standardDirectoriesById; | ||
| 15 | 14 | ||
| 16 | /// <summary> | 15 | /// <summary> |
| 17 | /// References: | 16 | /// References: |
| @@ -208,6 +207,41 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 208 | "WindowsVolume", | 207 | "WindowsVolume", |
| 209 | }; | 208 | }; |
| 210 | 209 | ||
| 210 | private static readonly Dictionary<string, string> standardDirectoryNamesById = new Dictionary<string, string> | ||
| 211 | { | ||
| 212 | ["TARGETDIR"] = "SourceDir", | ||
| 213 | ["AdminToolsFolder"] = "Admin", | ||
| 214 | ["AppDataFolder"] = "AppData", | ||
| 215 | ["CommonAppDataFolder"] = "CommApp", | ||
| 216 | ["CommonFilesFolder"] = "CFiles", | ||
| 217 | ["CommonFiles64Folder"] = "CFiles64", | ||
| 218 | ["CommonFiles6432Folder"] = ".", | ||
| 219 | ["DesktopFolder"] = "Desktop", | ||
| 220 | ["FavoritesFolder"] = "Favs", | ||
| 221 | ["FontsFolder"] = "Fonts", | ||
| 222 | ["LocalAppDataFolder"] = "LocalApp", | ||
| 223 | ["MyPicturesFolder"] = "Pictures", | ||
| 224 | ["NetHoodFolder"] = "NetHood", | ||
| 225 | ["PersonalFolder"] = "Personal", | ||
| 226 | ["PrintHoodFolder"] = "Printers", | ||
| 227 | ["ProgramFilesFolder"] = "PFiles", | ||
| 228 | ["ProgramFiles64Folder"] = "PFiles64", | ||
| 229 | ["ProgramFiles6432Folder"] = ".", | ||
| 230 | ["ProgramMenuFolder"] = "PMenu", | ||
| 231 | ["RecentFolder"] = "Recent", | ||
| 232 | ["SendToFolder"] = "SendTo", | ||
| 233 | ["StartMenuFolder"] = "StrtMenu", | ||
| 234 | ["StartupFolder"] = "StartUp", | ||
| 235 | ["SystemFolder"] = "System", | ||
| 236 | ["System16Folder"] = "System16", | ||
| 237 | ["System64Folder"] = "System64", | ||
| 238 | ["System6432Folder"] = ".", | ||
| 239 | ["TempFolder"] = "Temp", | ||
| 240 | ["TemplateFolder"] = "Template", | ||
| 241 | ["WindowsFolder"] = "Windows", | ||
| 242 | }; | ||
| 243 | |||
| 244 | |||
| 211 | static WindowsInstallerStandard() | 245 | static WindowsInstallerStandard() |
| 212 | { | 246 | { |
| 213 | var standardActions = new[] | 247 | var standardActions = new[] |
| @@ -332,43 +366,8 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 332 | new WixActionSymbol(null, new Identifier(AccessModifier.Virtual, "InstallExecuteSequence/InstallFinalize")) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.InstallExecuteSequence }, | 366 | new WixActionSymbol(null, new Identifier(AccessModifier.Virtual, "InstallExecuteSequence/InstallFinalize")) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.InstallExecuteSequence }, |
| 333 | }; | 367 | }; |
| 334 | 368 | ||
| 335 | var standardDirectories = new[] | ||
| 336 | { | ||
| 337 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "TARGETDIR")) { Name = "SourceDir" }, | ||
| 338 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "AdminToolsFolder")) { Name = "Admin" }, | ||
| 339 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "AppDataFolder")) { Name = "AppData" }, | ||
| 340 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonAppDataFolder")) { Name = "CommApp" }, | ||
| 341 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonFilesFolder")) { Name = "CFiles" }, | ||
| 342 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonFiles64Folder")) { Name = "CFiles64" }, | ||
| 343 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonFiles6432Folder")) { Name = "." }, | ||
| 344 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "DesktopFolder")) { Name = "Desktop" }, | ||
| 345 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "FavoritesFolder")) { Name = "Favs" }, | ||
| 346 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "FontsFolder")) { Name = "Fonts" }, | ||
| 347 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "LocalAppDataFolder")) { Name = "LocalApp" }, | ||
| 348 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "MyPicturesFolder")) { Name = "Pictures" }, | ||
| 349 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "NetHoodFolder")) { Name = "NetHood" }, | ||
| 350 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "PersonalFolder")) { Name = "Personal" }, | ||
| 351 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "PrintHoodFolder")) { Name = "Printers" }, | ||
| 352 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramFilesFolder")) { Name = "PFiles" }, | ||
| 353 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramFiles64Folder")) { Name = "PFiles64" }, | ||
| 354 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramFiles6432Folder")) { Name = "." }, | ||
| 355 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramMenuFolder")) { Name = "PMenu" }, | ||
| 356 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "RecentFolder")) { Name = "Recent" }, | ||
| 357 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "SendToFolder")) { Name = "SendTo" }, | ||
| 358 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "StartMenuFolder")) { Name = "StrtMenu" }, | ||
| 359 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "StartupFolder")) { Name = "StartUp" }, | ||
| 360 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "SystemFolder")) { Name = "System" }, | ||
| 361 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "System16Folder")) { Name = "System16" }, | ||
| 362 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "System64Folder")) { Name = "System64" }, | ||
| 363 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "System6432Folder")) { Name = "." }, | ||
| 364 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "TempFolder")) { Name = "Temp" }, | ||
| 365 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "TemplateFolder")) { Name = "Template" }, | ||
| 366 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "WindowsFolder")) { Name = "Windows" }, | ||
| 367 | }; | ||
| 368 | |||
| 369 | standardActionNames = new HashSet<string>(standardActions.Select(a => a.Action)); | 369 | standardActionNames = new HashSet<string>(standardActions.Select(a => a.Action)); |
| 370 | standardActionsById = standardActions.ToDictionary(a => a.Id.Id); | 370 | standardActionsById = standardActions.ToDictionary(a => a.Id.Id); |
| 371 | standardDirectoriesById = standardDirectories.ToDictionary(d => d.Id.Id); | ||
| 372 | } | 371 | } |
| 373 | 372 | ||
| 374 | /// <summary> | 373 | /// <summary> |
| @@ -376,17 +375,26 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 376 | /// </summary> | 375 | /// </summary> |
| 377 | /// <param name="actionName">Name of the action.</param> | 376 | /// <param name="actionName">Name of the action.</param> |
| 378 | /// <returns>true if the action is standard, false otherwise.</returns> | 377 | /// <returns>true if the action is standard, false otherwise.</returns> |
| 379 | public static bool IsStandardAction(string actionName) => standardActionNames.Contains(actionName); | 378 | public static bool IsStandardAction(string actionName) |
| 379 | { | ||
| 380 | return standardActionNames.Contains(actionName); | ||
| 381 | } | ||
| 380 | 382 | ||
| 381 | /// <summary> | 383 | /// <summary> |
| 382 | /// Standard actions. | 384 | /// Standard actions. |
| 383 | /// </summary> | 385 | /// </summary> |
| 384 | public static IReadOnlyCollection<WixActionSymbol> StandardActions() => standardActionsById.Values; | 386 | public static IReadOnlyCollection<WixActionSymbol> StandardActions() |
| 387 | { | ||
| 388 | return standardActionsById.Values; | ||
| 389 | } | ||
| 385 | 390 | ||
| 386 | /// <summary> | 391 | /// <summary> |
| 387 | /// Standard directories. | 392 | /// Standard directory identifiers. |
| 388 | /// </summary> | 393 | /// </summary> |
| 389 | public static IReadOnlyCollection<DirectorySymbol> StandardDirectories() => standardDirectoriesById.Values; | 394 | public static IReadOnlyCollection<string> StandardDirectoryIds() |
| 395 | { | ||
| 396 | return standardDirectoryNamesById.Keys; | ||
| 397 | } | ||
| 390 | 398 | ||
| 391 | /// <summary> | 399 | /// <summary> |
| 392 | /// Gets the platform specific directory id for a directory. Most directories are not platform | 400 | /// Gets the platform specific directory id for a directory. Most directories are not platform |
| @@ -418,28 +426,43 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 418 | /// </summary> | 426 | /// </summary> |
| 419 | /// <param name="directoryId">Name of the directory.</param> | 427 | /// <param name="directoryId">Name of the directory.</param> |
| 420 | /// <returns>true if the directory is standard, false otherwise.</returns> | 428 | /// <returns>true if the directory is standard, false otherwise.</returns> |
| 421 | public static bool IsStandardDirectory(string directoryId) => standardDirectoriesById.ContainsKey(directoryId); | 429 | public static bool IsStandardDirectory(string directoryId) |
| 430 | { | ||
| 431 | return standardDirectoryNamesById.ContainsKey(directoryId); | ||
| 432 | } | ||
| 422 | 433 | ||
| 423 | /// <summary> | 434 | /// <summary> |
| 424 | /// Find out if a property is a standard property. | 435 | /// Find out if a property is a standard property. |
| 425 | /// </summary> | 436 | /// </summary> |
| 426 | /// <param name="propertyName">Name of the property.</param> | 437 | /// <param name="propertyName">Name of the property.</param> |
| 427 | /// <returns>true if a property is standard, false otherwise.</returns> | 438 | /// <returns>true if a property is standard, false otherwise.</returns> |
| 428 | public static bool IsStandardProperty(string propertyName) => standardProperties.Contains(propertyName); | 439 | public static bool IsStandardProperty(string propertyName) |
| 440 | { | ||
| 441 | return standardProperties.Contains(propertyName); | ||
| 442 | } | ||
| 429 | 443 | ||
| 430 | /// <summary> | 444 | /// <summary> |
| 431 | /// Try to get standard action by id. | 445 | /// Try to get standard action by id. |
| 432 | /// </summary> | 446 | /// </summary> |
| 433 | public static bool TryGetStandardAction(string id, out WixActionSymbol standardAction) => standardActionsById.TryGetValue(id, out standardAction); | 447 | public static bool TryGetStandardAction(string id, out WixActionSymbol standardAction) |
| 448 | { | ||
| 449 | return standardActionsById.TryGetValue(id, out standardAction); | ||
| 450 | } | ||
| 434 | 451 | ||
| 435 | /// <summary> | 452 | /// <summary> |
| 436 | /// Try to get standard action by sequence and action name. | 453 | /// Try to get standard action by sequence and action name. |
| 437 | /// </summary> | 454 | /// </summary> |
| 438 | public static bool TryGetStandardAction(string sequenceName, string actioname, out WixActionSymbol standardAction) => standardActionsById.TryGetValue(String.Concat(sequenceName, "/", actioname), out standardAction); | 455 | public static bool TryGetStandardAction(string sequenceName, string actioname, out WixActionSymbol standardAction) |
| 456 | { | ||
| 457 | return standardActionsById.TryGetValue(String.Concat(sequenceName, "/", actioname), out standardAction); | ||
| 458 | } | ||
| 439 | 459 | ||
| 440 | /// <summary> | 460 | /// <summary> |
| 441 | /// Try to get standard directory symbol by id. | 461 | /// Try to get standard directory name by id. |
| 442 | /// </summary> | 462 | /// </summary> |
| 443 | public static bool TryGetStandardDirectory(string directoryId, out DirectorySymbol symbol) => standardDirectoriesById.TryGetValue(directoryId, out symbol); | 463 | public static bool TryGetStandardDirectoryName(string directoryId, out string name) |
| 464 | { | ||
| 465 | return standardDirectoryNamesById.TryGetValue(directoryId, out name); | ||
| 466 | } | ||
| 444 | } | 467 | } |
| 445 | } | 468 | } |
diff --git a/src/api/wix/WixToolset.Data/WixStandardLibrary.cs b/src/api/wix/WixToolset.Data/WixStandardLibrary.cs new file mode 100644 index 00000000..c5c9d8d4 --- /dev/null +++ b/src/api/wix/WixToolset.Data/WixStandardLibrary.cs | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Data | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Linq; | ||
| 8 | using WixToolset.Data.Bind; | ||
| 9 | using WixToolset.Data.Symbols; | ||
| 10 | using WixToolset.Data.WindowsInstaller; | ||
| 11 | |||
| 12 | /// <summary> | ||
| 13 | /// WiX Standard Library implementation. | ||
| 14 | /// </summary> | ||
| 15 | public static class WixStandardLibrary | ||
| 16 | { | ||
| 17 | private const string WixStandardLibraryId = "wixstd"; | ||
| 18 | |||
| 19 | /// <summary> | ||
| 20 | /// Build the wixstd.wixlib Intermediate. | ||
| 21 | /// </summary> | ||
| 22 | /// <param name="platform">Target platform for the wixstd.wixlib</param> | ||
| 23 | /// <returns>Intermediate containing the wixstd.wixlib.</returns> | ||
| 24 | public static Intermediate Build(Platform platform) | ||
| 25 | { | ||
| 26 | var localizations = YieldLocalizations(); | ||
| 27 | |||
| 28 | var sections = YieldSections(platform); | ||
| 29 | |||
| 30 | return new Intermediate(WixStandardLibraryId, IntermediateLevels.Combined, sections, localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase)); | ||
| 31 | } | ||
| 32 | |||
| 33 | private static IEnumerable<Localization> YieldLocalizations() | ||
| 34 | { | ||
| 35 | var strings = new BindVariable[0]; | ||
| 36 | |||
| 37 | var localizedControls = new LocalizedControl[0]; | ||
| 38 | |||
| 39 | yield return new Localization(LocalizationLocation.Library, null, null, String.Empty, strings.ToDictionary(s => s.Id), localizedControls.ToDictionary(l => l.GetKey())); | ||
| 40 | } | ||
| 41 | |||
| 42 | private static IEnumerable<IntermediateSection> YieldSections(Platform platform) | ||
| 43 | { | ||
| 44 | var sourceLineNumber = new SourceLineNumber("wixstd.wixlib"); | ||
| 45 | |||
| 46 | // Actions. | ||
| 47 | foreach (var actionSymbol in WindowsInstallerStandard.StandardActions()) | ||
| 48 | { | ||
| 49 | var symbol = new WixActionSymbol(sourceLineNumber, new Identifier(actionSymbol.Id.Access, actionSymbol.Id.Id)) | ||
| 50 | { | ||
| 51 | Action = actionSymbol.Action, | ||
| 52 | SequenceTable = actionSymbol.SequenceTable, | ||
| 53 | Sequence = actionSymbol.Sequence, | ||
| 54 | Condition = actionSymbol.Condition, | ||
| 55 | }; | ||
| 56 | |||
| 57 | var section = CreateSectionAroundSymbol(symbol); | ||
| 58 | |||
| 59 | yield return section; | ||
| 60 | } | ||
| 61 | |||
| 62 | // Directories. | ||
| 63 | foreach (var id in WindowsInstallerStandard.StandardDirectoryIds()) | ||
| 64 | { | ||
| 65 | var symbol = new DirectorySymbol(sourceLineNumber, new Identifier(AccessModifier.Virtual, id)) | ||
| 66 | { | ||
| 67 | ParentDirectoryRef = GetStandardDirectoryParent(id, platform), | ||
| 68 | Name = WindowsInstallerStandard.TryGetStandardDirectoryName(id, out var name) ? name : throw new InvalidOperationException("Standard directories must have a default name") | ||
| 69 | }; | ||
| 70 | |||
| 71 | var section = CreateSectionAroundSymbol(symbol); | ||
| 72 | |||
| 73 | // Add a reference for the more complicated parent directory references. | ||
| 74 | if (symbol.ParentDirectoryRef != null && symbol.ParentDirectoryRef != "TARGEDIR") | ||
| 75 | { | ||
| 76 | section.AddSymbol(new WixSimpleReferenceSymbol(sourceLineNumber) | ||
| 77 | { | ||
| 78 | Table = "Directory", | ||
| 79 | PrimaryKeys = symbol.ParentDirectoryRef | ||
| 80 | }); | ||
| 81 | } | ||
| 82 | |||
| 83 | yield return section; | ||
| 84 | } | ||
| 85 | |||
| 86 | // Package References. | ||
| 87 | { | ||
| 88 | var section = CreateSection(WixStandardLibraryIdentifiers.WixStandardPackageReferences); | ||
| 89 | |||
| 90 | section.AddSymbol(new WixFragmentSymbol(sourceLineNumber, new Identifier(AccessModifier.Global, WixStandardLibraryIdentifiers.WixStandardPackageReferences))); | ||
| 91 | |||
| 92 | section.AddSymbol(new WixSimpleReferenceSymbol(sourceLineNumber) | ||
| 93 | { | ||
| 94 | Table = SymbolDefinitions.Directory.Name, | ||
| 95 | PrimaryKeys = "TARGETDIR" | ||
| 96 | }); | ||
| 97 | |||
| 98 | yield return section; | ||
| 99 | } | ||
| 100 | |||
| 101 | // Module References. | ||
| 102 | { | ||
| 103 | var section = CreateSection(WixStandardLibraryIdentifiers.WixStandardModuleReferences); | ||
| 104 | |||
| 105 | section.AddSymbol(new WixFragmentSymbol(sourceLineNumber, new Identifier(AccessModifier.Global, WixStandardLibraryIdentifiers.WixStandardModuleReferences))); | ||
| 106 | |||
| 107 | section.AddSymbol(new WixSimpleReferenceSymbol(sourceLineNumber) | ||
| 108 | { | ||
| 109 | Table = SymbolDefinitions.Directory.Name, | ||
| 110 | PrimaryKeys = "TARGETDIR" | ||
| 111 | }); | ||
| 112 | |||
| 113 | yield return section; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | private static IntermediateSection CreateSection(string sectionId) | ||
| 118 | { | ||
| 119 | return new IntermediateSection(sectionId, SectionType.Fragment, WixStandardLibraryId).AssignToLibrary(WixStandardLibraryId); | ||
| 120 | } | ||
| 121 | |||
| 122 | private static IntermediateSection CreateSectionAroundSymbol(IntermediateSymbol symbol) | ||
| 123 | { | ||
| 124 | var section = CreateSection(symbol.Id.Id); | ||
| 125 | |||
| 126 | section.AddSymbol(symbol); | ||
| 127 | |||
| 128 | return section; | ||
| 129 | } | ||
| 130 | |||
| 131 | private static string GetStandardDirectoryParent(string directoryId, Platform platform) | ||
| 132 | { | ||
| 133 | switch (directoryId) | ||
| 134 | { | ||
| 135 | case "TARGETDIR": | ||
| 136 | return null; | ||
| 137 | |||
| 138 | case "CommonFiles6432Folder": | ||
| 139 | return platform == Platform.X86 ? "CommonFilesFolder" : "CommonFiles64Folder"; | ||
| 140 | |||
| 141 | case "ProgramFiles6432Folder": | ||
| 142 | return platform == Platform.X86 ? "ProgramFilesFolder" : "ProgramFiles64Folder"; | ||
| 143 | |||
| 144 | case "System6432Folder": | ||
| 145 | return platform == Platform.X86 ? "SystemFolder" : "System64Folder"; | ||
| 146 | |||
| 147 | default: | ||
| 148 | return "TARGETDIR"; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | } | ||
| 152 | } | ||
diff --git a/src/api/wix/WixToolset.Data/WixStandardLibraryIdentifiers.cs b/src/api/wix/WixToolset.Data/WixStandardLibraryIdentifiers.cs new file mode 100644 index 00000000..8c4ac08e --- /dev/null +++ b/src/api/wix/WixToolset.Data/WixStandardLibraryIdentifiers.cs | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Data | ||
| 4 | { | ||
| 5 | /// <summary> | ||
| 6 | /// Well-known identifier names from the wixstd.wixlib. | ||
| 7 | /// </summary> | ||
| 8 | public static class WixStandardLibraryIdentifiers | ||
| 9 | { | ||
| 10 | /// <summary> | ||
| 11 | /// WiX Standard references for packages. | ||
| 12 | /// </summary> | ||
| 13 | public static readonly string WixStandardPackageReferences = "WixStandardPackageReferences"; | ||
| 14 | |||
| 15 | /// <summary> | ||
| 16 | /// WiX Standard references for modules. | ||
| 17 | /// </summary> | ||
| 18 | public static readonly string WixStandardModuleReferences = "WixStandardModuleReferences"; | ||
| 19 | } | ||
| 20 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs index 8556d9eb..402d78fe 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs | |||
| @@ -48,6 +48,16 @@ namespace WixToolset.Extensibility.Data | |||
| 48 | string OutputPath { get; set; } | 48 | string OutputPath { get; set; } |
| 49 | 49 | ||
| 50 | /// <summary> | 50 | /// <summary> |
| 51 | /// Gets or sets the platform for the output. | ||
| 52 | /// </summary> | ||
| 53 | Platform Platform { get; set; } | ||
| 54 | |||
| 55 | /// <summary> | ||
| 56 | /// Gets or sets whether to skip the standard wixlib. | ||
| 57 | /// </summary> | ||
| 58 | bool SkipStdWixlib { get; set; } | ||
| 59 | |||
| 60 | /// <summary> | ||
| 51 | /// Symbol definition creator used to load extension data. | 61 | /// Symbol definition creator used to load extension data. |
| 52 | /// </summary> | 62 | /// </summary> |
| 53 | ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } | 63 | ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } |
