public void LoadUnicTag(CacheBase Cache, CacheBase.IndexItem Tag, Language Language) { cache = Cache; tag = Tag; label1.Enabled = cmbLang.Enabled = true; cmbLang.SelectedIndex = -1; var reader = Cache.Reader; unic = DefinitionsManager.unic(Cache, tag); cmbLang.SelectedIndex = (int)Language; }
public static List <string> GetUnicStrings(CacheBase Cache, CacheBase.IndexItem Tag, Language Language) { List <string> strings = new List <string>(); var reader = Cache.Reader; var unic = DefinitionsManager.unic(Cache, Tag); int index = unic.Indices[(int)Language]; int length = unic.Lengths[(int)Language]; for (int i = index; i < (index + length); i++) { strings.Add(Cache.LocaleTables[(int)Language][i]); } return(strings); }
public static void SaveUnicStrings(string Filename, CacheBase Cache, CacheBase.IndexItem Tag, Language Language) { List <string> sList = new List <string>(); var reader = Cache.Reader; var unic = DefinitionsManager.unic(Cache, Tag); int index = unic.Indices[(int)Language]; int length = unic.Lengths[(int)Language]; for (int i = index; i < (index + length); i++) { sList.Add(Cache.LocaleTables[(int)Language][i]); } if (!Directory.GetParent(Filename).Exists) { Directory.GetParent(Filename).Create(); } if (!Filename.EndsWith(".txt")) { Filename += ".txt"; } var fs = new FileStream(Filename, FileMode.Create); int start = unic.Indices[(int)Language]; for (int i = 0; i < sList.Count; i++) { string line = (i + start).ToString("D6") + "\t" + sList[i].Replace("\r\n", " ") + "\r\n"; byte[] buffer = Encoding.UTF8.GetBytes(line); fs.Write(buffer, 0, buffer.Length); } fs.Close(); fs.Dispose(); }