From dbde9e7104b907bbbaea17e21247d8cafc8b3a4c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 14 Oct 2017 16:12:07 -0700 Subject: Massive refactoring to introduce the concept of IBackend --- .../Bind/Databases/UpdateControlTextCommand.cs | 80 ---------------------- 1 file changed, 80 deletions(-) delete mode 100644 src/WixToolset.Core/Bind/Databases/UpdateControlTextCommand.cs (limited to 'src/WixToolset.Core/Bind/Databases/UpdateControlTextCommand.cs') diff --git a/src/WixToolset.Core/Bind/Databases/UpdateControlTextCommand.cs b/src/WixToolset.Core/Bind/Databases/UpdateControlTextCommand.cs deleted file mode 100644 index 9e17ee02..00000000 --- a/src/WixToolset.Core/Bind/Databases/UpdateControlTextCommand.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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. - -namespace WixToolset.Bind.Databases -{ - using System; - using System.IO; - using WixToolset.Data; - using WixToolset.Data.Rows; - - internal class UpdateControlTextCommand : ICommand - { - public Table BBControlTable { private get; set; } - - public Table WixBBControlTable { private get; set; } - - public Table ControlTable { private get; set; } - - public Table WixControlTable { private get; set; } - - public void Execute() - { - if (null != this.WixBBControlTable) - { - RowDictionary bbControlRows = new RowDictionary(this.BBControlTable); - foreach (Row wixRow in this.WixBBControlTable.Rows) - { - BBControlRow bbControlRow = bbControlRows.Get(wixRow.GetPrimaryKey()); - bbControlRow.Text = this.ReadTextFile(bbControlRow.SourceLineNumbers, wixRow.FieldAsString(2)); - } - } - - if (null != this.WixControlTable) - { - RowDictionary controlRows = new RowDictionary(this.ControlTable); - foreach (Row wixRow in this.WixControlTable.Rows) - { - ControlRow controlRow = controlRows.Get(wixRow.GetPrimaryKey()); - controlRow.Text = this.ReadTextFile(controlRow.SourceLineNumbers, wixRow.FieldAsString(2)); - } - } - } - - /// - /// Reads a text file and returns the contents. - /// - /// Source line numbers for row from source. - /// Source path to file to read. - /// Text string read from file. - private string ReadTextFile(SourceLineNumber sourceLineNumbers, string source) - { - string text = null; - - try - { - using (StreamReader reader = new StreamReader(source)) - { - text = reader.ReadToEnd(); - } - } - catch (DirectoryNotFoundException e) - { - Messaging.Instance.OnMessage(WixErrors.BinderFileManagerMissingFile(sourceLineNumbers, e.Message)); - } - catch (FileNotFoundException e) - { - Messaging.Instance.OnMessage(WixErrors.BinderFileManagerMissingFile(sourceLineNumbers, e.Message)); - } - catch (IOException e) - { - Messaging.Instance.OnMessage(WixErrors.BinderFileManagerMissingFile(sourceLineNumbers, e.Message)); - } - catch (NotSupportedException) - { - Messaging.Instance.OnMessage(WixErrors.FileNotFound(sourceLineNumbers, source)); - } - - return text; - } - } -} -- cgit v1.2.3-55-g6feb