aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/ReplaceString.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.BuildTasks/ReplaceString.cs')
-rw-r--r--src/WixToolset.BuildTasks/ReplaceString.cs54
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
3namespace 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}