diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-07-05 23:08:20 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-07-08 15:18:09 -0700 |
| commit | 7b583330fd42356930bdc5a28820e546f6ca45a4 (patch) | |
| tree | 3166934d86ed47519bbee32bfa26529400e74ee7 /src | |
| parent | e4d3a0d14dec69fd110394b361274de86f61afa2 (diff) | |
| download | wix-7b583330fd42356930bdc5a28820e546f6ca45a4.tar.gz wix-7b583330fd42356930bdc5a28820e546f6ca45a4.tar.bz2 wix-7b583330fd42356930bdc5a28820e546f6ca45a4.zip | |
Move short filename generation to the WindowsInstallerBackend
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs | 143 | ||||
| -rw-r--r-- | src/WixToolset.Core/Common.cs | 2 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 124 | ||||
| -rw-r--r-- | src/WixToolset.Core/CompilerCore.cs | 1 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler_2.cs | 46 | ||||
| -rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | 14 |
6 files changed, 171 insertions, 159 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs index 5b838af8..663931b9 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs | |||
| @@ -5,7 +5,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Globalization; | 7 | using System.Globalization; |
| 8 | using System.IO; | ||
| 8 | using System.Linq; | 9 | using System.Linq; |
| 10 | using System.Security.Cryptography; | ||
| 11 | using System.Text; | ||
| 9 | using WixToolset.Data; | 12 | using WixToolset.Data; |
| 10 | using WixToolset.Data.Symbols; | 13 | using WixToolset.Data.Symbols; |
| 11 | using WixToolset.Data.WindowsInstaller; | 14 | using WixToolset.Data.WindowsInstaller; |
| @@ -97,6 +100,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 97 | this.AddDirectorySymbol((DirectorySymbol)symbol); | 100 | this.AddDirectorySymbol((DirectorySymbol)symbol); |
| 98 | break; | 101 | break; |
| 99 | 102 | ||
| 103 | case SymbolDefinitionType.DuplicateFile: | ||
| 104 | this.AddDuplicateFileSymbol((DuplicateFileSymbol)symbol); | ||
| 105 | break; | ||
| 106 | |||
| 100 | case SymbolDefinitionType.Environment: | 107 | case SymbolDefinitionType.Environment: |
| 101 | this.AddEnvironmentSymbol((EnvironmentSymbol)symbol); | 108 | this.AddEnvironmentSymbol((EnvironmentSymbol)symbol); |
| 102 | break; | 109 | break; |
| @@ -117,6 +124,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 117 | this.AddIniFileSymbol((IniFileSymbol)symbol); | 124 | this.AddIniFileSymbol((IniFileSymbol)symbol); |
| 118 | break; | 125 | break; |
| 119 | 126 | ||
| 127 | case SymbolDefinitionType.IniLocator: | ||
| 128 | this.AddIniLocatorSymbol((IniLocatorSymbol)symbol); | ||
| 129 | break; | ||
| 130 | |||
| 120 | case SymbolDefinitionType.Media: | 131 | case SymbolDefinitionType.Media: |
| 121 | this.AddMediaSymbol((MediaSymbol)symbol); | 132 | this.AddMediaSymbol((MediaSymbol)symbol); |
| 122 | break; | 133 | break; |
| @@ -444,6 +455,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 444 | 455 | ||
| 445 | private void AddDirectorySymbol(DirectorySymbol symbol) | 456 | private void AddDirectorySymbol(DirectorySymbol symbol) |
| 446 | { | 457 | { |
| 458 | if (String.IsNullOrEmpty(symbol.ShortName) && !symbol.Name.Equals(".") && !symbol.Name.Equals("SourceDir") && !Common.IsValidShortFilename(symbol.Name, false)) | ||
| 459 | { | ||
| 460 | symbol.ShortName = CreateShortName(symbol.Name, false, false, "Directory", symbol.ParentDirectoryRef); | ||
| 461 | } | ||
| 462 | |||
| 463 | if (String.IsNullOrEmpty(symbol.SourceShortName) && !String.IsNullOrEmpty(symbol.SourceName) && !Common.IsValidShortFilename(symbol.SourceName, false)) | ||
| 464 | { | ||
| 465 | symbol.SourceShortName = CreateShortName(symbol.SourceName, false, false, "Directory", symbol.ParentDirectoryRef); | ||
| 466 | } | ||
| 467 | |||
| 447 | var sourceName = GetMsiFilenameValue(symbol.SourceShortName, symbol.SourceName); | 468 | var sourceName = GetMsiFilenameValue(symbol.SourceShortName, symbol.SourceName); |
| 448 | var targetName = GetMsiFilenameValue(symbol.ShortName, symbol.Name); | 469 | var targetName = GetMsiFilenameValue(symbol.ShortName, symbol.Name); |
| 449 | 470 | ||
| @@ -460,6 +481,22 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 460 | row[2] = defaultDir; | 481 | row[2] = defaultDir; |
| 461 | } | 482 | } |
| 462 | 483 | ||
| 484 | private void AddDuplicateFileSymbol(DuplicateFileSymbol symbol) | ||
| 485 | { | ||
| 486 | var name = symbol.DestinationName; | ||
| 487 | if (null == symbol.DestinationShortName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 488 | { | ||
| 489 | symbol.DestinationShortName = CreateShortName(name, true, false, "CopyFile", symbol.ComponentRef, symbol.FileRef); | ||
| 490 | } | ||
| 491 | |||
| 492 | var row = this.CreateRow(symbol, "DuplicateFile"); | ||
| 493 | row[0] = symbol.Id.Id; | ||
| 494 | row[1] = symbol.ComponentRef; | ||
| 495 | row[2] = symbol.FileRef; | ||
| 496 | row[3] = GetMsiFilenameValue(symbol.DestinationShortName, symbol.DestinationName); | ||
| 497 | row[4] = symbol.DestinationFolder; | ||
| 498 | } | ||
| 499 | |||
| 463 | private void AddEnvironmentSymbol(EnvironmentSymbol symbol) | 500 | private void AddEnvironmentSymbol(EnvironmentSymbol symbol) |
| 464 | { | 501 | { |
| 465 | var action = String.Empty; | 502 | var action = String.Empty; |
| @@ -525,10 +562,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 525 | 562 | ||
| 526 | private void AddFileSymbol(FileSymbol symbol) | 563 | private void AddFileSymbol(FileSymbol symbol) |
| 527 | { | 564 | { |
| 565 | var name = symbol.Name; | ||
| 566 | if (null == symbol.ShortName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 567 | { | ||
| 568 | symbol.ShortName = CreateShortName(name, true, false, "File", symbol.DirectoryRef); | ||
| 569 | } | ||
| 570 | |||
| 528 | var row = (FileRow)this.CreateRow(symbol, "File"); | 571 | var row = (FileRow)this.CreateRow(symbol, "File"); |
| 529 | row.File = symbol.Id.Id; | 572 | row.File = symbol.Id.Id; |
| 530 | row.Component = symbol.ComponentRef; | 573 | row.Component = symbol.ComponentRef; |
| 531 | row.FileName = GetMsiFilenameValue(symbol.ShortName, symbol.Name); | 574 | row.FileName = GetMsiFilenameValue(symbol.ShortName, name); |
| 532 | row.FileSize = symbol.FileSize; | 575 | row.FileSize = symbol.FileSize; |
| 533 | row.Version = symbol.Version; | 576 | row.Version = symbol.Version; |
| 534 | row.Language = symbol.Language; | 577 | row.Language = symbol.Language; |
| @@ -564,9 +607,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 564 | { | 607 | { |
| 565 | var tableName = (InifFileActionType.AddLine == symbol.Action || InifFileActionType.AddTag == symbol.Action || InifFileActionType.CreateLine == symbol.Action) ? "IniFile" : "RemoveIniFile"; | 608 | var tableName = (InifFileActionType.AddLine == symbol.Action || InifFileActionType.AddTag == symbol.Action || InifFileActionType.CreateLine == symbol.Action) ? "IniFile" : "RemoveIniFile"; |
| 566 | 609 | ||
| 610 | var name = symbol.FileName; | ||
| 611 | if (null == symbol.ShortFileName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 612 | { | ||
| 613 | symbol.ShortFileName = CreateShortName(name, true, false, "IniFile", symbol.ComponentRef); | ||
| 614 | } | ||
| 615 | |||
| 567 | var row = this.CreateRow(symbol, tableName); | 616 | var row = this.CreateRow(symbol, tableName); |
| 568 | row[0] = symbol.Id.Id; | 617 | row[0] = symbol.Id.Id; |
| 569 | row[1] = symbol.FileName; | 618 | row[1] = GetMsiFilenameValue(symbol.ShortFileName, name); |
| 570 | row[2] = symbol.DirProperty; | 619 | row[2] = symbol.DirProperty; |
| 571 | row[3] = symbol.Section; | 620 | row[3] = symbol.Section; |
| 572 | row[4] = symbol.Key; | 621 | row[4] = symbol.Key; |
| @@ -575,6 +624,23 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 575 | row[7] = symbol.ComponentRef; | 624 | row[7] = symbol.ComponentRef; |
| 576 | } | 625 | } |
| 577 | 626 | ||
| 627 | private void AddIniLocatorSymbol(IniLocatorSymbol symbol) | ||
| 628 | { | ||
| 629 | var name = symbol.FileName; | ||
| 630 | if (null == symbol.ShortFileName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 631 | { | ||
| 632 | symbol.ShortFileName = CreateShortName(name, true, false, "IniFileSearch"); | ||
| 633 | } | ||
| 634 | |||
| 635 | var row = this.CreateRow(symbol, "IniLocator"); | ||
| 636 | row[0] = symbol.Id.Id; | ||
| 637 | row[1] = GetMsiFilenameValue(symbol.ShortFileName, name); | ||
| 638 | row[2] = symbol.Section; | ||
| 639 | row[3] = symbol.Key; | ||
| 640 | row[4] = symbol.Field; | ||
| 641 | row[5] = symbol.Type; | ||
| 642 | } | ||
| 643 | |||
| 578 | private void AddMediaSymbol(MediaSymbol symbol) | 644 | private void AddMediaSymbol(MediaSymbol symbol) |
| 579 | { | 645 | { |
| 580 | if (this.Section.Type != SectionType.Module) | 646 | if (this.Section.Type != SectionType.Module) |
| @@ -653,11 +719,17 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 653 | 719 | ||
| 654 | private void AddMoveFileSymbol(MoveFileSymbol symbol) | 720 | private void AddMoveFileSymbol(MoveFileSymbol symbol) |
| 655 | { | 721 | { |
| 722 | var name = symbol.DestinationName; | ||
| 723 | if (null == symbol.DestinationShortName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 724 | { | ||
| 725 | symbol.DestinationShortName = CreateShortName(name, true, false, "MoveFile", symbol.ComponentRef); | ||
| 726 | } | ||
| 727 | |||
| 656 | var row = this.CreateRow(symbol, "MoveFile"); | 728 | var row = this.CreateRow(symbol, "MoveFile"); |
| 657 | row[0] = symbol.Id.Id; | 729 | row[0] = symbol.Id.Id; |
| 658 | row[1] = symbol.ComponentRef; | 730 | row[1] = symbol.ComponentRef; |
| 659 | row[2] = symbol.SourceName; | 731 | row[2] = symbol.SourceName; |
| 660 | row[3] = symbol.DestName; | 732 | row[3] = GetMsiFilenameValue(symbol.DestinationShortName, symbol.DestinationName); |
| 661 | row[4] = symbol.SourceFolder; | 733 | row[4] = symbol.SourceFolder; |
| 662 | row[5] = symbol.DestFolder; | 734 | row[5] = symbol.DestFolder; |
| 663 | row[6] = symbol.Delete ? WindowsInstallerConstants.MsidbMoveFileOptionsMove : 0; | 735 | row[6] = symbol.Delete ? WindowsInstallerConstants.MsidbMoveFileOptionsMove : 0; |
| @@ -677,14 +749,20 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 677 | 749 | ||
| 678 | private void AddRemoveFileSymbol(RemoveFileSymbol symbol) | 750 | private void AddRemoveFileSymbol(RemoveFileSymbol symbol) |
| 679 | { | 751 | { |
| 752 | var name = symbol.FileName; | ||
| 753 | if (null == symbol.ShortFileName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 754 | { | ||
| 755 | symbol.ShortFileName = CreateShortName(name, true, false, "RemoveFile", symbol.ComponentRef); | ||
| 756 | } | ||
| 757 | |||
| 680 | var installMode = symbol.OnInstall == true ? WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall : 0; | 758 | var installMode = symbol.OnInstall == true ? WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall : 0; |
| 681 | installMode |= symbol.OnUninstall == true ? WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove : 0; | 759 | installMode |= symbol.OnUninstall == true ? WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove : 0; |
| 682 | 760 | ||
| 683 | var row = this.CreateRow(symbol, "RemoveFile"); | 761 | var row = this.CreateRow(symbol, "RemoveFile"); |
| 684 | row[0] = symbol.Id.Id; | 762 | row[0] = symbol.Id.Id; |
| 685 | row[1] = symbol.ComponentRef; | 763 | row[1] = symbol.ComponentRef; |
| 686 | row[2] = symbol.FileName; | 764 | row[2] = GetMsiFilenameValue(symbol.ShortFileName, symbol.FileName); |
| 687 | row[3] = symbol.DirProperty; | 765 | row[3] = symbol.DirPropertyRef; |
| 688 | row[4] = installMode; | 766 | row[4] = installMode; |
| 689 | } | 767 | } |
| 690 | 768 | ||
| @@ -821,10 +899,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 821 | 899 | ||
| 822 | private void AddShortcutSymbol(ShortcutSymbol symbol) | 900 | private void AddShortcutSymbol(ShortcutSymbol symbol) |
| 823 | { | 901 | { |
| 902 | var name = symbol.Name; | ||
| 903 | if (null == symbol.ShortName && null != name && !Common.IsValidShortFilename(name, false)) | ||
| 904 | { | ||
| 905 | symbol.ShortName = CreateShortName(name, true, false, "Shortcut", symbol.ComponentRef, symbol.DirectoryRef); | ||
| 906 | } | ||
| 907 | |||
| 824 | var row = this.CreateRow(symbol, "Shortcut"); | 908 | var row = this.CreateRow(symbol, "Shortcut"); |
| 825 | row[0] = symbol.Id.Id; | 909 | row[0] = symbol.Id.Id; |
| 826 | row[1] = symbol.DirectoryRef; | 910 | row[1] = symbol.DirectoryRef; |
| 827 | row[2] = GetMsiFilenameValue(symbol.ShortName, symbol.Name); | 911 | row[2] = GetMsiFilenameValue(symbol.ShortName, name); |
| 828 | row[3] = symbol.ComponentRef; | 912 | row[3] = symbol.ComponentRef; |
| 829 | row[4] = symbol.Target; | 913 | row[4] = symbol.Target; |
| 830 | row[5] = symbol.Arguments; | 914 | row[5] = symbol.Arguments; |
| @@ -1117,5 +1201,52 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 1117 | return shortName + "|" + longName; | 1201 | return shortName + "|" + longName; |
| 1118 | } | 1202 | } |
| 1119 | } | 1203 | } |
| 1204 | |||
| 1205 | private static string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args) | ||
| 1206 | { | ||
| 1207 | longName = longName.ToLowerInvariant(); | ||
| 1208 | |||
| 1209 | // collect all the data | ||
| 1210 | var strings = new List<string>(1 + args.Length); | ||
| 1211 | strings.Add(longName); | ||
| 1212 | strings.AddRange(args); | ||
| 1213 | |||
| 1214 | // prepare for hashing | ||
| 1215 | var stringData = String.Join("|", strings); | ||
| 1216 | var data = Encoding.UTF8.GetBytes(stringData); | ||
| 1217 | |||
| 1218 | // hash the data | ||
| 1219 | byte[] hash; | ||
| 1220 | using (var sha1 = new SHA1CryptoServiceProvider()) | ||
| 1221 | { | ||
| 1222 | hash = sha1.ComputeHash(data); | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | // generate the short file/directory name without an extension | ||
| 1226 | var shortName = new StringBuilder(Convert.ToBase64String(hash)); | ||
| 1227 | shortName.Length = 8; | ||
| 1228 | shortName.Replace('+', '-').Replace('/', '_'); | ||
| 1229 | |||
| 1230 | if (keepExtension) | ||
| 1231 | { | ||
| 1232 | var extension = Path.GetExtension(longName); | ||
| 1233 | |||
| 1234 | if (4 < extension.Length) | ||
| 1235 | { | ||
| 1236 | extension = extension.Substring(0, 4); | ||
| 1237 | } | ||
| 1238 | |||
| 1239 | shortName.Append(extension); | ||
| 1240 | |||
| 1241 | // check the generated short name to ensure its still legal (the extension may not be legal) | ||
| 1242 | if (!Common.IsValidShortFilename(shortName.ToString(), allowWildcards)) | ||
| 1243 | { | ||
| 1244 | // remove the extension (by truncating the generated file name back to the generated characters) | ||
| 1245 | shortName.Length -= extension.Length; | ||
| 1246 | } | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | return shortName.ToString().ToLowerInvariant(); | ||
| 1250 | } | ||
| 1120 | } | 1251 | } |
| 1121 | } | 1252 | } |
diff --git a/src/WixToolset.Core/Common.cs b/src/WixToolset.Core/Common.cs index 183d7abd..a9fc9538 100644 --- a/src/WixToolset.Core/Common.cs +++ b/src/WixToolset.Core/Common.cs | |||
| @@ -188,7 +188,7 @@ namespace WixToolset.Core | |||
| 188 | /// <param name="filename">Filename to verify.</param> | 188 | /// <param name="filename">Filename to verify.</param> |
| 189 | /// <param name="allowWildcards">true if wildcards are allowed in the filename.</param> | 189 | /// <param name="allowWildcards">true if wildcards are allowed in the filename.</param> |
| 190 | /// <returns>True if the filename is a valid short filename</returns> | 190 | /// <returns>True if the filename is a valid short filename</returns> |
| 191 | internal static bool IsValidShortFilename(string filename, bool allowWildcards) | 191 | public static bool IsValidShortFilename(string filename, bool allowWildcards) |
| 192 | { | 192 | { |
| 193 | if (String.IsNullOrEmpty(filename)) | 193 | if (String.IsNullOrEmpty(filename)) |
| 194 | { | 194 | { |
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 4d0e608b..b29821b0 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -300,24 +300,6 @@ namespace WixToolset.Core | |||
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | /// <summary> | 302 | /// <summary> |
| 303 | /// Given a possible short and long file name, create an msi filename value. | ||
| 304 | /// </summary> | ||
| 305 | /// <param name="shortName">The short file name.</param> | ||
| 306 | /// <param name="longName">Possibly the long file name.</param> | ||
| 307 | /// <returns>The value in the msi filename data type.</returns> | ||
| 308 | private string GetMsiFilenameValue(string shortName, string longName) | ||
| 309 | { | ||
| 310 | if (null != shortName && null != longName && !String.Equals(shortName, longName, StringComparison.OrdinalIgnoreCase)) | ||
| 311 | { | ||
| 312 | return String.Concat(shortName, "|", longName); | ||
| 313 | } | ||
| 314 | else | ||
| 315 | { | ||
| 316 | return this.Core.IsValidShortFilename(longName, false) ? longName : shortName; | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | /// <summary> | ||
| 321 | /// Adds a search property to the active section. | 303 | /// Adds a search property to the active section. |
| 322 | /// </summary> | 304 | /// </summary> |
| 323 | /// <param name="sourceLineNumbers">Current source/line number of processing.</param> | 305 | /// <param name="sourceLineNumbers">Current source/line number of processing.</param> |
| @@ -3036,12 +3018,6 @@ namespace WixToolset.Core | |||
| 3036 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DestinationProperty", "DestinationDirectory")); | 3018 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DestinationProperty", "DestinationDirectory")); |
| 3037 | } | 3019 | } |
| 3038 | 3020 | ||
| 3039 | // generate a short file name | ||
| 3040 | if (null == destinationShortName && (null != destinationName && !this.Core.IsValidShortFilename(destinationName, false))) | ||
| 3041 | { | ||
| 3042 | destinationShortName = this.Core.CreateShortName(destinationName, true, false, node.Name.LocalName, componentId); | ||
| 3043 | } | ||
| 3044 | |||
| 3045 | if (null == id) | 3021 | if (null == id) |
| 3046 | { | 3022 | { |
| 3047 | id = this.Core.CreateIdentifier("cf", sourceFolder, sourceDirectory, sourceProperty, destinationDirectory, destinationProperty, destinationName); | 3023 | id = this.Core.CreateIdentifier("cf", sourceFolder, sourceDirectory, sourceProperty, destinationDirectory, destinationProperty, destinationName); |
| @@ -3063,7 +3039,8 @@ namespace WixToolset.Core | |||
| 3063 | { | 3039 | { |
| 3064 | ComponentRef = componentId, | 3040 | ComponentRef = componentId, |
| 3065 | SourceName = sourceName, | 3041 | SourceName = sourceName, |
| 3066 | DestName= String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName), | 3042 | DestinationName = destinationName, |
| 3043 | DestinationShortName = destinationShortName, | ||
| 3067 | SourceFolder = sourceDirectory ?? sourceProperty, | 3044 | SourceFolder = sourceDirectory ?? sourceProperty, |
| 3068 | DestFolder = destinationDirectory ?? destinationProperty, | 3045 | DestFolder = destinationDirectory ?? destinationProperty, |
| 3069 | Delete = delete, | 3046 | Delete = delete, |
| @@ -3108,7 +3085,8 @@ namespace WixToolset.Core | |||
| 3108 | { | 3085 | { |
| 3109 | ComponentRef = componentId, | 3086 | ComponentRef = componentId, |
| 3110 | FileRef = fileId, | 3087 | FileRef = fileId, |
| 3111 | DestinationName = String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName), | 3088 | DestinationName = destinationName, |
| 3089 | DestinationShortName = destinationShortName, | ||
| 3112 | DestinationFolder = destinationDirectory ?? destinationProperty, | 3090 | DestinationFolder = destinationDirectory ?? destinationProperty, |
| 3113 | }); | 3091 | }); |
| 3114 | } | 3092 | } |
| @@ -4184,16 +4162,12 @@ namespace WixToolset.Core | |||
| 4184 | { | 4162 | { |
| 4185 | if (String.IsNullOrEmpty(shortName)) | 4163 | if (String.IsNullOrEmpty(shortName)) |
| 4186 | { | 4164 | { |
| 4187 | if (!name.Equals(".") && !name.Equals("SourceDir") && !this.Core.IsValidShortFilename(name, false)) | ||
| 4188 | { | ||
| 4189 | shortName = this.Core.CreateShortName(name, false, false, "Directory", parentId); | ||
| 4190 | } | ||
| 4191 | } | 4165 | } |
| 4192 | else if (name.Equals(".")) | 4166 | else if (name == ".") |
| 4193 | { | 4167 | { |
| 4194 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name", name)); | 4168 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name", name)); |
| 4195 | } | 4169 | } |
| 4196 | else if (name.Equals(shortName)) | 4170 | else if (name.Equals(shortName, StringComparison.OrdinalIgnoreCase)) |
| 4197 | { | 4171 | { |
| 4198 | this.Core.Write(WarningMessages.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "Name", "ShortName", name)); | 4172 | this.Core.Write(WarningMessages.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "Name", "ShortName", name)); |
| 4199 | } | 4173 | } |
| @@ -4210,16 +4184,12 @@ namespace WixToolset.Core | |||
| 4210 | { | 4184 | { |
| 4211 | if (String.IsNullOrEmpty(shortSourceName)) | 4185 | if (String.IsNullOrEmpty(shortSourceName)) |
| 4212 | { | 4186 | { |
| 4213 | if (!sourceName.Equals(".") && !this.Core.IsValidShortFilename(sourceName, false)) | ||
| 4214 | { | ||
| 4215 | shortSourceName = this.Core.CreateShortName(sourceName, false, false, "Directory", parentId); | ||
| 4216 | } | ||
| 4217 | } | 4187 | } |
| 4218 | else if (sourceName.Equals(".")) | 4188 | else if (sourceName == ".") |
| 4219 | { | 4189 | { |
| 4220 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortSourceName", "SourceName", sourceName)); | 4190 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortSourceName", "SourceName", sourceName)); |
| 4221 | } | 4191 | } |
| 4222 | else if (sourceName.Equals(shortSourceName)) | 4192 | else if (sourceName.Equals(shortSourceName, StringComparison.OrdinalIgnoreCase)) |
| 4223 | { | 4193 | { |
| 4224 | this.Core.Write(WarningMessages.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "SourceName", "ShortSourceName", sourceName)); | 4194 | this.Core.Write(WarningMessages.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "SourceName", "ShortSourceName", sourceName)); |
| 4225 | } | 4195 | } |
| @@ -5463,7 +5433,6 @@ namespace WixToolset.Core | |||
| 5463 | var defaultSize = 0; | 5433 | var defaultSize = 0; |
| 5464 | string defaultVersion = null; | 5434 | string defaultVersion = null; |
| 5465 | string fontTitle = null; | 5435 | string fontTitle = null; |
| 5466 | var generatedShortFileName = false; | ||
| 5467 | var keyPath = YesNoType.NotSet; | 5436 | var keyPath = YesNoType.NotSet; |
| 5468 | string name = null; | 5437 | string name = null; |
| 5469 | var patchGroup = CompilerConstants.IntegerNotSet; | 5438 | var patchGroup = CompilerConstants.IntegerNotSet; |
| @@ -5686,16 +5655,22 @@ namespace WixToolset.Core | |||
| 5686 | } | 5655 | } |
| 5687 | } | 5656 | } |
| 5688 | 5657 | ||
| 5689 | // generate a short file name | 5658 | if (name == null) |
| 5690 | if (null == shortName && (null != name && !this.Core.IsValidShortFilename(name, false))) | ||
| 5691 | { | 5659 | { |
| 5692 | shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName, directoryId); | 5660 | if (shortName == null) |
| 5693 | generatedShortFileName = true; | 5661 | { |
| 5662 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); | ||
| 5663 | } | ||
| 5664 | else | ||
| 5665 | { | ||
| 5666 | name = shortName; | ||
| 5667 | shortName = null; | ||
| 5668 | } | ||
| 5694 | } | 5669 | } |
| 5695 | 5670 | ||
| 5696 | if (null == id) | 5671 | if (null == id) |
| 5697 | { | 5672 | { |
| 5698 | id = this.Core.CreateIdentifier("fil", directoryId, name ?? shortName); | 5673 | id = this.Core.CreateIdentifier("fil", directoryId, name); |
| 5699 | } | 5674 | } |
| 5700 | 5675 | ||
| 5701 | if (null != defaultVersion && null != companionFile) | 5676 | if (null != defaultVersion && null != companionFile) |
| @@ -5811,11 +5786,11 @@ namespace WixToolset.Core | |||
| 5811 | 5786 | ||
| 5812 | if (String.IsNullOrEmpty(source)) | 5787 | if (String.IsNullOrEmpty(source)) |
| 5813 | { | 5788 | { |
| 5814 | source = name ?? shortName; | 5789 | source = name; |
| 5815 | } | 5790 | } |
| 5816 | else if (source.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) // if source relies on parent directories, append the file name | 5791 | else if (source.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) // if source relies on parent directories, append the file name |
| 5817 | { | 5792 | { |
| 5818 | source = null == name ? Path.Combine(source, shortName) : Path.Combine(source, name); | 5793 | source = Path.Combine(source, name); |
| 5819 | } | 5794 | } |
| 5820 | 5795 | ||
| 5821 | var attributes = FileSymbolAttributes.None; | 5796 | var attributes = FileSymbolAttributes.None; |
| @@ -5826,7 +5801,6 @@ namespace WixToolset.Core | |||
| 5826 | attributes |= checksum ? FileSymbolAttributes.Checksum : 0; | 5801 | attributes |= checksum ? FileSymbolAttributes.Checksum : 0; |
| 5827 | attributes |= compressed.HasValue && compressed == true ? FileSymbolAttributes.Compressed : 0; | 5802 | attributes |= compressed.HasValue && compressed == true ? FileSymbolAttributes.Compressed : 0; |
| 5828 | attributes |= compressed.HasValue && compressed == false ? FileSymbolAttributes.Uncompressed : 0; | 5803 | attributes |= compressed.HasValue && compressed == false ? FileSymbolAttributes.Uncompressed : 0; |
| 5829 | attributes |= generatedShortFileName ? FileSymbolAttributes.GeneratedShortFileName : 0; | ||
| 5830 | 5804 | ||
| 5831 | this.Core.AddSymbol(new FileSymbol(sourceLineNumbers, id) | 5805 | this.Core.AddSymbol(new FileSymbol(sourceLineNumbers, id) |
| 5832 | { | 5806 | { |
| @@ -5838,14 +5812,6 @@ namespace WixToolset.Core | |||
| 5838 | Language = defaultLanguage, | 5812 | Language = defaultLanguage, |
| 5839 | Attributes = attributes, | 5813 | Attributes = attributes, |
| 5840 | 5814 | ||
| 5841 | //ReadOnly = readOnly, | ||
| 5842 | //Hidden = hidden, | ||
| 5843 | //System = system, | ||
| 5844 | //Vital = vital, | ||
| 5845 | //Checksum = checksum, | ||
| 5846 | //Compressed = compressed, | ||
| 5847 | //GeneratedShortFileName = generatedShortFileName, | ||
| 5848 | |||
| 5849 | DirectoryRef = directoryId, | 5815 | DirectoryRef = directoryId, |
| 5850 | DiskId = (CompilerConstants.IntegerNotSet == diskId) ? null : (int?)diskId, | 5816 | DiskId = (CompilerConstants.IntegerNotSet == diskId) ? null : (int?)diskId, |
| 5851 | Source = new IntermediateFieldPathValue { Path = source }, | 5817 | Source = new IntermediateFieldPathValue { Path = source }, |
| @@ -6454,28 +6420,6 @@ namespace WixToolset.Core | |||
| 6454 | { | 6420 | { |
| 6455 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); | 6421 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); |
| 6456 | } | 6422 | } |
| 6457 | else if (0 < name.Length) | ||
| 6458 | { | ||
| 6459 | if (this.Core.IsValidShortFilename(name, false)) | ||
| 6460 | { | ||
| 6461 | if (null == shortName) | ||
| 6462 | { | ||
| 6463 | shortName = name; | ||
| 6464 | name = null; | ||
| 6465 | } | ||
| 6466 | else | ||
| 6467 | { | ||
| 6468 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); | ||
| 6469 | } | ||
| 6470 | } | ||
| 6471 | else // generate a short file name. | ||
| 6472 | { | ||
| 6473 | if (null == shortName) | ||
| 6474 | { | ||
| 6475 | shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName, componentId); | ||
| 6476 | } | ||
| 6477 | } | ||
| 6478 | } | ||
| 6479 | 6423 | ||
| 6480 | if (null == section) | 6424 | if (null == section) |
| 6481 | { | 6425 | { |
| @@ -6493,7 +6437,8 @@ namespace WixToolset.Core | |||
| 6493 | { | 6437 | { |
| 6494 | this.Core.AddSymbol(new IniFileSymbol(sourceLineNumbers, id) | 6438 | this.Core.AddSymbol(new IniFileSymbol(sourceLineNumbers, id) |
| 6495 | { | 6439 | { |
| 6496 | FileName = this.GetMsiFilenameValue(shortName, name), | 6440 | FileName = name, |
| 6441 | ShortFileName = shortName, | ||
| 6497 | DirProperty = directory, | 6442 | DirProperty = directory, |
| 6498 | Section = section, | 6443 | Section = section, |
| 6499 | Key = key, | 6444 | Key = key, |
| @@ -6585,25 +6530,6 @@ namespace WixToolset.Core | |||
| 6585 | { | 6530 | { |
| 6586 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); | 6531 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); |
| 6587 | } | 6532 | } |
| 6588 | else if (0 < name.Length) | ||
| 6589 | { | ||
| 6590 | if (this.Core.IsValidShortFilename(name, false)) | ||
| 6591 | { | ||
| 6592 | if (null == shortName) | ||
| 6593 | { | ||
| 6594 | shortName = name; | ||
| 6595 | name = null; | ||
| 6596 | } | ||
| 6597 | else | ||
| 6598 | { | ||
| 6599 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); | ||
| 6600 | } | ||
| 6601 | } | ||
| 6602 | else if (null == shortName) // generate a short file name. | ||
| 6603 | { | ||
| 6604 | shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName); | ||
| 6605 | } | ||
| 6606 | } | ||
| 6607 | 6533 | ||
| 6608 | if (null == section) | 6534 | if (null == section) |
| 6609 | { | 6535 | { |
| @@ -6677,8 +6603,8 @@ namespace WixToolset.Core | |||
| 6677 | { | 6603 | { |
| 6678 | var symbol = this.Core.AddSymbol(new IniLocatorSymbol(sourceLineNumbers, id) | 6604 | var symbol = this.Core.AddSymbol(new IniLocatorSymbol(sourceLineNumbers, id) |
| 6679 | { | 6605 | { |
| 6680 | SignatureRef = id.Id, | 6606 | FileName = name, |
| 6681 | FileName = this.GetMsiFilenameValue(shortName, name), | 6607 | ShortFileName = shortName, |
| 6682 | Section = section, | 6608 | Section = section, |
| 6683 | Key = key, | 6609 | Key = key, |
| 6684 | Type = type | 6610 | Type = type |
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index 7ec83a7d..c2724f6b 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs | |||
| @@ -286,6 +286,7 @@ namespace WixToolset.Core | |||
| 286 | /// <param name="allowWildcards">true if wildcards are allowed in the filename.</param> | 286 | /// <param name="allowWildcards">true if wildcards are allowed in the filename.</param> |
| 287 | /// <param name="args">Any additional information to include in the hash for the generated short name.</param> | 287 | /// <param name="args">Any additional information to include in the hash for the generated short name.</param> |
| 288 | /// <returns>The generated 8.3-compliant short file/directory name.</returns> | 288 | /// <returns>The generated 8.3-compliant short file/directory name.</returns> |
| 289 | [Obsolete] | ||
| 289 | public string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args) | 290 | public string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args) |
| 290 | { | 291 | { |
| 291 | return this.parseHelper.CreateShortName(longName, keepExtension, allowWildcards, args); | 292 | return this.parseHelper.CreateShortName(longName, keepExtension, allowWildcards, args); |
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs index 72550ed9..7e2485e1 100644 --- a/src/WixToolset.Core/Compiler_2.cs +++ b/src/WixToolset.Core/Compiler_2.cs | |||
| @@ -2309,25 +2309,6 @@ namespace WixToolset.Core | |||
| 2309 | { | 2309 | { |
| 2310 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); | 2310 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); |
| 2311 | } | 2311 | } |
| 2312 | else if (0 < name.Length) | ||
| 2313 | { | ||
| 2314 | if (this.Core.IsValidShortFilename(name, true)) | ||
| 2315 | { | ||
| 2316 | if (null == shortName) | ||
| 2317 | { | ||
| 2318 | shortName = name; | ||
| 2319 | name = null; | ||
| 2320 | } | ||
| 2321 | else | ||
| 2322 | { | ||
| 2323 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); | ||
| 2324 | } | ||
| 2325 | } | ||
| 2326 | else if (null == shortName) // generate a short file name. | ||
| 2327 | { | ||
| 2328 | shortName = this.Core.CreateShortName(name, true, true, node.Name.LocalName, componentId); | ||
| 2329 | } | ||
| 2330 | } | ||
| 2331 | 2312 | ||
| 2332 | if (!onInstall.HasValue && !onUninstall.HasValue) | 2313 | if (!onInstall.HasValue && !onUninstall.HasValue) |
| 2333 | { | 2314 | { |
| @@ -2352,8 +2333,9 @@ namespace WixToolset.Core | |||
| 2352 | this.Core.AddSymbol(new RemoveFileSymbol(sourceLineNumbers, id) | 2333 | this.Core.AddSymbol(new RemoveFileSymbol(sourceLineNumbers, id) |
| 2353 | { | 2334 | { |
| 2354 | ComponentRef = componentId, | 2335 | ComponentRef = componentId, |
| 2355 | FileName = this.GetMsiFilenameValue(shortName, name), | 2336 | FileName = name, |
| 2356 | DirProperty = directory ?? property ?? parentDirectory, | 2337 | ShortFileName = shortName, |
| 2338 | DirPropertyRef = directory ?? property ?? parentDirectory, | ||
| 2357 | OnInstall = onInstall, | 2339 | OnInstall = onInstall, |
| 2358 | OnUninstall = onUninstall, | 2340 | OnUninstall = onUninstall, |
| 2359 | }); | 2341 | }); |
| @@ -2440,7 +2422,7 @@ namespace WixToolset.Core | |||
| 2440 | this.Core.AddSymbol(new RemoveFileSymbol(sourceLineNumbers, id) | 2422 | this.Core.AddSymbol(new RemoveFileSymbol(sourceLineNumbers, id) |
| 2441 | { | 2423 | { |
| 2442 | ComponentRef = componentId, | 2424 | ComponentRef = componentId, |
| 2443 | DirProperty = directory ?? property ?? parentDirectory, | 2425 | DirPropertyRef = directory ?? property ?? parentDirectory, |
| 2444 | OnInstall = onInstall, | 2426 | OnInstall = onInstall, |
| 2445 | OnUninstall = onUninstall | 2427 | OnUninstall = onUninstall |
| 2446 | }); | 2428 | }); |
| @@ -4293,24 +4275,6 @@ namespace WixToolset.Core | |||
| 4293 | { | 4275 | { |
| 4294 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); | 4276 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); |
| 4295 | } | 4277 | } |
| 4296 | else if (0 < name.Length) | ||
| 4297 | { | ||
| 4298 | if (this.Core.IsValidShortFilename(name, false)) | ||
| 4299 | { | ||
| 4300 | if (null == shortName) | ||
| 4301 | { | ||
| 4302 | shortName = name; | ||
| 4303 | } | ||
| 4304 | else | ||
| 4305 | { | ||
| 4306 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); | ||
| 4307 | } | ||
| 4308 | } | ||
| 4309 | else if (null == shortName) // generate a short file name. | ||
| 4310 | { | ||
| 4311 | shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName, componentId, directory); | ||
| 4312 | } | ||
| 4313 | } | ||
| 4314 | 4278 | ||
| 4315 | if ("Component" != parentElementLocalName && null != target) | 4279 | if ("Component" != parentElementLocalName && null != target) |
| 4316 | { | 4280 | { |
| @@ -4319,7 +4283,7 @@ namespace WixToolset.Core | |||
| 4319 | 4283 | ||
| 4320 | if (null == id) | 4284 | if (null == id) |
| 4321 | { | 4285 | { |
| 4322 | id = this.Core.CreateIdentifier("sct", directory, LowercaseOrNull(name) ?? LowercaseOrNull(shortName)); | 4286 | id = this.Core.CreateIdentifier("sct", directory, LowercaseOrNull(name)); |
| 4323 | } | 4287 | } |
| 4324 | 4288 | ||
| 4325 | foreach (var child in node.Elements()) | 4289 | foreach (var child in node.Elements()) |
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 7160c32e..db465354 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
| @@ -75,16 +75,6 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 75 | 75 | ||
| 76 | public Identifier CreateDirectorySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet<string> sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null) | 76 | public Identifier CreateDirectorySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet<string> sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null) |
| 77 | { | 77 | { |
| 78 | if (String.IsNullOrEmpty(shortName) && !name.Equals("SourceDir") && !this.IsValidShortFilename(name)) | ||
| 79 | { | ||
| 80 | shortName = this.CreateShortName(name, false, false, "Directory", parentId); | ||
| 81 | } | ||
| 82 | |||
| 83 | if (String.IsNullOrEmpty(shortSourceName) && !String.IsNullOrEmpty(sourceName) && !this.IsValidShortFilename(sourceName)) | ||
| 84 | { | ||
| 85 | shortSourceName = this.CreateShortName(sourceName, false, false, "Directory", parentId); | ||
| 86 | } | ||
| 87 | |||
| 88 | // For anonymous directories, create the identifier. If this identifier already exists in the | 78 | // For anonymous directories, create the identifier. If this identifier already exists in the |
| 89 | // active section, bail so we don't add duplicate anonymous directory symbols (which are legal | 79 | // active section, bail so we don't add duplicate anonymous directory symbols (which are legal |
| 90 | // but bloat the intermediate and ultimately make the linker do "busy work"). | 80 | // but bloat the intermediate and ultimately make the linker do "busy work"). |
| @@ -243,7 +233,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 243 | 233 | ||
| 244 | if (null == childId) | 234 | if (null == childId) |
| 245 | { | 235 | { |
| 246 | throw new ArgumentNullException("childId"); | 236 | throw new ArgumentNullException(nameof(childId)); |
| 247 | } | 237 | } |
| 248 | 238 | ||
| 249 | section.AddSymbol(new WixGroupSymbol(sourceLineNumbers) | 239 | section.AddSymbol(new WixGroupSymbol(sourceLineNumbers) |
| @@ -419,7 +409,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 419 | { | 409 | { |
| 420 | if (null == attribute) | 410 | if (null == attribute) |
| 421 | { | 411 | { |
| 422 | throw new ArgumentNullException("attribute"); | 412 | throw new ArgumentNullException(nameof(attribute)); |
| 423 | } | 413 | } |
| 424 | 414 | ||
| 425 | var emptyRule = canBeEmpty ? EmptyRule.CanBeEmpty : EmptyRule.CanBeWhitespaceOnly; | 415 | var emptyRule = canBeEmpty ? EmptyRule.CanBeEmpty : EmptyRule.CanBeWhitespaceOnly; |
