Merge remote-tracking branch 'refs/remotes/origin/Beta-Build'

Brian [2016-08-01 03:53:09]
Merge remote-tracking branch 'refs/remotes/origin/Beta-Build'
Filename
PokemonGo/RocketAPI/Client.cs
PokemonGo/RocketAPI/PokemonGo.RocketAPI.csproj
PokemonGo/RocketAPI/Window/MainForm.cs
PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index 5c4ae6c..3a1444e 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -40,6 +40,9 @@ namespace PokemonGo.RocketAPI

         private readonly ILoginType login;

+        public delegate void ConsoleWriteDelegate(ConsoleColor color, string message);
+        public static event ConsoleWriteDelegate OnConsoleWrite;
+
         public Client(ISettings settings)
         {
             _settings = settings;
@@ -254,14 +257,12 @@ namespace PokemonGo.RocketAPI
         {
             ConsoleColor originalColor = System.Console.ForegroundColor;
             System.Console.ForegroundColor = color;
-            System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss tt") + "] " + text);
-
-            var dir = AppDomain.CurrentDomain.BaseDirectory + @"\Logs";
-            if (!Directory.Exists(dir))
-                Directory.CreateDirectory(dir);
-            File.AppendAllText(dir + @"\" + DateTime.Today.ToString("yyyyMMdd") + ".txt", "[" + DateTime.Now.ToString("HH:mm:ss tt") + "] " + text + "\r\n");
-
+            System.Console.WriteLine(text);
             System.Console.ForegroundColor = originalColor;
+            if (OnConsoleWrite != null)
+            {
+                OnConsoleWrite(color, text);
+            }
         }

         public async Task<FortDetailsResponse> GetFort(string fortId, double fortLat, double fortLng)
diff --git a/PokemonGo/RocketAPI/PokemonGo.RocketAPI.csproj b/PokemonGo/RocketAPI/PokemonGo.RocketAPI.csproj
index 8a6404d..3dc6681 100644
--- a/PokemonGo/RocketAPI/PokemonGo.RocketAPI.csproj
+++ b/PokemonGo/RocketAPI/PokemonGo.RocketAPI.csproj
@@ -50,6 +50,7 @@
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Drawing" />
     <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
       <Private>True</Private>
@@ -106,7 +107,6 @@
     <None Include="Proto\Response.proto" />
     <None Include="Proto\Request.proto" />
   </ItemGroup>
-  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/PokemonGo/RocketAPI/Window/MainForm.cs b/PokemonGo/RocketAPI/Window/MainForm.cs
index 8443137..467f14b 100644
--- a/PokemonGo/RocketAPI/Window/MainForm.cs
+++ b/PokemonGo/RocketAPI/Window/MainForm.cs
@@ -50,6 +50,7 @@ namespace PokemonGo.RocketAPI.Window
             synchronizationContext = SynchronizationContext.Current;
             InitializeComponent();
             ClientSettings = Settings.Instance;
+            Client.OnConsoleWrite += Client_OnConsoleWrite;
             Instance = this;
         }

@@ -574,6 +575,11 @@ namespace PokemonGo.RocketAPI.Window
             var mapObjects = await client.GetMapObjects();

             FortData[] rawPokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime()).ToArray();
+            if (rawPokeStops == null || rawPokeStops.Count() <= 0)
+            {
+                ColoredConsoleWrite(Color.Red, $"No PokeStops to visit here, please stop the bot and change your location.");
+                return;
+            }
             pokeStops = rawPokeStops;
             UpdateMap();
             ColoredConsoleWrite(Color.Cyan, $"Finding fastest route through all PokeStops..");
diff --git a/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
index 66e91a5..d86954f 100644
--- a/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
+++ b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.2.1")]
+[assembly: AssemblyVersion("1.7.2.3")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
You may download the files in Public Git.