Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging settings and code cleanup #2717

Merged
merged 4 commits into from
Aug 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion PoGo.NecroBot.CLI/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Setup for Necrobot:
2. Go to the config directory and open config.json in Notepad, Sublime, Brackets, etc.
3. Change the "DefaultLatitude" and "DefaultLongitude" to your starting location.
Change other parameters in the json file as you wish.
**Note: changing "MaxTravelDistanceInMeters" to a large number (<5000) may cause problems**
**Note: changing "MaxTravelDistanceInMeters" to a large number (>=5000) may cause problems**
4. Run the NecroBot app again and start botting PoGo!

See the Discord chat below for questions. Be nice.
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