TranslateLibrary.cs
1.3 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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UILanguageTooles
{
public class TranslateLibrary
{
public static Dictionary<string, Dictionary<string, string>> Library = new Dictionary<string, Dictionary<string, string>>();
static TranslateLibrary() {
var fd = Directory.GetDirectories("Library");
foreach (var d in fd)
{
var lng = Path.GetFileNameWithoutExtension(d);
var ff = Directory.GetFiles(d, "*.lngres");
foreach (var f in ff)
{
//var lng = Path.GetFileNameWithoutExtension(f);
if (!Library.ContainsKey(lng))
Library.Add(lng, new Dictionary<string, string>());
var atsf = File.ReadAllLines(f);
foreach (var ln in atsf)
{
var sp = ln.Split('\t');
if (sp.Length < 3)
continue;
if (!Library[lng].ContainsKey(sp[1]))
{
Library[lng].Add(sp[1], sp[2]);
}
}
}
}
}
}
}