示例#1
0
        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;
            }
        }
示例#2
0
        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;
        }