diff options
author | Rob Mensching <rob@firegiant.com> | 2018-07-19 00:58:00 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:59 -0700 |
commit | 2724cfee4c163f3297ee25edfd2372767cfd4945 (patch) | |
tree | 8cdda34c83bea014a586a491e3b4b187ad8f16da /src/WixToolset.BuildTasks/ReplaceString.cs | |
parent | 4d40bef9cf51b8cff7e1f6a73fdf68b9722eb8a0 (diff) | |
download | wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.gz wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.bz2 wix-2724cfee4c163f3297ee25edfd2372767cfd4945.zip |
Move tool projects to Tools repo
Diffstat (limited to 'src/WixToolset.BuildTasks/ReplaceString.cs')
-rw-r--r-- | src/WixToolset.BuildTasks/ReplaceString.cs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/WixToolset.BuildTasks/ReplaceString.cs b/src/WixToolset.BuildTasks/ReplaceString.cs deleted file mode 100644 index e5041923..00000000 --- a/src/WixToolset.BuildTasks/ReplaceString.cs +++ /dev/null | |||
@@ -1,54 +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.BuildTasks | ||
4 | { | ||
5 | using System; | ||
6 | using Microsoft.Build.Framework; | ||
7 | using Microsoft.Build.Utilities; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Replaces occurances of OldValues with NewValues in String. | ||
11 | /// </summary> | ||
12 | public class ReplaceString : Task | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Text to operate on. | ||
16 | /// </summary> | ||
17 | [Output] | ||
18 | [Required] | ||
19 | public string Text { get; set; } | ||
20 | |||
21 | /// <summary> | ||
22 | /// List of old values to replace. | ||
23 | /// </summary> | ||
24 | [Required] | ||
25 | public string OldValue { get; set; } | ||
26 | |||
27 | /// <summary> | ||
28 | /// List of new values to replace old values with. If not specified, occurances of OldValue will be removed. | ||
29 | /// </summary> | ||
30 | public string NewValue { get; set; } | ||
31 | |||
32 | /// <summary> | ||
33 | /// Does the string replacement. | ||
34 | /// </summary> | ||
35 | /// <returns></returns> | ||
36 | public override bool Execute() | ||
37 | { | ||
38 | if (String.IsNullOrEmpty(this.Text)) | ||
39 | { | ||
40 | return true; | ||
41 | } | ||
42 | |||
43 | if (String.IsNullOrEmpty(this.OldValue)) | ||
44 | { | ||
45 | Log.LogError("OldValue must be specified"); | ||
46 | return false; | ||
47 | } | ||
48 | |||
49 | this.Text = this.Text.Replace(this.OldValue, this.NewValue); | ||
50 | |||
51 | return true; | ||
52 | } | ||
53 | } | ||
54 | } | ||