Merge pull request #1115 from Gh0stN00b/Beta-Build
Brian [2016-08-23 16:11:18]
Merge pull request #1115 from Gh0stN00b/Beta-Build
Beta build Fix
diff --git a/PokemonGo.RocketBot.Logic/Common/Translations.cs b/PokemonGo.RocketBot.Logic/Common/Translations.cs
index 6aab17d..121ff97 100644
--- a/PokemonGo.RocketBot.Logic/Common/Translations.cs
+++ b/PokemonGo.RocketBot.Logic/Common/Translations.cs
@@ -910,9 +910,9 @@ namespace PokemonGo.RocketBot.Logic.Common
Logger.Write($"[ERROR] Issue loading translations: {ex}", LogLevel.Warning);
Logger.Write("[Request] Rebuild the translations folder? Y/N");
- var strInput = Console.ReadLine().ToLower();
+ var strInput = Console.ReadLine()?.ToLower();
- if (strInput.Equals("y"))
+ if (strInput == null || strInput.Equals("y"))
{
// Currently this section can only rebuild the EN translations file \\
// This is because default values cannot be supplied from other languages \\
diff --git a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
index 9e20f64..7e3b8db 100644
--- a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
+++ b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
@@ -50,7 +50,10 @@ namespace PokemonGo.RocketBot.Window.Forms
private void SettingsForm_Load(object sender, EventArgs e)
{
- GetLanguageList();
+ var languageList = GetLanguageList();
+ var languageIndex = languageList.IndexOf(_setting.TranslationLanguageCode);
+ cbLanguage.DataSource = languageList;
+ cbLanguage.SelectedIndex = languageIndex == -1 ? 0 : languageIndex;
#region Advanced Setting Init
@@ -343,14 +346,14 @@ namespace PokemonGo.RocketBot.Window.Forms
/// <summary>
/// Get languale list from Translations folder and populate it to combo box
/// </summary>
- private void GetLanguageList()
+ private List<string> GetLanguageList()
{
var languages = new List<string> { "en" };
var langFiles = Directory.GetFiles(LanguagePath, "*.json", SearchOption.TopDirectoryOnly);
languages.AddRange(langFiles.Select(
langFileName => Path.GetFileNameWithoutExtension(langFileName)?.Replace("translation.", ""))
.Where(langCode => langCode != "en"));
- cbLanguage.DataSource = languages;
+ return languages;
}
/// <summary>
You may download the files in Public Git.