cleanup

Detective Squirrel [2016-07-29 13:45:27]
cleanup
Filename
PokemonGo/RocketAPI/Client.cs
PokemonGo/RocketAPI/Window/MainForm.cs
PokemonGo/RocketAPI/Window/PokeUi.cs
diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index 7e247ea..94ccfa9 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -98,9 +98,9 @@ namespace PokemonGo.RocketAPI
                 string token = _GPSOresponse["Token"];
                 Dictionary<string, string> oauthResponse = _GPSOclient.PerformOAuth(
                 token,
-"audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com",
-"com.nianticlabs.pokemongo",
-"321187995bc7cdc2b5fc91b11a96e2baa8602c62");
+                "audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com",
+                "com.nianticlabs.pokemongo",
+                "321187995bc7cdc2b5fc91b11a96e2baa8602c62");
                 /* string oauthJson = JsonConvert.SerializeObject(oauthResponse, Formatting.Indented);
                   Console.WriteLine(oauthJson); */
                 _accessToken = oauthResponse["Auth"];
@@ -159,26 +159,26 @@ namespace PokemonGo.RocketAPI
         }


-		public async Task<EvolvePokemonOut> PowerUp(ulong pokemonId)
-		{
-			var customRequest = new EvolvePokemon
-			{
-				PokemonId = pokemonId
-			};
-
-			var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30,
-				new Request.Types.Requests
-				{
-					Type = (int)RequestType.UPGRADE_POKEMON,
-					Message = customRequest.ToByteString()
-				});
-			return
-				await
-					_httpClient.PostProtoPayload<Request, EvolvePokemonOut>($"https://{_apiUrl}/rpc",
-						releasePokemonRequest);
-		}
-
-		private async Task<MiscEnums.Item> GetBestBall(int? pokemonCP)
+        public async Task<EvolvePokemonOut> PowerUp(ulong pokemonId)
+        {
+            var customRequest = new EvolvePokemon
+            {
+                PokemonId = pokemonId
+            };
+
+            var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30,
+                new Request.Types.Requests
+                {
+                    Type = (int)RequestType.UPGRADE_POKEMON,
+                    Message = customRequest.ToByteString()
+                });
+            return
+                await
+                    _httpClient.PostProtoPayload<Request, EvolvePokemonOut>($"https://{_apiUrl}/rpc",
+                        releasePokemonRequest);
+        }
+
+        private async Task<MiscEnums.Item> GetBestBall(int? pokemonCP)
         {
             var inventory = await GetInventory();

@@ -377,8 +377,8 @@ namespace PokemonGo.RocketAPI
         {
             _currentLat = lat;
             _currentLng = lng;
-//            _settings.DefaultLatitude = lat;
-//            _settings.DefaultLongitude = lng;
+            //            _settings.DefaultLatitude = lat;
+            //            _settings.DefaultLongitude = lng;
         }

         public async Task SetServer()
diff --git a/PokemonGo/RocketAPI/Window/MainForm.cs b/PokemonGo/RocketAPI/Window/MainForm.cs
index 5d5f26d..fa85042 100644
--- a/PokemonGo/RocketAPI/Window/MainForm.cs
+++ b/PokemonGo/RocketAPI/Window/MainForm.cs
@@ -43,7 +43,7 @@ namespace PokemonGo.RocketAPI.Window
         private static bool FarmingPokemons = false;
         private static DateTime TimeStarted = DateTime.Now;
         public static DateTime InitSessionDateTime = DateTime.Now;
-
+

         Client client;
         LocationManager locationManager;
@@ -196,9 +196,6 @@ namespace PokemonGo.RocketAPI.Window
                         break;
                     case AuthType.Google:
                         ColoredConsoleWrite(Color.Green, "Login Type: Google");
-                            ColoredConsoleWrite(Color.Green, "Authenticating...\n");
-                            ColoredConsoleWrite(Color.Green, "Logging in to Google account.");
-
                         await client.DoGoogleLogin(ClientSettings.Email, ClientSettings.Password);

                         break;
@@ -217,16 +214,17 @@ namespace PokemonGo.RocketAPI.Window

                 // Write the players ingame details
                 ColoredConsoleWrite(Color.Yellow, "----------------------------");
-                        if (ClientSettings.AuthType == AuthType.Ptc)
-                        {
-                            ColoredConsoleWrite(Color.Cyan, "Account: " + ClientSettings.PtcUsername);
-                            ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.PtcPassword + "\n");
-                        }
-                        else
-                        {
-                            ColoredConsoleWrite(Color.Cyan, "Email: " + ClientSettings.Email);
-                            ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.Password + "\n");
-                        }
+                /*// dont actually want to display info but keeping here incase people want to \O_O/
+                 * if (ClientSettings.AuthType == AuthType.Ptc)
+                {
+                    ColoredConsoleWrite(Color.Cyan, "Account: " + ClientSettings.PtcUsername);
+                    ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.PtcPassword + "\n");
+                }
+                else
+                {
+                    ColoredConsoleWrite(Color.Cyan, "Email: " + ClientSettings.Email);
+                    ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.Password + "\n");
+                }*/
                 ColoredConsoleWrite(Color.DarkGray, "Name: " + profile.Profile.Username);
                 ColoredConsoleWrite(Color.DarkGray, "Team: " + profile.Profile.Team);
                 if (profile.Profile.Currency.ToArray()[0].Amount > 0) // If player has any pokecoins it will show how many they have.
@@ -497,7 +495,7 @@ namespace PokemonGo.RocketAPI.Window
                 {
                     await Task.Delay(25);
                 }
-
+
                 ColoredConsoleWrite(Color.LightGreen, "Starting force unban...");

                 var mapObjects = await client.GetMapObjects();
@@ -534,7 +532,7 @@ namespace PokemonGo.RocketAPI.Window

                     if (!done)
                         ColoredConsoleWrite(Color.LightGreen, "Force unban failed, please try again.");
-
+
                     ForceUnbanning = false;
                     break;
                 }
diff --git a/PokemonGo/RocketAPI/Window/PokeUi.cs b/PokemonGo/RocketAPI/Window/PokeUi.cs
index fd439ca..3ee7962 100644
--- a/PokemonGo/RocketAPI/Window/PokeUi.cs
+++ b/PokemonGo/RocketAPI/Window/PokeUi.cs
@@ -32,9 +32,9 @@ namespace PokemonGo.RocketAPI.Window

         private async void Execute()
         {
-			EnabledButton(false);
+            EnabledButton(false);

-			client = new Client(ClientSettings);
+            client = new Client(ClientSettings);

             try
             {
@@ -47,7 +47,6 @@ namespace PokemonGo.RocketAPI.Window
                         await client.DoGoogleLogin(ClientSettings.Email, ClientSettings.Password);
                         break;
                 }
-                //
                 await client.SetServer();
                 var profile = await client.GetProfile();
                 var inventory = await client.GetInventory();
@@ -71,7 +70,7 @@ namespace PokemonGo.RocketAPI.Window
                 var imageList = new ImageList { ImageSize = new Size(imageSize, imageSize) };
                 //var imageList = new ImageList { ImageSize = new Size(96, 96) };
                 listView1.ShowItemToolTips = true;
-
+
                 foreach (var pokemon in pokemons)
                 {
                     Bitmap pokemonImage = null;
@@ -102,13 +101,13 @@ namespace PokemonGo.RocketAPI.Window


                     this.listView1.Items.Add(listViewItem);
-
+
                 }
-		this.Text = "PokeUi " + pokemons.Count<PokemonData>() + "/" + profile.Profile.PokeStorage;
-		EnabledButton(true);
+                this.Text = "PokeUi " + pokemons.Count<PokemonData>() + "/" + profile.Profile.PokeStorage;
+                EnabledButton(true);


-			}
+            }
             catch (TaskCanceledException) { Execute(); }
             catch (UriFormatException) { Execute(); }
             catch (ArgumentOutOfRangeException) { Execute(); }
@@ -117,13 +116,13 @@ namespace PokemonGo.RocketAPI.Window
             catch (Exception ex) { Execute(); }
         }

-		private void EnabledButton(bool enabled)
-		{
-			button1.Enabled = enabled;
-			button2.Enabled = enabled;
-			button3.Enabled = enabled;
-			btnUpgrade.Enabled = enabled;
-		}
+        private void EnabledButton(bool enabled)
+        {
+            button1.Enabled = enabled;
+            button2.Enabled = enabled;
+            button3.Enabled = enabled;
+            btnUpgrade.Enabled = enabled;
+        }

         private static Bitmap GetPokemonImage(int pokemonId)
         {
@@ -268,48 +267,48 @@ namespace PokemonGo.RocketAPI.Window
             catch (Exception ex) { await transferPokemon(pokemon); }
         }

-		private async void btnUpgrade_Click(object sender, EventArgs e)
-		{
-			var selectedItems = listView1.SelectedItems;
-
-			foreach (ListViewItem selectedItem in selectedItems)
-			{
-				await PowerUp((PokemonData)selectedItem.Tag);
-			}
-
-			listView1.Clear();
-			Execute();
-		}
-
-		private static async Task PowerUp(PokemonData pokemon)
-		{
-			try
-			{
-				var evolvePokemonResponse = await client.PowerUp(pokemon.Id);
-				string message = "";
-				string caption = "";
-				MessageBoxButtons buttons = MessageBoxButtons.OK;
-				DialogResult result;
-
-				if (evolvePokemonResponse.Result == 1)
-				{
-					message = $"{pokemon.PokemonId} successfully upgraded.";
-					caption = $"{pokemon.PokemonId} upgraded";
-				}
-				else
-				{
-					message = $"{pokemon.PokemonId} could not be upgraded";
-					caption = $"Upgrade {pokemon.PokemonId} failed";
-				}
-
-				result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
-			}
-			catch (TaskCanceledException) { await PowerUp(pokemon); }
-			catch (UriFormatException) { await PowerUp(pokemon); }
-			catch (ArgumentOutOfRangeException) { await PowerUp(pokemon); }
-			catch (ArgumentNullException) { await PowerUp(pokemon); }
-			catch (NullReferenceException) { await PowerUp(pokemon); }
-			catch (Exception ex) { await PowerUp(pokemon); }
-		}
-	}
+        private async void btnUpgrade_Click(object sender, EventArgs e)
+        {
+            var selectedItems = listView1.SelectedItems;
+
+            foreach (ListViewItem selectedItem in selectedItems)
+            {
+                await PowerUp((PokemonData)selectedItem.Tag);
+            }
+
+            listView1.Clear();
+            Execute();
+        }
+
+        private static async Task PowerUp(PokemonData pokemon)
+        {
+            try
+            {
+                var evolvePokemonResponse = await client.PowerUp(pokemon.Id);
+                string message = "";
+                string caption = "";
+                MessageBoxButtons buttons = MessageBoxButtons.OK;
+                DialogResult result;
+
+                if (evolvePokemonResponse.Result == 1)
+                {
+                    message = $"{pokemon.PokemonId} successfully upgraded.";
+                    caption = $"{pokemon.PokemonId} upgraded";
+                }
+                else
+                {
+                    message = $"{pokemon.PokemonId} could not be upgraded";
+                    caption = $"Upgrade {pokemon.PokemonId} failed";
+                }
+
+                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
+            }
+            catch (TaskCanceledException) { await PowerUp(pokemon); }
+            catch (UriFormatException) { await PowerUp(pokemon); }
+            catch (ArgumentOutOfRangeException) { await PowerUp(pokemon); }
+            catch (ArgumentNullException) { await PowerUp(pokemon); }
+            catch (NullReferenceException) { await PowerUp(pokemon); }
+            catch (Exception ex) { await PowerUp(pokemon); }
+        }
+    }
 }
You may download the files in Public Git.