From 7f846324105e14c84f1ad1bad2fe2c10c22f6e4b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 23 Jul 2018 13:44:01 -0700 Subject: Move data only used by extension to Extensiblity repo --- src/WixToolset.Data/Bind/BindPath.cs | 60 ----------- src/WixToolset.Data/Bind/BindResult.cs | 13 --- src/WixToolset.Data/Bind/BindStage.cs | 22 ---- src/WixToolset.Data/Bind/FileTransfer.cs | 112 --------------------- .../WixToolsetTest.Data/WixToolsetTest.Data.csproj | 8 +- 5 files changed, 4 insertions(+), 211 deletions(-) delete mode 100644 src/WixToolset.Data/Bind/BindPath.cs delete mode 100644 src/WixToolset.Data/Bind/BindResult.cs delete mode 100644 src/WixToolset.Data/Bind/BindStage.cs delete mode 100644 src/WixToolset.Data/Bind/FileTransfer.cs diff --git a/src/WixToolset.Data/Bind/BindPath.cs b/src/WixToolset.Data/Bind/BindPath.cs deleted file mode 100644 index 823a57c9..00000000 --- a/src/WixToolset.Data/Bind/BindPath.cs +++ /dev/null @@ -1,60 +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.Data -{ - using System; - using WixToolset.Data.Bind; - - /// - /// Bind path representation. - /// - public class BindPath - { - /// - /// Creates an unnamed bind path. - /// - /// Path for the bind path. - public BindPath(string path) : this(String.Empty, path, BindStage.Normal) - { - } - - /// - /// Creates a named bind path. - /// - /// Name of the bind path. - /// Path for the bind path. - /// Stage for the bind path. - public BindPath(string name, string path, BindStage stage = BindStage.Normal) - { - this.Name = name; - this.Path = path; - this.Stage = stage; - } - - /// - /// Name of the bind path or String.Empty if the path is unnamed. - /// - public string Name { get; set; } - - /// - /// Path for the bind path. - /// - public string Path { get; set; } - - /// - /// Stage for the bind path. - /// - public BindStage Stage { get; set; } - - /// - /// Parses a normal bind path from its string representation - /// - /// String representation of bind path that looks like: [name=]path - /// Parsed normal bind path. - public static BindPath Parse(string bindPath) - { - string[] namedPath = bindPath.Split(new char[] { '=' }, 2); - return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); - } - } -} diff --git a/src/WixToolset.Data/Bind/BindResult.cs b/src/WixToolset.Data/Bind/BindResult.cs deleted file mode 100644 index 1b81ab78..00000000 --- a/src/WixToolset.Data/Bind/BindResult.cs +++ /dev/null @@ -1,13 +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.Data.Bind -{ - using System.Collections.Generic; - - public class BindResult - { - public IEnumerable FileTransfers { get; set; } - - public IEnumerable ContentFilePaths { get; set; } - } -} diff --git a/src/WixToolset.Data/Bind/BindStage.cs b/src/WixToolset.Data/Bind/BindStage.cs deleted file mode 100644 index c567cde0..00000000 --- a/src/WixToolset.Data/Bind/BindStage.cs +++ /dev/null @@ -1,22 +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.Data.Bind -{ - public enum BindStage - { - /// - /// Normal binding - /// - Normal, - - /// - /// Bind the file path of the target build file - /// - Target, - - /// - /// Bind the file path of the updated build file - /// - Updated, - } -} diff --git a/src/WixToolset.Data/Bind/FileTransfer.cs b/src/WixToolset.Data/Bind/FileTransfer.cs deleted file mode 100644 index 046883d8..00000000 --- a/src/WixToolset.Data/Bind/FileTransfer.cs +++ /dev/null @@ -1,112 +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.Data.Bind -{ - using System; - using System.IO; - - /// - /// Structure used for all file transfer information. - /// - public class FileTransfer - { - /// Source path to file. - public string Source { get; set; } - - /// Destination path for file. - public string Destination { get; set; } - - /// Flag if file should be moved (optimal). - public bool Move { get; set; } - - /// Optional source line numbers where this file transfer orginated. - public SourceLineNumber SourceLineNumbers { get; set; } - - /// Optional type of file this transfer is moving or copying. - public string Type { get; set; } - - /// Indicates whether the file transer was a built by this build or copied from other some build. - public bool Built { get; set; } - - /// Set during layout of media when the file transfer when the source and target resolve to the same path. - public bool Redundant { get; set; } - - /// - /// Prefer the TryCreate() method to create FileTransfer objects. - /// - /// Source path to file. - /// Destination path for file. - /// File if file should be moved (optimal). - /// Optional type of file this transfer is transferring. - /// Optional source line numbers wher this transfer originated. - public FileTransfer(string source, string destination, bool move, string type = null, SourceLineNumber sourceLineNumbers = null) - { - this.Source = source; - this.Destination = destination; - this.Move = move; - - this.Type = type; - this.SourceLineNumbers = sourceLineNumbers; - } - - /// - /// Creates a file transfer if the source and destination are different. - /// - /// Source path to file. - /// Destination path for file. - /// File if file should be moved (optimal). - /// Optional type of file this transfer is transferring. - /// Optional source line numbers where this transfer originated. - /// true if the source and destination are the different, false if no file transfer is created. - public static bool TryCreate(string source, string destination, bool move, string type, SourceLineNumber sourceLineNumbers, out FileTransfer transfer) - { - string sourceFullPath = GetValidatedFullPath(sourceLineNumbers, source); - - string fileLayoutFullPath = GetValidatedFullPath(sourceLineNumbers, destination); - - //// if the current source path (where we know that the file already exists) and the resolved - //// path as dictated by the Directory table are not the same, then propagate the file. The - //// image that we create may have already been done by some other process other than the linker, so - //// there is no reason to copy the files to the resolved source if they are already there. - //if (String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase)) - //{ - // transfer = null; - // return false; - //} - - transfer = new FileTransfer(source, destination, move, type, sourceLineNumbers); - transfer.Redundant = String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase); - return true; - } - - private static string GetValidatedFullPath(SourceLineNumber sourceLineNumbers, string path) - { - string result; - - try - { - result = Path.GetFullPath(path); - - var filename = Path.GetFileName(result); - - foreach (var reservedName in Common.ReservedFileNames) - { - if (reservedName.Equals(filename, StringComparison.OrdinalIgnoreCase)) - { - throw new WixException(ErrorMessages.InvalidFileName(sourceLineNumbers, path)); - } - } - } - catch (ArgumentException) - { - throw new WixException(ErrorMessages.InvalidFileName(sourceLineNumbers, path)); - } - catch (PathTooLongException) - { - throw new WixException(ErrorMessages.PathTooLong(sourceLineNumbers, path)); - } - - return result; - } - } -} diff --git a/src/test/WixToolsetTest.Data/WixToolsetTest.Data.csproj b/src/test/WixToolsetTest.Data/WixToolsetTest.Data.csproj index a4ba7cb1..e81b4f6f 100644 --- a/src/test/WixToolsetTest.Data/WixToolsetTest.Data.csproj +++ b/src/test/WixToolsetTest.Data/WixToolsetTest.Data.csproj @@ -7,13 +7,13 @@ - - - + - + + + -- cgit v1.2.3-55-g6feb