From d0d48599caf5b5f018b9fdd4ea8f6064d76d2e8b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 18 Oct 2017 15:10:45 -0700 Subject: Incorporate refactoring of WixToolset.Core assemblies --- src/WixToolset.Data/BindPath.cs | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/WixToolset.Data/BindPath.cs (limited to 'src/WixToolset.Data/BindPath.cs') diff --git a/src/WixToolset.Data/BindPath.cs b/src/WixToolset.Data/BindPath.cs new file mode 100644 index 00000000..823a57c9 --- /dev/null +++ b/src/WixToolset.Data/BindPath.cs @@ -0,0 +1,60 @@ +// 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]); + } + } +} -- cgit v1.2.3-55-g6feb