Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BornSupercharged committed Aug 4, 2016
1 parent 6250493 commit fc089e0
Show file tree
Hide file tree
Showing 14 changed files with 718 additions and 729 deletions.
25 changes: 12 additions & 13 deletions PoGo.NecroBot.CLI/App.config
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PoGo.NecroBot.CLI.UserSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="PoGo.NecroBot.CLI.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="PoGo.NecroBot.CLI.UserSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="PoGo.NecroBot.CLI.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="C5" publicKeyToken="282361b99ded7e8e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.4.5947.17248" newVersion="2.4.5947.17248" />
<assemblyIdentity name="C5" publicKeyToken="282361b99ded7e8e" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.4.5947.17248" newVersion="2.4.5947.17248"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0" />
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<connectionStrings>
<add name="Pogo" connectionString="DatasetId = YOUR_DATASET_ID; CertificateFilePath = C:\Path\To\Your\Certificate\File-privatekey.p12; ServiceAccountId = your-service-account-email@developer.gserviceaccount.com; CertificatePassword = notasecret" />
<add name="Pogo" connectionString="DatasetId = YOUR_DATASET_ID; CertificateFilePath = C:\Path\To\Your\Certificate\File-privatekey.p12; ServiceAccountId = your-service-account-email@developer.gserviceaccount.com; CertificatePassword = notasecret"/>
</connectionStrings>
</configuration>
</configuration>
3 changes: 2 additions & 1 deletion PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PoGo.NecroBot.CLI</RootNamespace>
<AssemblyName>NecroBot</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
19 changes: 13 additions & 6 deletions PoGo.NecroBot.Logic/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class Logger
private static DateTime _lastLogTime;
private static readonly IList<string> LogbufferList = new List<string>();
private static string _lastLogMessage;
private static bool _isGui;

private static void Log(string message, bool force = false)
{
Expand Down Expand Up @@ -49,12 +50,16 @@ private static void Log(string message, bool force = false)
/// unset.
/// </summary>
/// <param name="logger"></param>
public static void SetLogger(ILogger logger, string subPath = "")
public static void SetLogger(ILogger logger, string subPath = "", bool isGui = false)
{
_logger = logger;
_path = Path.Combine(Directory.GetCurrentDirectory(), subPath, "Logs");
Directory.CreateDirectory(_path);
Log($"Initializing NecroBot logger at time {DateTime.Now}...");
_isGui = isGui;
if (!_isGui)
{
_path = Path.Combine(Directory.GetCurrentDirectory(), subPath, "Logs");
Directory.CreateDirectory(_path);
Log($"Initializing NecroBot logger at time {DateTime.Now}...");
}
}

/// <summary>
Expand All @@ -74,11 +79,13 @@ public static void SetLoggerContext(ISession session)
/// <param name="color">Optional. Default is automatic color.</param>
public static void Write(string message, LogLevel level = LogLevel.Info, ConsoleColor color = ConsoleColor.Black, bool force = false)
{
if (_logger == null || _lastLogMessage == message )
if (_logger == null || _lastLogMessage == message)
return;
_lastLogMessage = message;
_logger.Write(message, level, color);
Log(string.Concat($"[{DateTime.Now.ToString("HH:mm:ss")}] ", message), force);

if (!_isGui)
Log(string.Concat($"[{DateTime.Now.ToString("HH:mm:ss")}] ", message), force);
}
}

Expand Down
7 changes: 0 additions & 7 deletions PoGo.NecroBot.Logic/Navigation.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#region using directives

#region using directives

using System;
using System.Globalization;
using System.Threading;
Expand All @@ -10,11 +8,6 @@
using PoGo.NecroBot.Logic.Utils;
using PokemonGo.RocketAPI;
using POGOProtos.Networking.Responses;
using System.Linq;

#endregion

// ReSharper disable RedundantAssignment

#endregion

Expand Down
3 changes: 2 additions & 1 deletion PoGo.NecroBot.Logic/PoGo.NecroBot.Logic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PoGo.NecroBot.Logic</RootNamespace>
<AssemblyName>PoGo.NecroBot.Logic</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Loading

1 comment on commit fc089e0

@BRZ420
Copy link

@BRZ420 BRZ420 commented on fc089e0 Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the update to 4.5.2 really necessary? I have troubles installing it for wine. It installs, but fails to detect

Please sign in to comment.