Added a LogFile System.

Spegeli [2016-07-23 09:29:52]
Added a LogFile System.
On every StartUp a new LogFile will be created in the Log Folder.
Filename
PokemonGo.RocketAPI.Logic/Logic.cs
PokemonGo.RocketAPI/Logging/Logger.cs
PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj
PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
PokemonGo.RocketAPI/Proto/AllEnum.proto
diff --git a/PokemonGo.RocketAPI.Logic/Logic.cs b/PokemonGo.RocketAPI.Logic/Logic.cs
index d26828e..732f143 100644
--- a/PokemonGo.RocketAPI.Logic/Logic.cs
+++ b/PokemonGo.RocketAPI.Logic/Logic.cs
@@ -424,7 +424,7 @@ namespace PokemonGo.RocketAPI.Logic
         private async Task DisplayPlayerLevelInTitle()
         {
             _playerProfile = _playerProfile.Profile != null ? _playerProfile : await _client.GetProfile();
-            var playerName = _playerProfile.Profile.Username != null ? _playerProfile.Profile.Username : "";
+            var playerName = _playerProfile.Profile.Username ?? "";
             var playerStats = await _inventory.GetPlayerStats();
             var playerStat = playerStats.FirstOrDefault();
             if (playerStat != null)
diff --git a/PokemonGo.RocketAPI/Logging/Logger.cs b/PokemonGo.RocketAPI/Logging/Logger.cs
index c9f1dea..4611856 100644
--- a/PokemonGo.RocketAPI/Logging/Logger.cs
+++ b/PokemonGo.RocketAPI/Logging/Logger.cs
@@ -1,7 +1,8 @@
 #region

-using PokemonGo.RocketAPI.Logging;
 using System;
+using System.IO;
+using PokemonGo.RocketAPI.Logging;

 #endregion

@@ -35,16 +36,25 @@ namespace PokemonGo.RocketAPI
     /// </summary>
     public static class Logger
 	{
-		private static ILogger logger;
+        static string _currentFile = string.Empty;
+        static string path = Directory.GetCurrentDirectory() + "\\Logs\\";
+
+        private static ILogger logger;

-		/// <summary>
-		/// Set the logger. All future requests to <see cref="Write(string, LogLevel)"/> will use that logger, any old will be unset.
-		/// </summary>
-		/// <param name="logger"></param>
-		public static void SetLogger(ILogger logger)
+        /// <summary>
+        /// Set the logger. All future requests to <see cref="Write(string, LogLevel)"/> will use that logger, any old will be unset.
+        /// </summary>
+        /// <param name="logger"></param>
+        public static void SetLogger(ILogger logger)
 		{
 			Logger.logger = logger;
-		}
+            if (!Directory.Exists(path))
+            {
+                DirectoryInfo di = Directory.CreateDirectory(path);
+            }
+            _currentFile = DateTime.Now.ToString("yyyy-MM-dd - HH.mm.ss");
+            Log($"Initializing Rocket logger @ {DateTime.Now}...");
+        }

         /// <summary>
         /// write message to log window and file
@@ -52,7 +62,10 @@ namespace PokemonGo.RocketAPI
         /// <param name="message">message text</param>
         public static void Normal(string message)
         {
+            if (logger == null)
+                return;
             logger.Write(message);
+            Log(String.Concat($"[{DateTime.Now.ToString("HH:mm:ss")}] ", message));
         }

         /// <summary>
@@ -68,6 +81,7 @@ namespace PokemonGo.RocketAPI
             System.Console.ForegroundColor = color;
             logger.Write(message);
             System.Console.ForegroundColor = originalColor;
+            Log(String.Concat($"[{DateTime.Now.ToString("HH:mm:ss")}] ", message));
         }

         /// <summary>
@@ -83,8 +97,18 @@ namespace PokemonGo.RocketAPI
             System.Console.ForegroundColor = ConsoleColor.Red;
             logger.Write(message);
             System.Console.ForegroundColor = originalColor;
+            Log(String.Concat($"[{DateTime.Now.ToString("HH:mm:ss")}] ", message));
         }

+        private static void Log(string message)
+        {
+            // maybe do a new log rather than appending?
+            using (StreamWriter log = File.AppendText(path + _currentFile + ".txt"))
+            {
+                log.WriteLine(message);
+                log.Flush();
+            }
+        }
     }

 	public enum LogLevel
diff --git a/PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj b/PokemonGo.RocketAPI/PokemonGo.RocketAPI.csproj
index c14baac..45a53e9 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.68</AssemblyVersion>
+    <AssemblyVersion>2016.7.23.74</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 7e1a3dc..02363b4 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.68")]
+[assembly: AssemblyVersion("2016.7.23.74")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/PokemonGo.RocketAPI/Proto/AllEnum.proto b/PokemonGo.RocketAPI/Proto/AllEnum.proto
index 1e888f8..bbec7d0 100644
--- a/PokemonGo.RocketAPI/Proto/AllEnum.proto
+++ b/PokemonGo.RocketAPI/Proto/AllEnum.proto
@@ -486,7 +486,7 @@ enum PokemonId {
   VICTREEBELL = 71;
   TENTACOOL = 72;
   TENTACRUEL = 73;
-  GEODUGE = 74;
+  GEODUDE = 74;
   GRAVELER = 75;
   GOLEM = 76;
   PONYTA = 77;
You may download the files in Public Git.