Add debugging and NetHookAnalyzer

This commit is contained in:
JustArchi
2016-03-07 18:12:05 +01:00
parent 1a4d941a2c
commit 07687df91f
7 changed files with 22 additions and 2 deletions

3
.gitignore vendored
View File

@@ -8,8 +8,9 @@ ArchiSteamFarm/config/*
!ArchiSteamFarm/config/example.json
!ArchiSteamFarm/config/minimal.json
# Ignore local debugging log file
# Ignore local debugging
ArchiSteamFarm/log.txt
ArchiSteamFarm/debug/*
#################
## Eclipse

View File

@@ -193,6 +193,19 @@ namespace ArchiSteamFarm {
// Initialize
SteamClient = new SteamClient();
if (Program.GlobalConfig.Debug && !Debugging.NetHookAlreadyInitialized) {
try {
if (Directory.Exists(Program.DebugDirectory)) {
Directory.Delete(Program.DebugDirectory, true);
}
Directory.CreateDirectory(Program.DebugDirectory);
SteamClient.DebugNetworkListener = new NetHookNetworkListener(Program.DebugDirectory);
Debugging.NetHookAlreadyInitialized = true;
} catch (Exception e) {
Logging.LogGenericException(e, botName);
}
}
ArchiHandler = new ArchiHandler();
SteamClient.AddHandler(ArchiHandler);

View File

@@ -31,5 +31,7 @@ namespace ArchiSteamFarm {
#endif
internal static bool IsReleaseBuild => !IsDebugBuild;
internal static bool NetHookAlreadyInitialized { get; set; } = false;
}
}

View File

@@ -23,7 +23,6 @@
*/
using Newtonsoft.Json;
using SteamAuth;
using System;
using System.Collections.Generic;
using System.IO;
@@ -39,6 +38,9 @@ namespace ArchiSteamFarm {
// This is hardcoded blacklist which should not be possible to change
internal static readonly HashSet<uint> GlobalBlacklist = new HashSet<uint> { 267420, 303700, 335590, 368020, 425280 };
[JsonProperty(Required = Required.DisallowNull)]
internal bool Debug { get; private set; } = false;
[JsonProperty(Required = Required.DisallowNull)]
internal bool AutoUpdates { get; private set; } = true;

View File

@@ -52,6 +52,7 @@ namespace ArchiSteamFarm {
internal const string ASF = "ASF";
internal const string ConfigDirectory = "config";
internal const string DebugDirectory = "debug";
internal const string LogFile = "log.txt";
internal const string GlobalConfigFile = ASF + ".json";
internal const string GlobalDatabaseFile = ASF + ".db";

View File

@@ -1,4 +1,5 @@
{
"Debug": false,
"AutoUpdates": true,
"UpdateChannel": 1,
"HttpTimeout": 30,

BIN
tools/NetHookAnalyzer2.exe Normal file

Binary file not shown.