diff options
Diffstat (limited to 'src')
3 files changed, 24 insertions, 45 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index bdb089ee..65e4bf13 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -325,6 +325,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 325 | command.Execute(); | 325 | command.Execute(); |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | // Update control text from files on disk. | ||
| 329 | { | ||
| 330 | var command = new UpdateControlTextCommand(this.Messaging, section); | ||
| 331 | command.Execute(); | ||
| 332 | } | ||
| 333 | |||
| 328 | // Update file sequence. | 334 | // Update file sequence. |
| 329 | { | 335 | { |
| 330 | var command = new UpdateMediaSequencesCommand(section, fileFacades); | 336 | var command = new UpdateMediaSequencesCommand(section, fileFacades); |
| @@ -615,21 +621,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 615 | } | 621 | } |
| 616 | } | 622 | } |
| 617 | 623 | ||
| 618 | /// <summary> | ||
| 619 | /// Update Control and BBControl text by reading from files when necessary. | ||
| 620 | /// </summary> | ||
| 621 | /// <param name="output">Internal representation of the msi database to operate upon.</param> | ||
| 622 | private void UpdateControlText(WindowsInstallerData output) | ||
| 623 | { | ||
| 624 | var command = new UpdateControlTextCommand(); | ||
| 625 | command.Messaging = this.Messaging; | ||
| 626 | command.BBControlTable = output.Tables["BBControl"]; | ||
| 627 | command.WixBBControlTable = output.Tables["WixBBControl"]; | ||
| 628 | command.ControlTable = output.Tables["Control"]; | ||
| 629 | command.WixControlTable = output.Tables["WixControl"]; | ||
| 630 | command.Execute(); | ||
| 631 | } | ||
| 632 | |||
| 633 | private string ResolveMedia(MediaTuple media, string mediaLayoutDirectory, string layoutDirectory) | 624 | private string ResolveMedia(MediaTuple media, string mediaLayoutDirectory, string layoutDirectory) |
| 634 | { | 625 | { |
| 635 | string layout = null; | 626 | string layout = null; |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateControlTextCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateControlTextCommand.cs index 3ad2470f..104a3a37 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateControlTextCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateControlTextCommand.cs | |||
| @@ -4,43 +4,33 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.IO; | 6 | using System.IO; |
| 7 | using System.Linq; | ||
| 7 | using WixToolset.Data; | 8 | using WixToolset.Data; |
| 8 | using WixToolset.Data.WindowsInstaller; | 9 | using WixToolset.Data.Tuples; |
| 9 | using WixToolset.Data.WindowsInstaller.Rows; | ||
| 10 | using WixToolset.Extensibility.Services; | 10 | using WixToolset.Extensibility.Services; |
| 11 | 11 | ||
| 12 | internal class UpdateControlTextCommand | 12 | internal class UpdateControlTextCommand |
| 13 | { | 13 | { |
| 14 | public IMessaging Messaging { private get; set; } | 14 | public UpdateControlTextCommand(IMessaging messaging, IntermediateSection section) |
| 15 | 15 | { | |
| 16 | public Table BBControlTable { private get; set; } | 16 | this.Messaging = messaging; |
| 17 | 17 | this.Section = section; | |
| 18 | public Table WixBBControlTable { private get; set; } | 18 | } |
| 19 | 19 | ||
| 20 | public Table ControlTable { private get; set; } | 20 | private IMessaging Messaging { get; } |
| 21 | 21 | ||
| 22 | public Table WixControlTable { private get; set; } | 22 | private IntermediateSection Section { get; } |
| 23 | 23 | ||
| 24 | public void Execute() | 24 | public void Execute() |
| 25 | { | 25 | { |
| 26 | if (null != this.WixBBControlTable) | 26 | foreach (var bbControl in this.Section.Tuples.OfType<BBControlTuple>().Where(t => t.SourceFile != null)) |
| 27 | { | 27 | { |
| 28 | RowDictionary<BBControlRow> bbControlRows = new RowDictionary<BBControlRow>(this.BBControlTable); | 28 | bbControl.Text = this.ReadTextFile(bbControl.SourceLineNumbers, bbControl.SourceFile.Path); |
| 29 | foreach (Row wixRow in this.WixBBControlTable.Rows) | ||
| 30 | { | ||
| 31 | BBControlRow bbControlRow = bbControlRows.Get(wixRow.GetPrimaryKey()); | ||
| 32 | bbControlRow.Text = this.ReadTextFile(bbControlRow.SourceLineNumbers, wixRow.FieldAsString(2)); | ||
| 33 | } | ||
| 34 | } | 29 | } |
| 35 | 30 | ||
| 36 | if (null != this.WixControlTable) | 31 | foreach (var control in this.Section.Tuples.OfType<ControlTuple>().Where(t => t.SourceFile != null)) |
| 37 | { | 32 | { |
| 38 | RowDictionary<ControlRow> controlRows = new RowDictionary<ControlRow>(this.ControlTable); | 33 | control.Text = this.ReadTextFile(control.SourceLineNumbers, control.SourceFile.Path); |
| 39 | foreach (Row wixRow in this.WixControlTable.Rows) | ||
| 40 | { | ||
| 41 | ControlRow controlRow = controlRows.Get(wixRow.GetPrimaryKey()); | ||
| 42 | controlRow.Text = this.ReadTextFile(controlRow.SourceLineNumbers, wixRow.FieldAsString(2)); | ||
| 43 | } | ||
| 44 | } | 34 | } |
| 45 | } | 35 | } |
| 46 | 36 | ||
| @@ -52,13 +42,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 52 | /// <returns>Text string read from file.</returns> | 42 | /// <returns>Text string read from file.</returns> |
| 53 | private string ReadTextFile(SourceLineNumber sourceLineNumbers, string source) | 43 | private string ReadTextFile(SourceLineNumber sourceLineNumbers, string source) |
| 54 | { | 44 | { |
| 55 | string text = null; | ||
| 56 | |||
| 57 | try | 45 | try |
| 58 | { | 46 | { |
| 59 | using (StreamReader reader = new StreamReader(source)) | 47 | using (var reader = new StreamReader(source)) |
| 60 | { | 48 | { |
| 61 | text = reader.ReadToEnd(); | 49 | return reader.ReadToEnd(); |
| 62 | } | 50 | } |
| 63 | } | 51 | } |
| 64 | catch (DirectoryNotFoundException e) | 52 | catch (DirectoryNotFoundException e) |
| @@ -78,7 +66,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 78 | this.Messaging.Write(ErrorMessages.FileNotFound(sourceLineNumbers, source)); | 66 | this.Messaging.Write(ErrorMessages.FileNotFound(sourceLineNumbers, source)); |
| 79 | } | 67 | } |
| 80 | 68 | ||
| 81 | return text; | 69 | return null; |
| 82 | } | 70 | } |
| 83 | } | 71 | } |
| 84 | } | 72 | } |
diff --git a/src/WixToolset.Core/Compiler_UI.cs b/src/WixToolset.Core/Compiler_UI.cs index 3d554f12..19c2fdcc 100644 --- a/src/WixToolset.Core/Compiler_UI.cs +++ b/src/WixToolset.Core/Compiler_UI.cs | |||
| @@ -1495,7 +1495,7 @@ namespace WixToolset.Core | |||
| 1495 | Sunken = sunken, | 1495 | Sunken = sunken, |
| 1496 | Visible = !hidden, | 1496 | Visible = !hidden, |
| 1497 | Text = text, | 1497 | Text = text, |
| 1498 | SourceFile = sourceFile, | 1498 | SourceFile = String.IsNullOrEmpty(sourceFile) ? null : new IntermediateFieldPathValue { Path = sourceFile } |
| 1499 | }); | 1499 | }); |
| 1500 | 1500 | ||
| 1501 | bbTuple.Set((int)BBControlTupleFields.X, x); | 1501 | bbTuple.Set((int)BBControlTupleFields.X, x); |
| @@ -1524,7 +1524,7 @@ namespace WixToolset.Core | |||
| 1524 | Property = !String.IsNullOrEmpty(property) ? property : checkBoxPropertyRef, | 1524 | Property = !String.IsNullOrEmpty(property) ? property : checkBoxPropertyRef, |
| 1525 | Text = text, | 1525 | Text = text, |
| 1526 | Help = (null == tooltip && null == help) ? null : String.Concat(tooltip, "|", help), // Separator is required, even if only one is non-null.}; | 1526 | Help = (null == tooltip && null == help) ? null : String.Concat(tooltip, "|", help), // Separator is required, even if only one is non-null.}; |
| 1527 | SourceFile = sourceFile | 1527 | SourceFile = String.IsNullOrEmpty(sourceFile) ? null : new IntermediateFieldPathValue { Path = sourceFile } |
| 1528 | }); | 1528 | }); |
| 1529 | 1529 | ||
| 1530 | controlTuple.Set((int)BBControlTupleFields.X, x); | 1530 | controlTuple.Set((int)BBControlTupleFields.X, x); |
