-
Notifications
You must be signed in to change notification settings - Fork 651
/
Copy pathDeleteHelper.cs
47 lines (41 loc) · 1.26 KB
/
DeleteHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace GitVersion
{
using System.IO;
public static class ServiceMessageEscapeHelper
{
public static string EscapeValue(string value)
{
if (value == null)
{
return null;
}
// List of escape values from http://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity
value = value.Replace("|", "||");
value = value.Replace("'", "|'");
value = value.Replace("[", "|[");
value = value.Replace("]", "|]");
value = value.Replace("\r", "|r");
value = value.Replace("\n", "|n");
return value;
}
}
public static class DeleteHelper
{
public static void DeleteGitRepository(string directory)
{
if (string.IsNullOrEmpty(directory))
{
return;
}
foreach (var fileName in Directory.GetFiles(directory, "*.*", SearchOption.AllDirectories))
{
var fileInfo = new FileInfo(fileName)
{
IsReadOnly = false
};
fileInfo.Delete();
}
Directory.Delete(directory, true);
}
}
}