diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2018-09-02 16:12:29 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2018-09-13 12:05:57 -0500 |
| commit | 244b46cf7f3252d6dc3884ce184be901d1d173e5 (patch) | |
| tree | bd6fb4349b926001138d1a3415f93370d64e538f /src/WixToolset.BuildTasks/Common.cs | |
| parent | 026d0af96fac5cd2d3d84ade657949ddc7144b99 (diff) | |
| download | wix-244b46cf7f3252d6dc3884ce184be901d1d173e5.tar.gz wix-244b46cf7f3252d6dc3884ce184be901d1d173e5.tar.bz2 wix-244b46cf7f3252d6dc3884ce184be901d1d173e5.zip | |
Migrate WixCop into Tools from wix4.
Diffstat (limited to 'src/WixToolset.BuildTasks/Common.cs')
| -rw-r--r-- | src/WixToolset.BuildTasks/Common.cs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/WixToolset.BuildTasks/Common.cs b/src/WixToolset.BuildTasks/Common.cs deleted file mode 100644 index 803e9d14..00000000 --- a/src/WixToolset.BuildTasks/Common.cs +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Globalization; | ||
| 7 | using System.Text; | ||
| 8 | using System.Text.RegularExpressions; | ||
| 9 | |||
| 10 | /// <summary> | ||
| 11 | /// Common WixTasks utility methods and types. | ||
| 12 | /// </summary> | ||
| 13 | internal static class Common | ||
| 14 | { | ||
| 15 | /// <summary>Metadata key name to turn off harvesting of project references.</summary> | ||
| 16 | public const string DoNotHarvest = "DoNotHarvest"; | ||
| 17 | |||
| 18 | private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]", RegexOptions.Compiled); | ||
| 19 | private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}", RegexOptions.Compiled); // non 'words' and assorted valid characters | ||
| 20 | |||
| 21 | /// <summary> | ||
| 22 | /// Return an identifier based on passed file/directory name | ||
| 23 | /// </summary> | ||
| 24 | /// <param name="name">File/directory name to generate identifer from</param> | ||
| 25 | /// <returns>A version of the name that is a legal identifier.</returns> | ||
| 26 | /// <remarks>This is duplicated from WiX's Common class.</remarks> | ||
| 27 | internal static string GetIdentifierFromName(string name) | ||
| 28 | { | ||
| 29 | string result = IllegalIdentifierCharacters.Replace(name, "_"); // replace illegal characters with "_". | ||
| 30 | |||
| 31 | // MSI identifiers must begin with an alphabetic character or an | ||
| 32 | // underscore. Prefix all other values with an underscore. | ||
| 33 | if (AddPrefix.IsMatch(name)) | ||
| 34 | { | ||
| 35 | result = String.Concat("_", result); | ||
| 36 | } | ||
| 37 | |||
| 38 | return result; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
