Added SessionRuntime to Statistics

Spegeli [2016-07-23 13:41:48]
Added SessionRuntime to Statistics
Changed colors for Navigation and Recycle Items
Filename
PokemonGo.RocketAPI.Logic/Logic.cs
PokemonGo.RocketAPI.Logic/Navigation.cs
PokemonGo.RocketAPI.Logic/Utils/Statistics.cs
PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj
PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
diff --git a/PokemonGo.RocketAPI.Logic/Logic.cs b/PokemonGo.RocketAPI.Logic/Logic.cs
index 75a6e0f..e7a605d 100644
--- a/PokemonGo.RocketAPI.Logic/Logic.cs
+++ b/PokemonGo.RocketAPI.Logic/Logic.cs
@@ -337,12 +337,12 @@ namespace PokemonGo.RocketAPI.Logic
         {
             var items = await _inventory.GetItemsToRecycle(_clientSettings);
             if (items != null && items.Any())
-                Logger.Normal(ConsoleColor.DarkCyan, $"(RECYCLE) {items.Count()} Items:");
+                Logger.Normal(ConsoleColor.DarkMagenta, $"(RECYCLE) {items.Count()} Items:");

             foreach (var item in items)
             {
                 var transfer = await _client.RecycleItem((ItemId)item.Item_, item.Count);
-                Logger.Normal(ConsoleColor.DarkCyan, $"(RECYCLED) {item.Count}x {(ItemId)item.Item_}");
+                Logger.Normal(ConsoleColor.DarkMagenta, $"(RECYCLED) {item.Count}x {(ItemId)item.Item_}");

                 _stats.addItemsRemoved(item.Count);
                 _stats.updateConsoleTitle(_inventory);
diff --git a/PokemonGo.RocketAPI.Logic/Navigation.cs b/PokemonGo.RocketAPI.Logic/Navigation.cs
index 15cad6b..9742af6 100644
--- a/PokemonGo.RocketAPI.Logic/Navigation.cs
+++ b/PokemonGo.RocketAPI.Logic/Navigation.cs
@@ -40,7 +40,7 @@ namespace PokemonGo.RocketAPI.Logic

             var sourceLocation = new Location(_client.CurrentLat, _client.CurrentLng);
             var distanceToTarget = LocationUtils.CalculateDistanceInMeters(sourceLocation, targetLocation);
-            Logger.Normal($"(NAVIGATION) Distance to target location: {distanceToTarget:0.##} meters. Will take {distanceToTarget / speedInMetersPerSecond:0.##} seconds!");
+            Logger.Normal(ConsoleColor.DarkCyan, $"(NAVIGATION) Distance to target location: {distanceToTarget:0.##} meters. Will take {distanceToTarget / speedInMetersPerSecond:0.##} seconds!");

             var nextWaypointBearing = LocationUtils.DegreeBearing(sourceLocation, targetLocation);
             var nextWaypointDistance = speedInMetersPerSecond;
@@ -66,7 +66,7 @@ namespace PokemonGo.RocketAPI.Logic
                 {
                     if (speedInMetersPerSecond > SpeedDownTo)
                     {
-                        Logger.Normal($"(NAVIGATION) We are within 40 meters of the target. Speeding down to 10 km/h to not pass the target.");
+                        Logger.Normal(ConsoleColor.DarkCyan, $"(NAVIGATION) We are within 40 meters of the target. Speeding down to 10 km/h to not pass the target.");
                         speedInMetersPerSecond = SpeedDownTo;
                     }
                 }
diff --git a/PokemonGo.RocketAPI.Logic/Utils/Statistics.cs b/PokemonGo.RocketAPI.Logic/Utils/Statistics.cs
index aeea988..fdfe4c0 100644
--- a/PokemonGo.RocketAPI.Logic/Utils/Statistics.cs
+++ b/PokemonGo.RocketAPI.Logic/Utils/Statistics.cs
@@ -21,12 +21,18 @@ namespace PokemonGo.RocketAPI.Logic.Utils
         public static int Currentlevel = -1;

         public static DateTime _initSessionDateTime = DateTime.Now;
+        public static TimeSpan duration = (DateTime.Now - _initSessionDateTime);

         public static double _getSessionRuntime()
         {
             return ((DateTime.Now - _initSessionDateTime).TotalSeconds) / 3600;
         }

+        public static string _getSessionRuntimeInTimeFormat()
+        {
+            return ((DateTime.Now - _initSessionDateTime).ToString(@"dd\.hh\:mm\:ss"));
+        }
+
         public void addExperience(int xp)
         {
             _totalExperience += xp;
@@ -76,7 +82,7 @@ namespace PokemonGo.RocketAPI.Logic.Utils

         public override string ToString()
         {
-            return string.Format("{0} - LvL: {1:0}    EXP/H: {2:0.0} EXP   P/H: {3:0.0} Pokemon(s)   Stardust: {4:0}   Pokemon Transfered: {5:0}   Items Removed: {6:0}", "Statistics", _currentLevelInfos, _totalExperience / _getSessionRuntime(), _totalPokemons / _getSessionRuntime(), _totalStardust, _totalPokemonsTransfered, _totalItemsRemoved);
+            return string.Format("SessionRuntime {0} - LvL: {1:0} | EXP/H: {2:0.0} | P/H: {3:0.0} | Stardust: {4:0} | Pokemon Transfered: {5:0} | Items Removed: {6:0}",  _getSessionRuntimeInTimeFormat(), _currentLevelInfos, _totalExperience / _getSessionRuntime(), _totalPokemons / _getSessionRuntime(), _totalStardust, _totalPokemonsTransfered, _totalItemsRemoved);
         }

         public static int GetXpDiff(int level)
diff --git a/PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj b/PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj
index 55ffbe4..2c85ba9 100644
--- a/PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj
+++ b/PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj
@@ -17,7 +17,7 @@
     <UpdateAssemblyInfoVersion>False</UpdateAssemblyInfoVersion>
     <AssemblyVersionSettings>YearStamp.MonthStamp.DayStamp.Increment</AssemblyVersionSettings>
     <PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
-    <AssemblyVersion>2016.7.23.107</AssemblyVersion>
+    <AssemblyVersion>2016.7.23.113</AssemblyVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
diff --git a/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs b/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
index ecd1d87..8ab5343 100644
--- a/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
+++ b/PokemonGo.RocketAPI/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("2016.7.23.107")]
+[assembly: AssemblyVersion("2016.7.23.113")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
You may download the files in Public Git.