/// <summary> /// Updates Dict with the actual values inside XML file /// </summary> /// <param name="Dict"></param> /// <param name="LanguagePackFileName"></param> static void UpdateLanguageDictionary(Dictionary <string, string> Dict, string LanguagePackFileName) { if (!File.Exists(LanguagePackFileName)) { return; } //Load default first foreach (XElement KazanNeftSoftware in XElement.Load(LanguagePackFileName).Elements("Native-Langue")) { foreach (XElement Menu in KazanNeftSoftware.Elements("Menu")) { foreach (XElement Main in Menu.Elements("Main")) { foreach (XElement Entries in Main.Elements("Entries")) { foreach (XElement Item in Entries.Elements("Item")) { if (Item.Attribute("menuId") != null) { Dict.AddOrUpdate($"Menu.Main.Entries.Item.menuId.{Item.Attribute("menuId").Value}", Item.Attribute("name").Value); } else if (Item.Attribute("idName") != null) { Dict.AddOrUpdate($"Menu.Main.Entries.Item.idName.{Item.Attribute("idName").Value}", Item.Attribute("name").Value); } } } } foreach (XElement TabBar in Menu.Elements("TabBar")) { foreach (XElement Item in TabBar.Elements("Item")) { Dict.AddOrUpdate($"Menu.TabBar.Item.{Item.Attribute("CMID").Value}", Item.Attribute("name").Value); } } } foreach (XElement InventoryDashboard in KazanNeftSoftware.Elements("InventoryDashboard")) { foreach (XElement child in InventoryDashboard.Elements()) { if (child.Attribute("value") != null) { Dict.AddOrUpdate($"InventoryDashboard.{child.Name}.{child.Attribute("name").Value}", child.Attribute("value").Value); } else { Dict.AddOrUpdate($"InventoryDashboard.{child.Name}", child.Attribute("name").Value); } } } foreach (XElement InventoryDashboard in KazanNeftSoftware.Elements("InventoryControl")) { foreach (XElement child in InventoryDashboard.Elements()) { if (child.Attribute("value") != null) { Dict.AddOrUpdate($"InventoryControl.{child.Name}.{child.Attribute("name").Value}", child.Attribute("value").Value); } else { Dict.AddOrUpdate($"InventoryControl.{child.Name}", child.Attribute("name").Value); } } } foreach (XElement MiscStrings in KazanNeftSoftware.Elements("MiscStrings")) { foreach (XElement child in MiscStrings.Elements()) { Dict.AddOrUpdate($"MiscStrings.{child.Name}", child.Attribute("value").Value); } } } }