public void LoadTranslateStrings(string path = null) { if (path == null) { path = StringsPath; } List <TranslateString> result = JsonConvert.DeserializeObject <List <TranslateString> >(File.ReadAllText(path)); TranslateStrings.Clear(); TranslateStringDict.Clear(); foreach (var ts in result) { TranslateStrings.Add(ts); TranslateStringDict[ts.Original] = ts; } }
protected void InsertNewTranslateStrings(string original) { if (original.Trim() == "") { return; } if (TranslateStringDict.ContainsKey(original)) { return; } var ts = new TranslateString() { Original = original, Hand = "", Machine = "" }; TranslateStrings.Add(ts); TranslateStringDict[original] = ts; }