/// <summary> /// Updates any translation files that differ from that found online. /// </summary> /// <param name="BaseTranslationURL">String URL folder that contains all the translation XML files.</param> /// <param name="Culture">Language version to download</param> /// <param name="TranslationsRef">Link to the translation engine to obtain current translation versions.</param> /// <returns>Returns a state code depending on how it ran. [-1: Error, 0: Nothing to update, 1: Update Successful]</returns> public int UpdateTranslations(string BaseTranslationURL, string Culture, Translations TranslationsRef) { using (WebClient Client = new WebClient()) { string CurrentCulture = (Culture == null || Culture == "en-US" || Culture == "ja-JP" || Culture == "en") ? "" : Culture; string CurrentCultureDir = (CurrentCulture != "" ? CurrentCulture + "\\" : ""); XDocument TestXML; int ReturnValue = 0; try { if (!Directory.Exists("Translations")) Directory.CreateDirectory("Translations"); if (!Directory.Exists("Translations\\" + CurrentCultureDir)) Directory.CreateDirectory("Translations\\" + CurrentCultureDir); if (!Directory.Exists("Translations\\tmp\\")) Directory.CreateDirectory("Translations\\tmp\\"); // In every one of these we download it to a temp folder, check if the file works, then move it over. if (IsOnlineVersionGreater(TranslationType.Equipment, TranslationsRef.EquipmentVersion)) { Client.DownloadFile(BaseTranslationURL + CurrentCulture + "/" + "Equipment.xml", "Translations\\tmp\\Equipment.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Equipment.xml"); if (File.Exists("Translations\\" + CurrentCultureDir + "Equipment.xml")) File.Delete("Translations\\" + CurrentCultureDir + "Equipment.xml"); File.Move("Translations\\tmp\\Equipment.xml", "Translations\\" + CurrentCultureDir + "Equipment.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (IsOnlineVersionGreater(TranslationType.Operations, TranslationsRef.OperationsVersion)) { Client.DownloadFile(BaseTranslationURL + CurrentCulture + "/" + "Operations.xml", "Translations\\tmp\\Operations.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Operations.xml"); if (File.Exists("Translations\\" + CurrentCultureDir + "Operations.xml")) File.Delete("Translations\\" + CurrentCultureDir + "Operations.xml"); File.Move("Translations\\tmp\\Operations.xml", "Translations\\" + CurrentCultureDir + "Operations.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (IsOnlineVersionGreater(TranslationType.Quests, TranslationsRef.QuestsVersion)) { Client.DownloadFile(BaseTranslationURL + CurrentCulture + "/" + "Quests.xml", "Translations\\tmp\\Quests.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Quests.xml"); if (File.Exists("Translations\\" + CurrentCultureDir + "Quests.xml")) File.Delete("Translations\\" + CurrentCultureDir + "Quests.xml"); File.Move("Translations\\tmp\\Quests.xml", "Translations\\" + CurrentCultureDir + "Quests.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (IsOnlineVersionGreater(TranslationType.Ships, TranslationsRef.ShipsVersion)) { Client.DownloadFile(BaseTranslationURL + CurrentCulture + "/" + "Ships.xml", "Translations\\tmp\\Ships.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Ships.xml"); if (File.Exists("Translations\\" + CurrentCultureDir + "Ships.xml")) File.Delete("Translations\\" + CurrentCultureDir + "Ships.xml"); File.Move("Translations\\tmp\\Ships.xml", "Translations\\" + CurrentCultureDir + "Ships.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (IsOnlineVersionGreater(TranslationType.ShipTypes, TranslationsRef.ShipTypesVersion)) { Client.DownloadFile(BaseTranslationURL + CurrentCulture + "/" + "ShipTypes.xml", "Translations\\tmp\\ShipTypes.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\ShipTypes.xml"); if (File.Exists("Translations\\" + CurrentCultureDir + "ShipTypes.xml")) File.Delete("Translations\\" + CurrentCultureDir + "ShipTypes.xml"); File.Move("Translations\\tmp\\ShipTypes.xml", "Translations\\" + CurrentCultureDir + "ShipTypes.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } } catch (Exception ex) { // Failed to download files. Debug.WriteLine(ex); return -1; } if (Directory.Exists("Translations\\tmp\\")) Directory.Delete("Translations\\tmp\\"); return ReturnValue; } }
/// <summary> /// Updates any translation files that differ from that found online. /// </summary> /// <param name="translationsRef">Link to the translation engine to obtain current translation versions.</param> /// <param name="culture">Language version to download</param> /// <param name="checkVersion"></param> /// <returns>Returns a state code depending on how it ran. [-1: Error, 0: Nothing to update, 1: Update Successful]</returns> public int UpdateTranslations(Translations translationsRef, string culture, bool checkVersion = true) { culture = culture == null || culture == "en-US" || culture == "en" || culture == "ja-JP" || culture == "ja" ? "" : culture; using (var client = new WebClient()) { var updated = false; var error = false; try { var directoryCulture = Path.Combine(directory, culture); if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); if (!Directory.Exists(directoryCulture)) Directory.CreateDirectory(directoryCulture); if (!Directory.Exists(tmpDirectory)) Directory.CreateDirectory(tmpDirectory); var r = this.UpdateFile(checkVersion, client, culture, "Equipment.xml", TranslationType.Equipment, translationsRef.EquipmentVersion); if (r == 1) updated = true; if (r == -1) error = true; r = this.UpdateFile(checkVersion, client, culture, "Operations.xml", TranslationType.Operations, translationsRef.OperationsVersion); if (r == 1) updated = true; if (r == -1) error = true; r = this.UpdateFile(checkVersion, client, culture, "Quests.xml", TranslationType.Quests, translationsRef.QuestsVersion); if (r == 1) updated = true; if (r == -1) error = true; r = this.UpdateFile(checkVersion, client, culture, "Ships.xml", TranslationType.Ships, translationsRef.ShipsVersion); if (r == 1) updated = true; if (r == -1) error = true; r = this.UpdateFile(checkVersion, client, culture, "ShipTypes.xml", TranslationType.ShipTypes, translationsRef.ShipTypesVersion); if (r == 1) updated = true; if (r == -1) error = true; r = this.UpdateFile(checkVersion, client, culture, "Expeditions.xml", TranslationType.Expeditions, translationsRef.ExpeditionsVersion); if (r == 1) updated = true; if (r == -1) error = true; r = this.UpdateFile(checkVersion, client, "", "Data.xml", TranslationType.Data, translationsRef.DataVersion); if (r == 1) updated = true; if (r == -1) error = true; } catch (Exception ex) { Debug.WriteLine(ex); error = true; } if (Directory.Exists(tmpDirectory)) Directory.Delete(tmpDirectory); return updated ? 1 : error ? -1 : 0; } }
/// <summary> /// Updates any translation files that differ from that found online. /// </summary> /// <param name="BaseTranslationURL">String URL folder that contains all the translation XML files.</param> /// <param name="TranslationsRef">Link to the translation engine to obtain current translation versions.</param> /// <returns>Returns a state code depending on how it ran. [-1: Error, 0: Nothing to update, 1: Update Successful]</returns> public int UpdateTranslations(string BaseTranslationURL, Translations TranslationsRef) { using (WebClient Client = new WebClient()) { int ReturnValue = 0; string MainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); try { if (!Directory.Exists(Path.Combine(MainFolder, "Translations"))) { Directory.CreateDirectory(Path.Combine(MainFolder, "Translations")); } if (!Directory.Exists(Path.Combine(MainFolder, "Translations", "tmp"))) { Directory.CreateDirectory(Path.Combine(MainFolder, "Translations", "tmp")); } if (!Directory.Exists(Path.Combine(MainFolder, "Translations", "Old"))) { Directory.CreateDirectory(Path.Combine(MainFolder, "Translations", "Old")); } // In every one of these we download it to a temp folder, check if the file works, then move it over. if (IsOnlineVersionGreater(TranslationType.Equipment, TranslationsRef.EquipmentVersion)) { Client.DownloadFile(BaseTranslationURL + "Equipment.xml", Path.Combine(MainFolder, "Translations", "tmp", "Equipment.xml")); ReturnValue = XmlFileWizard(MainFolder, "Equipment.xml", TranslationType.Equipment); } if (IsOnlineVersionGreater(TranslationType.Operations, TranslationsRef.OperationsVersion)) { Client.DownloadFile(BaseTranslationURL + "Operations.xml", Path.Combine(MainFolder, "Translations", "tmp", "Operations.xml")); ReturnValue = XmlFileWizard(MainFolder, "Operations.xml", TranslationType.Operations); } if (IsOnlineVersionGreater(TranslationType.Quests, TranslationsRef.QuestsVersion)) { Client.DownloadFile(BaseTranslationURL + "Quests.xml", Path.Combine(MainFolder, "Translations", "tmp", "Quests.xml")); ReturnValue = XmlFileWizard(MainFolder, "Quests.xml", TranslationType.Quests); } if (IsOnlineVersionGreater(TranslationType.Expeditions, TranslationsRef.ExpeditionsVersion)) { Client.DownloadFile(BaseTranslationURL + "Expeditions.xml", Path.Combine(MainFolder, "Translations", "tmp", "Expeditions.xml")); ReturnValue = XmlFileWizard(MainFolder, "Expeditions.xml", TranslationType.Expeditions); } if (IsOnlineVersionGreater(TranslationType.Ships, TranslationsRef.ShipsVersion)) { Client.DownloadFile(BaseTranslationURL + "Ships.xml", Path.Combine(MainFolder, "Translations", "tmp", "Ships.xml")); ReturnValue = XmlFileWizard(MainFolder, "Ships.xml", TranslationType.Ships); } if (IsOnlineVersionGreater(TranslationType.ShipTypes, TranslationsRef.ShipTypesVersion)) { Client.DownloadFile(BaseTranslationURL + "ShipTypes.xml", Path.Combine(MainFolder, "Translations", "tmp", "ShipTypes.xml")); ReturnValue = XmlFileWizard(MainFolder, "ShipTypes.xml", TranslationType.ShipTypes); } if (IsOnlineVersionGreater(TranslationType.RemodelSlots, TranslationsRef.RemodelSlotsVersion)) { Client.DownloadFile(BaseTranslationURL + "RemodelSlots.xml", Path.Combine(MainFolder, "Translations", "tmp", "RemodelSlots.xml")); ReturnValue = XmlFileWizard(MainFolder, "RemodelSlots.xml", TranslationType.RemodelSlots); } if (IsOnlineVersionGreater(TranslationType.EquipmentTypes, TranslationsRef.EquipmentTypesVersion)) { Client.DownloadFile(BaseTranslationURL + "EquipmentTypes.xml", Path.Combine(MainFolder, "Translations", "tmp", "EquipmentTypes.xml")); ReturnValue = XmlFileWizard(MainFolder, "EquipmentTypes.xml", TranslationType.EquipmentTypes); } if (IsOnlineVersionGreater(TranslationType.Useitems, TranslationsRef.UseitemsVersion)) { Client.DownloadFile(BaseTranslationURL + "Useitems.xml", Path.Combine(MainFolder, "Translations", "tmp", "Useitems.xml")); ReturnValue = XmlFileWizard(MainFolder, "Useitems.xml", TranslationType.Useitems); } } catch { // Failed to download files. return(-1); } if (Directory.Exists(Path.Combine(MainFolder, "Translations", "tmp"))) { Directory.Delete(Path.Combine(MainFolder, "Translations", "tmp"), true); } KanColleClient.Current.Translations.Reload(); return(ReturnValue); } }
/// <summary> /// Updates any translation files that differ from that found online. /// </summary> /// <param name="BaseTranslationURL">String URL folder that contains all the translation XML files.</param> /// <param name="Culture">Language version to download</param> /// <param name="TranslationsRef">Link to the translation engine to obtain current translation versions.</param> /// <returns>Returns a state code depending on how it ran. [-1: Error, 0: Nothing to update, 1: Update Successful]</returns> public int UpdateTranslations(Translations TranslationsRef, bool CheckVersion = true) { using (WebClient Client = new WebClient()) { XDocument TestXML; int ReturnValue = 0; try { if (!Directory.Exists("Translations")) Directory.CreateDirectory("Translations"); if (!Directory.Exists("Translations\\tmp\\")) Directory.CreateDirectory("Translations\\tmp\\"); // In every one of these we download it to a temp folder, check if the file works, then move it over. if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Equipment, TranslationsRef.EquipmentVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Equipment, true), "Translations\\tmp\\Equipment.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Equipment.xml"); if (File.Exists("Translations\\Equipment.xml")) File.Delete("Translations\\Equipment.xml"); File.Move("Translations\\tmp\\Equipment.xml", "Translations\\Equipment.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Operations, TranslationsRef.OperationsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Operations, true), "Translations\\tmp\\Operations.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Operations.xml"); if (File.Exists("Translations\\Operations.xml")) File.Delete("Translations\\Operations.xml"); File.Move("Translations\\tmp\\Operations.xml", "Translations\\Operations.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Quests, TranslationsRef.QuestsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Quests, true), "Translations\\tmp\\Quests.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Quests.xml"); if (File.Exists("Translations\\Quests.xml")) File.Delete("Translations\\Quests.xml"); File.Move("Translations\\tmp\\Quests.xml", "Translations\\Quests.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Ships, TranslationsRef.ShipsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Ships, true), "Translations\\tmp\\Ships.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Ships.xml"); if (File.Exists("Translations\\Ships.xml")) File.Delete("Translations\\Ships.xml"); File.Move("Translations\\tmp\\Ships.xml", "Translations\\Ships.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.ShipTypes, TranslationsRef.ShipTypesVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.ShipTypes, true), "Translations\\tmp\\ShipTypes.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\ShipTypes.xml"); if (File.Exists("Translations\\ShipTypes.xml")) File.Delete("Translations\\ShipTypes.xml"); File.Move("Translations\\tmp\\ShipTypes.xml", "Translations\\ShipTypes.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Expeditions, TranslationsRef.ExpeditionsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Expeditions, true), "Translations\\tmp\\Expeditions.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Expeditions.xml"); if (File.Exists("Translations\\Expeditions.xml")) File.Delete("Translations\\Expeditions.xml"); File.Move("Translations\\tmp\\Expeditions.xml", "Translations\\Expeditions.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } } catch (Exception ex) { // Failed to download files. Debug.WriteLine(ex); return -1; } if (Directory.Exists("Translations\\tmp\\")) Directory.Delete("Translations\\tmp\\"); return ReturnValue; } }
/// <summary> /// Updates any translation files that differ from that found online. /// </summary> /// <param name="BaseTranslationURL">String URL folder that contains all the translation XML files.</param> /// <param name="Culture">Language version to download</param> /// <param name="TranslationsRef">Link to the translation engine to obtain current translation versions.</param> /// <returns>Returns a state code depending on how it ran. [-1: Error, 0: Nothing to update, 1: Update Successful]</returns> public int UpdateTranslations(Translations TranslationsRef, bool CheckVersion = true) { using (WebClient Client = new WebClient()) { XDocument TestXML; int ReturnValue = 0; try { if (!Directory.Exists("Translations")) { Directory.CreateDirectory("Translations"); } if (!Directory.Exists("Translations\\tmp\\")) { Directory.CreateDirectory("Translations\\tmp\\"); } // In every one of these we download it to a temp folder, check if the file works, then move it over. if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Equipment, TranslationsRef.EquipmentVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Equipment, true), "Translations\\tmp\\Equipment.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Equipment.xml"); if (File.Exists("Translations\\Equipment.xml")) { File.Delete("Translations\\Equipment.xml"); } File.Move("Translations\\tmp\\Equipment.xml", "Translations\\Equipment.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Operations, TranslationsRef.OperationsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Operations, true), "Translations\\tmp\\Operations.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Operations.xml"); if (File.Exists("Translations\\Operations.xml")) { File.Delete("Translations\\Operations.xml"); } File.Move("Translations\\tmp\\Operations.xml", "Translations\\Operations.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Quests, TranslationsRef.QuestsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Quests, true), "Translations\\tmp\\Quests.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Quests.xml"); if (File.Exists("Translations\\Quests.xml")) { File.Delete("Translations\\Quests.xml"); } File.Move("Translations\\tmp\\Quests.xml", "Translations\\Quests.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Ships, TranslationsRef.ShipsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Ships, true), "Translations\\tmp\\Ships.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Ships.xml"); if (File.Exists("Translations\\Ships.xml")) { File.Delete("Translations\\Ships.xml"); } File.Move("Translations\\tmp\\Ships.xml", "Translations\\Ships.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.ShipTypes, TranslationsRef.ShipTypesVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.ShipTypes, true), "Translations\\tmp\\ShipTypes.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\ShipTypes.xml"); if (File.Exists("Translations\\ShipTypes.xml")) { File.Delete("Translations\\ShipTypes.xml"); } File.Move("Translations\\tmp\\ShipTypes.xml", "Translations\\ShipTypes.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } if (!CheckVersion || IsOnlineVersionGreater(TranslationType.Expeditions, TranslationsRef.ExpeditionsVersion)) { Client.DownloadFile(GetOnlineVersion(TranslationType.Expeditions, true), "Translations\\tmp\\Expeditions.xml"); try { TestXML = XDocument.Load("Translations\\tmp\\Expeditions.xml"); if (File.Exists("Translations\\Expeditions.xml")) { File.Delete("Translations\\Expeditions.xml"); } File.Move("Translations\\tmp\\Expeditions.xml", "Translations\\Expeditions.xml"); ReturnValue = 1; } catch (Exception ex) { Debug.WriteLine(ex); ReturnValue = -1; } } } catch (Exception ex) { // Failed to download files. Debug.WriteLine(ex); return(-1); } if (Directory.Exists("Translations\\tmp\\")) { Directory.Delete("Translations\\tmp\\"); } return(ReturnValue); } }
/// <summary> /// Updates any translation files that differ from that found online. /// </summary> /// <param name="BaseTranslationURL">String URL folder that contains all the translation XML files.</param> /// <param name="Culture">Language version to download</param> /// <param name="TranslationsRef">Link to the translation engine to obtain current translation versions.</param> /// <returns>Returns a state code depending on how it ran. [-1: Error, 0: Nothing to update, 1: Update Successful]</returns> public int UpdateTranslations(string BaseTranslationURL, Translations TranslationsRef) { using (WebClient Client = new WebClient()) { int ReturnValue = 0; string MainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); try { if (!Directory.Exists(Path.Combine(MainFolder, "Translations"))) Directory.CreateDirectory(Path.Combine(MainFolder, "Translations")); if (!Directory.Exists(Path.Combine(MainFolder, "Translations", "tmp"))) Directory.CreateDirectory(Path.Combine(MainFolder, "Translations", "tmp")); if (!Directory.Exists(Path.Combine(MainFolder, "Translations", "Old"))) Directory.CreateDirectory(Path.Combine(MainFolder, "Translations", "Old")); // In every one of these we download it to a temp folder, check if the file works, then move it over. if (IsOnlineVersionGreater(TranslationType.Equipment, TranslationsRef.EquipmentVersion)) { Client.DownloadFile(BaseTranslationURL + "Equipment.xml", Path.Combine(MainFolder, "Translations", "tmp", "Equipment.xml")); ReturnValue = XmlFileWizard(MainFolder, "Equipment.xml", TranslationType.Equipment); } if (IsOnlineVersionGreater(TranslationType.Operations, TranslationsRef.OperationsVersion)) { Client.DownloadFile(BaseTranslationURL + "Operations.xml", Path.Combine(MainFolder, "Translations", "tmp", "Operations.xml")); ReturnValue = XmlFileWizard(MainFolder, "Operations.xml", TranslationType.Operations); } if (IsOnlineVersionGreater(TranslationType.Quests, TranslationsRef.QuestsVersion)) { Client.DownloadFile(BaseTranslationURL + "Quests.xml", Path.Combine(MainFolder, "Translations", "tmp", "Quests.xml")); ReturnValue = XmlFileWizard(MainFolder, "Quests.xml", TranslationType.Quests); } if (IsOnlineVersionGreater(TranslationType.Expeditions, TranslationsRef.ExpeditionsVersion)) { Client.DownloadFile(BaseTranslationURL + "Expeditions.xml", Path.Combine(MainFolder, "Translations", "tmp", "Expeditions.xml")); ReturnValue = XmlFileWizard(MainFolder, "Expeditions.xml", TranslationType.Expeditions); } if (IsOnlineVersionGreater(TranslationType.Ships, TranslationsRef.ShipsVersion)) { Client.DownloadFile(BaseTranslationURL + "Ships.xml", Path.Combine(MainFolder, "Translations", "tmp", "Ships.xml")); ReturnValue = XmlFileWizard(MainFolder, "Ships.xml", TranslationType.Ships); } if (IsOnlineVersionGreater(TranslationType.ShipTypes, TranslationsRef.ShipTypesVersion)) { Client.DownloadFile(BaseTranslationURL + "ShipTypes.xml", Path.Combine(MainFolder, "Translations", "tmp", "ShipTypes.xml")); ReturnValue = XmlFileWizard(MainFolder, "ShipTypes.xml", TranslationType.ShipTypes); } if (IsOnlineVersionGreater(TranslationType.RemodelSlots, TranslationsRef.RemodelSlotsVersion)) { Client.DownloadFile(BaseTranslationURL + "RemodelSlots.xml", Path.Combine(MainFolder, "Translations", "tmp", "RemodelSlots.xml")); ReturnValue = XmlFileWizard(MainFolder, "RemodelSlots.xml", TranslationType.RemodelSlots); } } catch { // Failed to download files. return -1; } if (Directory.Exists(Path.Combine(MainFolder, "Translations", "tmp"))) Directory.Delete(Path.Combine(MainFolder, "Translations", "tmp"), true); return ReturnValue; } }