-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtils.cs
33 lines (31 loc) · 1 KB
/
Utils.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
using System;
using System.IO;
namespace PlayService
{
public static class Utils
{
public static string GetFullPath(string basePath, string path)
{
if (!basePath.EndsWith(@"\") && !basePath.EndsWith(@"/"))
basePath += Path.DirectorySeparatorChar;
return (new Uri(new Uri(basePath), path)).LocalPath;
}
/// <summary>
/// バッチファイル用のエスケープ
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string BatchEscape(string value)
{
value = value.Replace("%", "%%");
value = value.Replace("^", "^^");
value = value.Replace("<", "^<");
value = value.Replace(">", "^>");
value = value.Replace("|", "^|");
value = value.Replace("(", "^(");
value = value.Replace(")", "^)");
value = value.Replace("&", "^&");
return value;
}
}
}