Added logger instance to database class, more informative fail messages.
Logs all HTTP requests
This commit is contained in:
parent
3ccd0013b4
commit
89381bcc7d
@ -365,8 +365,7 @@ copy /Y "$(TargetDir)IW4MAdmin.exe.config" "$(SolutionDir)BUILD"
|
||||
copy /Y "$(ProjectDir)lib\Kayak.dll" "$(SolutionDir)BUILD\lib"
|
||||
|
||||
xcopy /Y /I /E "$(ProjectDir)webfront\*" "$(SolutionDir)BUILD\Webfront"
|
||||
xcopy /Y /I /E "$(TagetDir)Config\*" "$(SolutionDir)BUILD\Config"
|
||||
|
||||
xcopy /Y /I /E "$(SolutionDir)Admin\Config\*" "$(SolutionDir)BUILD\Config"
|
||||
|
||||
if $(ConfigurationName) == Release-Nightly powershell.exe -file "$(SolutionDir)DEPLOY\publish_nightly.ps1" 1.5
|
||||
if $(ConfigurationName) == Release-Stable powershell.exe -file "$(SolutionDir)DEPLOY\publish_stable.ps1" 1.5
|
||||
|
@ -15,7 +15,7 @@ namespace IW4MAdmin
|
||||
{
|
||||
// it looks like there's a library error in
|
||||
// Kayak.Http.HttpServerTransactionDelegate.OnError
|
||||
if ((uint)e.HResult == 0x80004003)
|
||||
if ((uint)e.HResult == 0x80004003 || (uint)e.InnerException?.HResult == 0x80004003)
|
||||
return;
|
||||
|
||||
ApplicationManager.GetInstance().Logger.WriteWarning("Web service has encountered an error - " + e.Message);
|
||||
@ -39,6 +39,11 @@ namespace IW4MAdmin
|
||||
{
|
||||
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response, string IP)
|
||||
{
|
||||
var logger = ApplicationManager.GetInstance().GetLogger();
|
||||
logger.WriteInfo($"HTTP request {request.Path}");
|
||||
logger.WriteInfo($"QueryString: {request.QueryString}");
|
||||
logger.WriteInfo($"IP: {IP}");
|
||||
|
||||
NameValueCollection querySet = new NameValueCollection();
|
||||
|
||||
if (request.QueryString != null)
|
||||
|
@ -44,8 +44,8 @@ namespace IW4MAdmin
|
||||
TaskStatuses = new List<AsyncStatus>();
|
||||
MessageTokens = new List<MessageToken>();
|
||||
|
||||
ClientDatabase = new ClientsDB("Database/clients.rm");
|
||||
AliasesDatabase = new AliasesDB("Database/aliases.rm");
|
||||
ClientDatabase = new ClientsDB("Database/clients.rm", Logger);
|
||||
AliasesDatabase = new AliasesDB("Database/aliases.rm", Logger);
|
||||
ClientPenalties = new PenaltyList();
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -75,8 +75,8 @@ Global
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -99,8 +99,8 @@ Global
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -123,8 +123,8 @@ Global
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -147,8 +147,8 @@ Global
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -170,7 +170,7 @@ Global
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -188,7 +188,7 @@ Global
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x86.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -209,8 +209,8 @@ Global
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -232,7 +232,7 @@ Global
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
@ -254,7 +254,7 @@ Global
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
|
||||
|
@ -54,7 +54,7 @@ namespace MessageBoard.Forum
|
||||
{
|
||||
forumPages = new List<IPage>();
|
||||
activeSessions = new List<Session>();
|
||||
database = new Storage.Database("Database/forum.db");
|
||||
database = new Storage.Database("Database/forum.db", null);
|
||||
}
|
||||
|
||||
public void startSession(string sessionID)
|
||||
|
@ -7,7 +7,7 @@ namespace MessageBoard.Storage
|
||||
{
|
||||
class Database : SharedLibrary.Database
|
||||
{
|
||||
public Database(String FN) : base(FN) { }
|
||||
public Database(String FN, SharedLibrary.Interfaces.ILogger logger) : base(FN, logger) { }
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ namespace StatsPlugin
|
||||
"where",
|
||||
};
|
||||
|
||||
public ChatDatabase(string FN) : base(FN)
|
||||
public ChatDatabase(string FN, SharedLibrary.Interfaces.ILogger logger) : base(FN, logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ namespace StatsPlugin
|
||||
|
||||
public StatTracking(int port)
|
||||
{
|
||||
playerStats = new StatsDB("Database/stats_" + port + ".rm");
|
||||
playerStats = new StatsDB("Database/stats_" + port + ".rm", ManagerInstance.GetLogger());
|
||||
inactiveMinutes = new int[18];
|
||||
Kills = new int[18];
|
||||
deathStreaks = new int[18];
|
||||
@ -205,7 +205,7 @@ namespace StatsPlugin
|
||||
ManagerInstance.GetMessageTokens().Add(new MessageToken("TOTALKILLS", GetTotalKills));
|
||||
ManagerInstance.GetMessageTokens().Add(new MessageToken("TOTALPLAYTIME", GetTotalPlaytime));
|
||||
|
||||
ChatDB = new ChatDatabase("Database/ChatHistory.rm");
|
||||
ChatDB = new ChatDatabase("Database/ChatHistory.rm", ManagerInstance.GetLogger());
|
||||
|
||||
try
|
||||
{
|
||||
@ -484,7 +484,7 @@ namespace StatsPlugin
|
||||
|
||||
public class StatsDB : Database
|
||||
{
|
||||
public StatsDB(String FN) : base(FN) { }
|
||||
public StatsDB(String FN, SharedLibrary.Interfaces.ILogger logger) : base(FN, logger) { }
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
|
@ -9,9 +9,12 @@ namespace SharedLibrary
|
||||
{
|
||||
public abstract class Database
|
||||
{
|
||||
public Database(String FN)
|
||||
private Interfaces.ILogger Logger;
|
||||
|
||||
public Database(String FN, Interfaces.ILogger logger)
|
||||
{
|
||||
FileName = FN;
|
||||
Logger = logger;
|
||||
Init();
|
||||
}
|
||||
|
||||
@ -58,7 +61,10 @@ namespace SharedLibrary
|
||||
|
||||
catch (Exception E)
|
||||
{
|
||||
Console.WriteLine($"Line 58: {E.Message}");
|
||||
Logger.WriteWarning($"Database Insert failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL command: {insertcmd.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -96,7 +102,10 @@ namespace SharedLibrary
|
||||
|
||||
catch (Exception E)
|
||||
{
|
||||
Console.WriteLine($"Line 96: {E.Message}");
|
||||
Logger.WriteWarning($"Database UpdateIncrement failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL command: {updatecmd?.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +142,10 @@ namespace SharedLibrary
|
||||
|
||||
catch (Exception E)
|
||||
{
|
||||
Console.WriteLine($"Line 96: {E.Message}");
|
||||
Logger.WriteWarning($"Database update failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL Query: {updatecmd.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -149,25 +161,26 @@ namespace SharedLibrary
|
||||
int rowsUpdated = 0;
|
||||
Request = Request.Replace("!'", "").Replace("!", "");
|
||||
var Con = GetNewConnection();
|
||||
SQLiteCommand CMD = null;
|
||||
try
|
||||
{
|
||||
|
||||
Con.Open();
|
||||
SQLiteCommand CMD = new SQLiteCommand(Con)
|
||||
Con.Open();
|
||||
CMD = new SQLiteCommand(Con)
|
||||
{
|
||||
CommandText = Request
|
||||
};
|
||||
rowsUpdated = CMD.ExecuteNonQuery();
|
||||
Con.Close();
|
||||
Con.Close();
|
||||
return rowsUpdated;
|
||||
}
|
||||
|
||||
catch (Exception E)
|
||||
{
|
||||
// fixme: this needs to have a reference to a logger..
|
||||
Console.WriteLine(E.Message);
|
||||
Console.WriteLine(E.StackTrace);
|
||||
Console.WriteLine(Request);
|
||||
Logger.WriteWarning($"Database command failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL command: {CMD?.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -182,7 +195,7 @@ namespace SharedLibrary
|
||||
var Con = GetNewConnection();
|
||||
updatecmd.Parameters.AddWithValue('@' + where.Key, where.Value);
|
||||
updatecmd.Connection = Con;
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
@ -193,10 +206,12 @@ namespace SharedLibrary
|
||||
Con.Close();
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
catch (Exception E)
|
||||
{
|
||||
//LOGME
|
||||
Console.WriteLine($"Line 160: {e.Message}");
|
||||
Logger.WriteWarning($"Database GetDataTable failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL command: {updatecmd.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
}
|
||||
|
||||
return dt;
|
||||
@ -216,10 +231,12 @@ namespace SharedLibrary
|
||||
Con.Close();
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
catch (Exception E)
|
||||
{
|
||||
//LOGME
|
||||
Console.WriteLine($"Line 181: {e.Message}");
|
||||
Logger.WriteWarning($"Database GetDataTable failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL command: {cmd.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
}
|
||||
|
||||
return dt;
|
||||
@ -229,24 +246,28 @@ namespace SharedLibrary
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
var Con = GetNewConnection();
|
||||
SQLiteCommand cmd = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Con.Open();
|
||||
SQLiteCommand mycommand = new SQLiteCommand(Con)
|
||||
Con.Open();
|
||||
cmd = new SQLiteCommand(Con)
|
||||
{
|
||||
CommandText = sql
|
||||
};
|
||||
SQLiteDataReader reader = mycommand.ExecuteReader();
|
||||
dt.Load(reader);
|
||||
reader.Close();
|
||||
Con.Close();
|
||||
SQLiteDataReader reader = cmd.ExecuteReader();
|
||||
dt.Load(reader);
|
||||
reader.Close();
|
||||
Con.Close();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception E)
|
||||
{
|
||||
Console.WriteLine($"Line 198: {e.Message}");
|
||||
Logger.WriteWarning($"Database GetDataTable failed");
|
||||
Logger.WriteDebug($"Exception Message: {E.Message}");
|
||||
Logger.WriteDebug($"SQL command: {cmd?.CommandText}");
|
||||
Logger.WriteDebug($"Database File: {FileName}");
|
||||
return new DataTable();
|
||||
}
|
||||
return dt;
|
||||
@ -257,7 +278,7 @@ namespace SharedLibrary
|
||||
|
||||
public class ClientsDB : Database
|
||||
{
|
||||
public ClientsDB(String FN) : base(FN) { }
|
||||
public ClientsDB(String FN, Interfaces.ILogger logger) : base(FN, logger) { }
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
@ -508,7 +529,7 @@ namespace SharedLibrary
|
||||
if (Row["TIME"].ToString().Length < 2) //compatibility with my old database
|
||||
Row["TIME"] = DateTime.Now.ToString();
|
||||
|
||||
var BanType = (Penalty.Type)Enum.Parse(typeof(Penalty.Type), Row["TYPE"].ToString());
|
||||
var BanType = (Penalty.Type)Enum.Parse(typeof(Penalty.Type), Row["TYPE"].ToString());
|
||||
ClientPenalties.Add(new Penalty(BanType, Row["Reason"].ToString().Trim(), Row["npID"].ToString(), Row["bannedByID"].ToString(), DateTime.Parse(Row["TIME"].ToString()), Row["IP"].ToString(), DateTime.Parse(Row["EXPIRES"].ToString())));
|
||||
}
|
||||
|
||||
@ -608,7 +629,7 @@ namespace SharedLibrary
|
||||
|
||||
public class AliasesDB : Database
|
||||
{
|
||||
public AliasesDB(String FN) : base(FN) { }
|
||||
public AliasesDB(String FN, Interfaces.ILogger logger) : base(FN, logger) { }
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user