Bug fix for settings

Gh0st [2016-08-13 12:49:24]
Bug fix for settings

1. Fix devide firmware fingerprint cannot be saved
2. Make dropdown boxes read only
Filename
src/RocketBotGUI/Settings.cs
src/RocketBotGUI/SettingsForm.Designer.cs
src/RocketBotGUI/SettingsForm.cs
diff --git a/src/RocketBotGUI/Settings.cs b/src/RocketBotGUI/Settings.cs
index 1826284..4c947eb 100644
--- a/src/RocketBotGUI/Settings.cs
+++ b/src/RocketBotGUI/Settings.cs
@@ -80,25 +80,6 @@ namespace PokemonGo.RocketAPI.Window
         private int MaxItemHyperPotion => GetSetting() != string.Empty ? Convert.ToInt16(GetSetting()) : 500;
         private int MaxItemMaxPotion => GetSetting() != string.Empty ? Convert.ToInt16(GetSetting()) : 500;

-        public string DeviceIdTb => GetSetting() != string.Empty ? GetSetting() : "8525f6d8251f71b7";
-        public string AndroidBoardNameTb => GetSetting() != string.Empty ? GetSetting() : "msm8994";
-        public string AndroidBootloaderTb => GetSetting() != string.Empty ? GetSetting() : "unknown";
-        public string DeviceBrandTb => GetSetting() != string.Empty ? GetSetting() : "OnePlus";
-        public string DeviceModelTb => GetSetting() != string.Empty ? GetSetting() : "OnePlus2";
-        public string DeviceModelIdentifierTb => GetSetting() != string.Empty ? GetSetting() : "ONE A2003_24_160604";
-        public string DeviceModelBootTb => GetSetting() != string.Empty ? GetSetting() : "qcom";
-        public string HardwareManufacturerTb => GetSetting() != string.Empty ? GetSetting() : "OnePlus";
-        public string HardwareModelTb => GetSetting() != string.Empty ? GetSetting() : "ONE A2003";
-        public string FirmwareBrandTb => GetSetting() != string.Empty ? GetSetting() : "OnePlus2";
-        public string FirmwareTagsTb => GetSetting() != string.Empty ? GetSetting() : "dev-key";
-        public string FirmwareTypeTb => GetSetting() != string.Empty ? GetSetting() : "user";
-
-        public string FirmwareFingerprintTb
-            =>
-                GetSetting() != string.Empty
-                    ? GetSetting()
-                    : "OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447840820:user/release-keys";
-
         public ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter => new[]
         {
             new KeyValuePair<ItemId, int>(ItemId.ItemPokeBall, MaxItemPokeBall),
diff --git a/src/RocketBotGUI/SettingsForm.Designer.cs b/src/RocketBotGUI/SettingsForm.Designer.cs
index 0688c62..59a3b6f 100644
--- a/src/RocketBotGUI/SettingsForm.Designer.cs
+++ b/src/RocketBotGUI/SettingsForm.Designer.cs
@@ -136,6 +136,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             // authTypeCb
             //
+            this.authTypeCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.authTypeCb.FormattingEnabled = true;
             this.authTypeCb.Items.AddRange(new object[] {
             "Google",
@@ -265,6 +266,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             // razzmodeCb
             //
+            this.razzmodeCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.razzmodeCb.FormattingEnabled = true;
             this.razzmodeCb.Items.AddRange(new object[] {
             "Probability",
@@ -286,6 +288,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             // transferTypeCb
             //
+            this.transferTypeCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.transferTypeCb.FormattingEnabled = true;
             this.transferTypeCb.Items.AddRange(new object[] {
             "None",
@@ -443,6 +446,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             // useIncubatorsCb
             //
+            this.useIncubatorsCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.useIncubatorsCb.FormattingEnabled = true;
             this.useIncubatorsCb.Items.AddRange(new object[] {
             "Disabled",
@@ -492,7 +496,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             // transferIVThresText
             //
-            this.transferIVThresText.Location = new System.Drawing.Point(138, 254);
+            this.transferIVThresText.Location = new System.Drawing.Point(138, 252);
             this.transferIVThresText.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.transferIVThresText.Name = "transferIVThresText";
             this.transferIVThresText.Size = new System.Drawing.Size(116, 21);
diff --git a/src/RocketBotGUI/SettingsForm.cs b/src/RocketBotGUI/SettingsForm.cs
index 3f1ff50..0e832db 100644
--- a/src/RocketBotGUI/SettingsForm.cs
+++ b/src/RocketBotGUI/SettingsForm.cs
@@ -233,8 +233,9 @@ namespace PokemonGo.RocketAPI.Window
             Settings.Instance.HardwareManufacturer = HardwareManufacturerTb.Text;
             Settings.Instance.HardwareModel = HardwareModelTb.Text;
             Settings.Instance.FirmwareBrand = FirmwareBrandTb.Text;
-            Settings.Instance.FirmwareTags = FirmwareTypeTb.Text;
-            Settings.Instance.FirmwareType = FirmwareFingerprintTb.Text;
+            Settings.Instance.FirmwareTags = FirmwareTagsTb.Text;
+            Settings.Instance.FirmwareType = FirmwareTypeTb.Text;
+            Settings.Instance.FirmwareFingerprint = FirmwareFingerprintTb.Text;
             if (DeviceIdTb.Text == "8525f6d8251f71b7")
             {
                 PopulateDevice();
@@ -392,7 +393,7 @@ namespace PokemonGo.RocketAPI.Window

         private void deviceTypeCb_SelectedIndexChanged(object sender, EventArgs e)
         {
-            PopulateDevice();
+            PopulateDevice(deviceTypeCb.SelectedIndex);
         }

         private void RandomIDBtn_Click(object sender, EventArgs e)
@@ -400,9 +401,9 @@ namespace PokemonGo.RocketAPI.Window
             DeviceIdTb.Text = _deviceHelper.RandomString(16, "0123456789abcdef");
         }

-        private void PopulateDevice()
+        private void PopulateDevice(int tabIndex = -1)
         {
-            deviceTypeCb.SelectedIndex = _deviceHelper.GetRandomIndex(2);
+            deviceTypeCb.SelectedIndex = tabIndex == -1 ? _deviceHelper.GetRandomIndex(2) : tabIndex;
             var candidateDevices = deviceTypeCb.SelectedIndex == 0
                 ? _deviceInfos.Where(d => d.DeviceBrand.ToLower() == "apple").ToList()
                 : _deviceInfos.Where(d => d.DeviceBrand.ToLower() != "apple").ToList();
You may download the files in Public Git.