private void LoadFromFile_Keyed(FileInfo file) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); Dictionary <string, int> dictionary2 = new Dictionary <string, int>(); try { foreach (DirectXmlLoaderSimple.XmlKeyValuePair item in DirectXmlLoaderSimple.ValuesFromXmlFile(file)) { DirectXmlLoaderSimple.XmlKeyValuePair current = item; if (keyedReplacements.ContainsKey(current.key) || dictionary.ContainsKey(current.key)) { loadErrors.Add("Duplicate keyed translation key: " + current.key + " in language " + folderName); } else { dictionary.Add(current.key, current.value); dictionary2.Add(current.key, current.lineNumber); } } } catch (Exception ex) { loadErrors.Add("Exception loading from translation file " + file + ": " + ex); dictionary.Clear(); dictionary2.Clear(); anyKeyedReplacementsXmlParseError = true; lastKeyedReplacementsXmlParseErrorInFile = file.Name; } foreach (KeyValuePair <string, string> item2 in dictionary) { string text = item2.Value; KeyedReplacement keyedReplacement = new KeyedReplacement(); if (text == "TODO") { keyedReplacement.isPlaceholder = true; text = string.Empty; } keyedReplacement.key = item2.Key; keyedReplacement.value = text; keyedReplacement.fileSource = file.Name; keyedReplacement.fileSourceLine = dictionary2[item2.Key]; keyedReplacement.fileSourceFullPath = file.FullName; keyedReplacements.Add(item2.Key, keyedReplacement); } }
private void LoadFromFile_Keyed(VirtualFile file) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); Dictionary <string, int> dictionary2 = new Dictionary <string, int>(); try { foreach (DirectXmlLoaderSimple.XmlKeyValuePair item in DirectXmlLoaderSimple.ValuesFromXmlFile(file)) { if (dictionary.ContainsKey(item.key)) { loadErrors.Add("Duplicate keyed translation key: " + item.key + " in language " + folderName); continue; } dictionary.Add(item.key, item.value); dictionary2.Add(item.key, item.lineNumber); } } catch (Exception ex) { loadErrors.Add(string.Concat("Exception loading from translation file ", file, ": ", ex)); dictionary.Clear(); dictionary2.Clear(); anyKeyedReplacementsXmlParseError = true; lastKeyedReplacementsXmlParseErrorInFile = file.Name; } foreach (KeyValuePair <string, string> item2 in dictionary) { string text = item2.Value; KeyedReplacement keyedReplacement = new KeyedReplacement(); if (text == "TODO") { keyedReplacement.isPlaceholder = true; text = ""; } keyedReplacement.key = item2.Key; keyedReplacement.value = text; keyedReplacement.fileSource = file.Name; keyedReplacement.fileSourceLine = dictionary2[item2.Key]; keyedReplacement.fileSourceFullPath = file.FullPath; keyedReplacements.SetOrAdd(item2.Key, keyedReplacement); } }