private void Synchronize(object param) { if (LanguageDatas.Count < 2) { return; // ! Return } var pattern = LanguageDatas.First(); for (int i = 1; i < LanguageDatas.Count; i++) { foreach (var item in pattern.Strings) { var res = from x in LanguageDatas[i].Strings where x.Key == item.Key select x; if (res.Count() == 0) { LanguageDatas[i].Strings.Add(new StringUnit(item.Key, $"!{item.Value}")); } } foreach (var item in LanguageDatas[i].Strings) { var res = from x in pattern.Strings where x.Key == item.Key select x; if (res.Count() == 0) { pattern.Strings.Add(new StringUnit(item.Key, $"!{item.Value}")); } } } }
private void LoadFromFile(object param) { if (!(param is string path)) { throw new Exception(); } BinaryFormatter formatter = new BinaryFormatter(); using (FileStream stream = new FileStream(path, FileMode.Open)) { LanguageDatas = (ObservableCollection <LanguageData>)formatter.Deserialize(stream); SelectedLanguage = LanguageDatas.First(); } ProjectPath = path; }