Fix custom device info is getting resetted when bot launches

Gh0st [2016-08-22 17:35:37]
Fix custom device info is getting resetted when bot launches
Filename
PokemonGo.RocketBot.Window/Forms/MainForm.cs
PokemonGo.RocketBot.Window/Forms/SettingForm.cs
diff --git a/PokemonGo.RocketBot.Window/Forms/MainForm.cs b/PokemonGo.RocketBot.Window/Forms/MainForm.cs
index 20efd8c..948aa8b 100644
--- a/PokemonGo.RocketBot.Window/Forms/MainForm.cs
+++ b/PokemonGo.RocketBot.Window/Forms/MainForm.cs
@@ -145,6 +145,7 @@ namespace PokemonGo.RocketBot.Window.Forms

             var profilePath = Path.Combine(Directory.GetCurrentDirectory(), subPath);
             var profileConfigPath = Path.Combine(profilePath, "config");
+            var authFile = Path.Combine(profileConfigPath, "auth.json");
             var configFile = Path.Combine(profileConfigPath, "config.json");

             BoolNeedsSetup = false;
@@ -154,7 +155,8 @@ namespace PokemonGo.RocketBot.Window.Forms
                 /** if (!VersionCheckState.IsLatest())
                     settings = GlobalSettings.Load(subPath, true);
                 else **/
-                _settings = GlobalSettings.Load(subPath);
+                _settings = GlobalSettings.Load(subPath, true);
+                _settings.Auth.Load(authFile);
             }
             else
             {
diff --git a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
index 993aa50..7b5d554 100644
--- a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
+++ b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
@@ -449,6 +449,7 @@ namespace PokemonGo.RocketBot.Window.Forms
             _setting.Auth.UseProxyUsername = proxyUserTb.Text;
             _setting.Auth.UseProxyPassword = proxyPwTb.Text;

+            _setting.Auth.DevicePackageName = "custom";
             _setting.Auth.DeviceId = DeviceIdTb.Text;
             _setting.Auth.AndroidBoardName = AndroidBoardNameTb.Text;
             _setting.Auth.AndroidBootloader = AndroidBootloaderTb.Text;
@@ -598,10 +599,10 @@ namespace PokemonGo.RocketBot.Window.Forms
             #endregion

             _setting.Save(ConfigFilePath);
-            Application.Restart();

             #endregion

+            Application.Restart();
             Close();
         }
You may download the files in Public Git.