aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-21 13:42:52 -0800
committerRob Mensching <rob@firegiant.com>2017-12-21 13:42:52 -0800
commitdc9f4c329e6f55ce7595970463e0caf148096f4b (patch)
tree86155ac36c76acda0a4b1673c77f54a9780c6885 /src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
parent155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (diff)
downloadwix-dc9f4c329e6f55ce7595970463e0caf148096f4b.tar.gz
wix-dc9f4c329e6f55ce7595970463e0caf148096f4b.tar.bz2
wix-dc9f4c329e6f55ce7595970463e0caf148096f4b.zip
Support wixout and extract Resolve and Layout from Binder
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs98
1 files changed, 6 insertions, 92 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
index 410e462a..2f161305 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
@@ -22,31 +22,27 @@ namespace WixToolset.Core.WindowsInstaller.Bind
22 // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs. 22 // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs.
23 internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}"); 23 internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}");
24 24
25 public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendExtension> backendExtension, Validator validator) 25 public BindDatabaseCommand(WixToolset.Extensibility.IBindContext context, IEnumerable<IWindowsInstallerBackendExtension> backendExtension, Validator validator)
26 { 26 {
27 this.TableDefinitions = WindowsInstallerStandardInternal.GetTableDefinitions(); 27 this.TableDefinitions = WindowsInstallerStandardInternal.GetTableDefinitions();
28 28
29 this.BindPaths = context.BindPaths;
30 this.CabbingThreadCount = context.CabbingThreadCount; 29 this.CabbingThreadCount = context.CabbingThreadCount;
31 this.CabCachePath = context.CabCachePath; 30 this.CabCachePath = context.CabCachePath;
32 this.Codepage = context.Codepage; 31 this.Codepage = context.Codepage;
33 this.DefaultCompressionLevel = context.DefaultCompressionLevel; 32 this.DefaultCompressionLevel = context.DefaultCompressionLevel;
34 this.DelayedFields = context.DelayedFields; 33 this.DelayedFields = context.DelayedFields;
35 this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles; 34 this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles;
36 this.Extensions = context.Extensions; 35 this.FileSystemExtensions = context.FileSystemExtensions;
37 this.Intermediate = context.IntermediateRepresentation; 36 this.Intermediate = context.IntermediateRepresentation;
38 this.Messaging = context.Messaging; 37 this.Messaging = context.Messaging;
39 this.OutputPath = context.OutputPath; 38 this.OutputPath = context.OutputPath;
40 this.PdbFile = context.OutputPdbPath; 39 this.PdbFile = context.OutputPdbPath;
41 this.IntermediateFolder = context.IntermediateFolder; 40 this.IntermediateFolder = context.IntermediateFolder;
42 this.Validator = validator; 41 this.Validator = validator;
43 this.WixVariableResolver = context.WixVariableResolver; 42
44
45 this.BackendExtensions = backendExtension; 43 this.BackendExtensions = backendExtension;
46 } 44 }
47 45
48 private IEnumerable<BindPath> BindPaths { get; }
49
50 private int Codepage { get; } 46 private int Codepage { get; }
51 47
52 private int CabbingThreadCount { get; } 48 private int CabbingThreadCount { get; }
@@ -59,12 +55,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
59 55
60 public IEnumerable<IExpectedExtractFile> ExpectedEmbeddedFiles { get; } 56 public IEnumerable<IExpectedExtractFile> ExpectedEmbeddedFiles { get; }
61 57
58 public IEnumerable<IFileSystemExtension> FileSystemExtensions { get; }
59
62 public bool DeltaBinaryPatch { get; set; } 60 public bool DeltaBinaryPatch { get; set; }
63 61
64 private IEnumerable<IWindowsInstallerBackendExtension> BackendExtensions { get; } 62 private IEnumerable<IWindowsInstallerBackendExtension> BackendExtensions { get; }
65 63
66 private IEnumerable<IBinderExtension> Extensions { get; }
67
68 private string PdbFile { get; } 64 private string PdbFile { get; }
69 65
70 private Intermediate Intermediate { get; } 66 private Intermediate Intermediate { get; }
@@ -83,7 +79,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
83 79
84 private Validator Validator { get; } 80 private Validator Validator { get; }
85 81
86 private IBindVariableResolver WixVariableResolver { get; }
87 82
88 public IEnumerable<FileTransfer> FileTransfers { get; private set; } 83 public IEnumerable<FileTransfer> FileTransfers { get; private set; }
89 84
@@ -100,8 +95,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
100 // If there are any fields to resolve later, create the cache to populate during bind. 95 // If there are any fields to resolve later, create the cache to populate during bind.
101 var variableCache = this.DelayedFields.Any() ? new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) : null; 96 var variableCache = this.DelayedFields.Any() ? new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) : null;
102 97
103 this.LocalizeUI(section);
104
105 // Process the summary information table before the other tables. 98 // Process the summary information table before the other tables.
106 bool compressed; 99 bool compressed;
107 bool longNames; 100 bool longNames;
@@ -534,85 +527,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
534 intermediate.Save(Path.ChangeExtension(this.OutputPath, "wir")); 527 intermediate.Save(Path.ChangeExtension(this.OutputPath, "wir"));
535 } 528 }
536 529
537 /// <summary>
538 /// Localize dialogs and controls.
539 /// </summary>
540 /// <param name="tables">The tables to localize.</param>
541 private void LocalizeUI(IntermediateSection section)
542 {
543 foreach (var row in section.Tuples.OfType<DialogTuple>())
544 {
545 string dialog = row.Dialog;
546
547 if (this.WixVariableResolver.TryGetLocalizedControl(dialog, null, out LocalizedControl localizedControl))
548 {
549 if (CompilerConstants.IntegerNotSet != localizedControl.X)
550 {
551 row.HCentering = localizedControl.X;
552 }
553
554 if (CompilerConstants.IntegerNotSet != localizedControl.Y)
555 {
556 row.VCentering = localizedControl.Y;
557 }
558
559 if (CompilerConstants.IntegerNotSet != localizedControl.Width)
560 {
561 row.Width = localizedControl.Width;
562 }
563
564 if (CompilerConstants.IntegerNotSet != localizedControl.Height)
565 {
566 row.Height = localizedControl.Height;
567 }
568
569 row.Attributes = row.Attributes | localizedControl.Attributes;
570
571 if (!String.IsNullOrEmpty(localizedControl.Text))
572 {
573 row.Title = localizedControl.Text;
574 }
575 }
576 }
577
578
579 foreach (var row in section.Tuples.OfType<ControlTuple>())
580 {
581 string dialog = row.Dialog_;
582 string control = row.Control;
583
584 if (this.WixVariableResolver.TryGetLocalizedControl(dialog, control, out LocalizedControl localizedControl))
585 {
586 if (CompilerConstants.IntegerNotSet != localizedControl.X)
587 {
588 row.X = localizedControl.X;
589 }
590
591 if (CompilerConstants.IntegerNotSet != localizedControl.Y)
592 {
593 row.Y = localizedControl.Y;
594 }
595
596 if (CompilerConstants.IntegerNotSet != localizedControl.Width)
597 {
598 row.Width = localizedControl.Width;
599 }
600
601 if (CompilerConstants.IntegerNotSet != localizedControl.Height)
602 {
603 row.Height = localizedControl.Height;
604 }
605
606 row.Attributes = row.Attributes | localizedControl.Attributes;
607
608 if (!String.IsNullOrEmpty(localizedControl.Text))
609 {
610 row.Text = localizedControl.Text;
611 }
612 }
613 }
614 }
615
616#if TODO_FINISH_PATCH 530#if TODO_FINISH_PATCH
617 /// <summary> 531 /// <summary>
618 /// Copy file data between transform substorages and the patch output object 532 /// Copy file data between transform substorages and the patch output object
@@ -984,7 +898,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
984 private void GenerateDatabase(Output output, string databaseFile, bool keepAddedColumns, bool useSubdirectory) 898 private void GenerateDatabase(Output output, string databaseFile, bool keepAddedColumns, bool useSubdirectory)
985 { 899 {
986 var command = new GenerateDatabaseCommand(); 900 var command = new GenerateDatabaseCommand();
987 command.Extensions = this.Extensions; 901 command.Extensions = this.FileSystemExtensions;
988 command.Output = output; 902 command.Output = output;
989 command.OutputPath = databaseFile; 903 command.OutputPath = databaseFile;
990 command.KeepAddedColumns = keepAddedColumns; 904 command.KeepAddedColumns = keepAddedColumns;