diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-03-14 07:38:48 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-03-14 07:47:48 -0700 |
| commit | 3ccd5e439da4296d6f2b66ce47075ab20d039676 (patch) | |
| tree | b5546552613b869367d09f444492a0bbcfadcfe0 /src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs | |
| parent | 574785ab1421c9b67336c13ade5c2263e665ca07 (diff) | |
| download | wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.tar.gz wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.tar.bz2 wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.zip | |
Minimize public surface area of Core
Fixes wixtoolset/issues#6374
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs index 49ef1adf..04f1b771 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs | |||
| @@ -12,11 +12,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 12 | using WixToolset.Data; | 12 | using WixToolset.Data; |
| 13 | using WixToolset.Data.Symbols; | 13 | using WixToolset.Data.Symbols; |
| 14 | using WixToolset.Data.WindowsInstaller; | 14 | using WixToolset.Data.WindowsInstaller; |
| 15 | using WixToolset.Extensibility.Services; | ||
| 15 | 16 | ||
| 16 | internal class ModularizeCommand | 17 | internal class ModularizeCommand |
| 17 | { | 18 | { |
| 18 | public ModularizeCommand(WindowsInstallerData output, string modularizationSuffix, IEnumerable<WixSuppressModularizationSymbol> suppressSymbols) | 19 | public ModularizeCommand(IBackendHelper backendHelper, WindowsInstallerData output, string modularizationSuffix, IEnumerable<WixSuppressModularizationSymbol> suppressSymbols) |
| 19 | { | 20 | { |
| 21 | this.BackendHelper = backendHelper; | ||
| 20 | this.Output = output; | 22 | this.Output = output; |
| 21 | this.ModularizationSuffix = modularizationSuffix; | 23 | this.ModularizationSuffix = modularizationSuffix; |
| 22 | 24 | ||
| @@ -24,6 +26,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 24 | this.SuppressModularizationIdentifiers = new HashSet<string>(suppressSymbols.Select(s => s.SuppressIdentifier)); | 26 | this.SuppressModularizationIdentifiers = new HashSet<string>(suppressSymbols.Select(s => s.SuppressIdentifier)); |
| 25 | } | 27 | } |
| 26 | 28 | ||
| 29 | private IBackendHelper BackendHelper { get; } | ||
| 30 | |||
| 27 | private WindowsInstallerData Output { get; } | 31 | private WindowsInstallerData Output { get; } |
| 28 | 32 | ||
| 29 | private string ModularizationSuffix { get; } | 33 | private string ModularizationSuffix { get; } |
| @@ -90,7 +94,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 90 | case "SetTargetPath": | 94 | case "SetTargetPath": |
| 91 | case "SpawnDialog": | 95 | case "SpawnDialog": |
| 92 | case "SpawnWaitDialog": | 96 | case "SpawnWaitDialog": |
| 93 | if (Common.IsIdentifier(fieldData)) | 97 | if (this.BackendHelper.IsValidIdentifier(fieldData)) |
| 94 | { | 98 | { |
| 95 | modularizeType = ColumnModularizeType.Column; | 99 | modularizeType = ColumnModularizeType.Column; |
| 96 | } | 100 | } |
| @@ -107,7 +111,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 107 | else if (ColumnModularizeType.ControlText == field.Column.ModularizeType) | 111 | else if (ColumnModularizeType.ControlText == field.Column.ModularizeType) |
| 108 | { | 112 | { |
| 109 | // icons are stored in the Binary table, so they get column-type modularization | 113 | // icons are stored in the Binary table, so they get column-type modularization |
| 110 | if (("Bitmap" == row[2].ToString() || "Icon" == row[2].ToString()) && Common.IsIdentifier(fieldData)) | 114 | if (("Bitmap" == row[2].ToString() || "Icon" == row[2].ToString()) && this.BackendHelper.IsValidIdentifier(fieldData)) |
| 111 | { | 115 | { |
| 112 | modularizeType = ColumnModularizeType.Column; | 116 | modularizeType = ColumnModularizeType.Column; |
| 113 | } | 117 | } |
| @@ -121,7 +125,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 121 | { | 125 | { |
| 122 | case ColumnModularizeType.Column: | 126 | case ColumnModularizeType.Column: |
| 123 | // ensure the value is an identifier (otherwise it shouldn't be modularized this way) | 127 | // ensure the value is an identifier (otherwise it shouldn't be modularized this way) |
| 124 | if (!Common.IsIdentifier(fieldData)) | 128 | if (!this.BackendHelper.IsValidIdentifier(fieldData)) |
| 125 | { | 129 | { |
| 126 | throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_CannotModularizeIllegalID, fieldData)); | 130 | throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_CannotModularizeIllegalID, fieldData)); |
| 127 | } | 131 | } |
