-
Notifications
You must be signed in to change notification settings - Fork 1
/
GoogleTranslationDic.cs
42 lines (37 loc) · 1.09 KB
/
GoogleTranslationDic.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace TotalWarTranslationTool
{
public class GoogleTranslationDic
{
private Dictionary<string, string> dic = new Dictionary<string, string>();
public GoogleTranslationDic(string googleIniFile)
{
dic = new Dictionary<string, string>();
parseGoogleINI(googleIniFile);
}
private void parseGoogleINI(string googleIniFile)
{
StreamReader reader = new StreamReader(googleIniFile);
while (reader.Peek() > -1)
{
string line = reader.ReadLine();
string[] tokens = line.Split('=');
dic.Add(tokens[0].Trim(), tokens[1].Trim());
}
reader.Close();
}
public string GetGoogleTranslationID(string readableName)
{
return dic[readableName];
}
public List<string> GetAllTranslationNames()
{
return dic.Keys.ToList();
}
}
}