-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTagDescriptions.cs
More file actions
52 lines (47 loc) · 1.54 KB
/
TagDescriptions.cs
File metadata and controls
52 lines (47 loc) · 1.54 KB
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
48
49
50
51
using System.Text;
using ZeroPass;
namespace ZeroPass
{
public class TagDescriptions
{
public TagDescriptions(string csv_data)
{
}
public static string GetDescription(string tag)
{
return Strings.Get("STRINGS.MISC.TAGS." + tag.ToUpper());
}
public static string GetDescription(Tag tag)
{
return Strings.Get("STRINGS.MISC.TAGS." + tag.Name.ToUpper());
}
public static string ReplaceTags(string text)
{
int num = text.IndexOf('{');
int num2 = text.IndexOf('}');
if (0 <= num && num < num2)
{
StringBuilder stringBuilder = new StringBuilder();
int num3 = 0;
while (0 <= num)
{
string value = text.Substring(num3, num - num3);
stringBuilder.Append(value);
num2 = text.IndexOf('}', num);
if (num >= num2)
{
break;
}
string tag = text.Substring(num + 1, num2 - num - 1);
string description = GetDescription(tag);
stringBuilder.Append(description);
num3 = num2 + 1;
num = text.IndexOf('{', num2);
}
stringBuilder.Append(text.Substring(num3, text.Length - num3));
return stringBuilder.ToString();
}
return text;
}
}
}