diff --git a/Admin/IW4M ADMIN.csproj b/Admin/IW4M ADMIN.csproj index 5804d0a80..42de1f726 100644 --- a/Admin/IW4M ADMIN.csproj +++ b/Admin/IW4M ADMIN.csproj @@ -112,7 +112,7 @@ False ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - True + False @@ -156,6 +156,9 @@ PreserveNewest + + PreserveNewest + Always @@ -325,13 +328,11 @@ - move "$(TargetDir)Newtonsoft.Json.dll" "$(TargetDir)lib\Newtonsoft.Json.dll" -copy /Y "$(SolutionDir)lib\*.dll" "$(TargetDir)lib" + copy /Y "$(SolutionDir)lib\*.dll" "$(TargetDir)lib" copy /Y "$(TargetDir)$(TargetName).exe" "$(SolutionDir)BUILD" copy /Y "$(TargetDir)IW4MAdmin.exe.config" "$(SolutionDir)BUILD" copy /Y "$(ProjectDir)lib\Kayak.dll" "$(SolutionDir)BUILD\lib" -copy /Y "$(ProjectDir)lib\SQLite.Interop.dll" "$(SolutionDir)BUILD\lib" diff --git a/Admin/Kayak.cs b/Admin/Kayak.cs index 3d143ede4..62afd74bc 100644 --- a/Admin/Kayak.cs +++ b/Admin/Kayak.cs @@ -13,7 +13,15 @@ namespace IW4MAdmin { public void OnException(IScheduler scheduler, Exception e) { - Manager.GetInstance().Logger.WriteError("Web service has encountered an error - " + e.Message); + Manager.GetInstance().Logger.WriteWarning("Web service has encountered an error - " + e.Message); + Manager.GetInstance().Logger.WriteDebug($"Stack Trace: {e.StackTrace}"); + + if (e.InnerException != null) + { + Manager.GetInstance().Logger.WriteDebug($"Inner Execption: {e.InnerException.Message}"); + Manager.GetInstance().Logger.WriteDebug($"Inner Stack Trace: {e.InnerException.StackTrace}"); + } + } public void OnStop(IScheduler scheduler) diff --git a/Admin/Logger.cs b/Admin/Logger.cs index 60070bdee..152329a95 100644 --- a/Admin/Logger.cs +++ b/Admin/Logger.cs @@ -33,7 +33,7 @@ namespace IW4MAdmin string LogLine = $"[{DateTime.Now.ToString("HH:mm:ss")}] - {type}: {msg}"; #if DEBUG // lets keep it simple and dispose of everything quickly as logging wont be that much (relatively) - + Console.WriteLine(LogLine); File.AppendAllText(FileName, LogLine + Environment.NewLine); #else diff --git a/Admin/Server.cs b/Admin/Server.cs index 2b6e0896b..fabac6d4b 100644 --- a/Admin/Server.cs +++ b/Admin/Server.cs @@ -238,21 +238,36 @@ namespace IW4MAdmin //Process requested command correlating to an event // todo: this needs to be removed out of here - override public async Task ProcessCommand(Event E, Command C) + override public async Task ValidateCommand(Event E) { + string CommandString = E.Data.Substring(1, E.Data.Length - 1).Split(' ')[0]; + + Command C = null; + foreach (Command cmd in Manager.GetCommands()) + { + if (cmd.Name == CommandString.ToLower() || cmd.Alias == CommandString.ToLower()) + C = cmd; + } + + if (C == null) + { + await E.Origin.Tell("You entered an unknown command"); + throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} entered unknown command \"{CommandString}\""); + } + E.Data = E.Data.RemoveWords(1); String[] Args = E.Data.Trim().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); if (E.Origin.Level < C.Permission) { await E.Origin.Tell("You do not have access to that command!"); - return null; + throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} does not have access to \"{C.Name}\""); } if (Args.Length < (C.requiredArgNum)) { - await E.Origin.Tell("Not enough arguments supplied!"); - return null; + await E.Origin.Tell($"Not enough arguments supplied! ^5({C.requiredArgNum} ^7required)"); + throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\""); } if (C.needsTarget) @@ -273,13 +288,12 @@ namespace IW4MAdmin int dbID = -1; int.TryParse(Args[0].Substring(1, Args[0].Length-1), out dbID); - IW4MServer castServer = (IW4MServer)(E.Owner); Player found = Manager.GetClientDatabase().GetPlayer(dbID); if (found != null) { E.Target = found; E.Target.lastEvent = E; - E.Owner = this; + E.Owner = this as IW4MServer; } } @@ -295,7 +309,7 @@ namespace IW4MAdmin if (E.Target == null) { await E.Origin.Tell("Unable to find specified player."); - return null; + throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} specified invalid player for \"{C.Name}\""); } } return C; @@ -309,7 +323,11 @@ namespace IW4MAdmin { try { +#if DEBUG await P.OnEventAsync(E, this); +#else + P.OnEventAsync(E, this); +#endif } catch (Exception Except) @@ -348,7 +366,7 @@ namespace IW4MAdmin override public async Task ProcessUpdatesAsync(CancellationToken cts) { #if DEBUG == false - try + try #endif { await PollPlayersAsync(); @@ -387,7 +405,7 @@ namespace IW4MAdmin nextMessage++; start = DateTime.Now; } - + //logFile = new IFile(); if (l_size != logFile.getSize()) { @@ -435,11 +453,16 @@ namespace IW4MAdmin l_size = logFile.getSize(); } #if DEBUG == false - catch (Exception E) - { - Logger.WriteError("Unexpected error on \"" + Hostname + "\""); - Logger.WriteDebug("Error Message: " + E.Message); - Logger.WriteDebug("Error Trace: " + E.StackTrace); + catch (SharedLibrary.Exceptions.NetworkException) + { + Logger.WriteError($"Could not communicate with {IP}:{Port}"); + } + + catch (Exception E) + { + Logger.WriteError($"Encountered error on {IP}:{Port}"); + Logger.WriteDebug("Error Message: " + E.Message); + Logger.WriteDebug("Error Trace: " + E.StackTrace); } #endif } @@ -517,17 +540,11 @@ namespace IW4MAdmin if (E.Type == Event.GType.Disconnect) { - if (E.Origin == null) - { - Logger.WriteError("Disconnect event triggered, but no origin found."); - return; - } while (chatHistory.Count > Math.Ceiling(((double)ClientNum - 1) / 2)) chatHistory.RemoveAt(0); chatHistory.Add(new Chat(E.Origin.Name, "DISCONNECTED", DateTime.Now)); - //removePlayer(E.Origin.clientID); return; } @@ -546,7 +563,7 @@ namespace IW4MAdmin else // suicide/falling { - //Log.Write(E.Origin.Name + " suicided...", Log.Level.Debug); + Logger.WriteDebug(E.Origin.Name + " suicided..."); await ExecuteEvent(new Event(Event.GType.Death, "suicide", E.Target, null, this)); } } @@ -556,51 +573,42 @@ namespace IW4MAdmin if (E.Data.Length < 2) // ITS A LIE! return; - if (E.Origin == null) - { - Logger.WriteError("Say event triggered, but no origin found! - " + E.Data); - return; - } - - - if (E.Owner == null) - { - Logger.WriteError("Say event does not have an owner!"); - return; - } - if (E.Data.Substring(0, 1) == "!" || E.Origin.Level == Player.Permission.Console) { - Command C = E.isValidCMD(Manager.GetCommands()); + Command C = null; + + try + { + C = await ValidateCommand(E); + } + + catch (SharedLibrary.Exceptions.CommandException e) + { + Logger.WriteInfo(e.Message); + return; + } if (C != null) { - C = await ProcessCommand(E, C); - if (C != null) + if (C.needsTarget && E.Target == null) { - if (C.needsTarget && E.Target == null) - { - Logger.WriteError("Requested event requiring target does not have a target!"); - return; - } + Logger.WriteWarning("Requested event (command) requiring target does not have a target!"); + return; + } - try - { - await C.ExecuteAsync(E); - } + try + { + await C.ExecuteAsync(E); + } - catch (Exception Except) - { - Logger.WriteError(String.Format("A command request \"{0}\" generated an error.", C.Name)); - Logger.WriteDebug(String.Format("Error Message: {0}", Except.Message)); - Logger.WriteDebug(String.Format("Error Trace: {0}", Except.StackTrace)); - return; - } + catch (Exception Except) + { + Logger.WriteError(String.Format("A command request \"{0}\" generated an error.", C.Name)); + Logger.WriteDebug(String.Format("Error Message: {0}", Except.Message)); + Logger.WriteDebug(String.Format("Error Trace: {0}", Except.StackTrace)); + return; } } - - else - await E.Origin.Tell("You entered an invalid command!"); return; } @@ -622,7 +630,6 @@ namespace IW4MAdmin { Logger.WriteInfo($"New map loaded - {ClientNum} active players"); - // make async Gametype = (await this.GetDvarAsync("g_gametype")).Value.StripColors(); Hostname = (await this.GetDvarAsync("sv_hostname")).Value.StripColors(); FSGame = (await this.GetDvarAsync("fs_game")).Value.StripColors(); diff --git a/Admin/lib/SQLite.Interop.dll b/Admin/lib/SQLite.Interop.dll index 850518679..ef2d6a77b 100644 Binary files a/Admin/lib/SQLite.Interop.dll and b/Admin/lib/SQLite.Interop.dll differ diff --git a/Admin/lib/SharedLibrary.dll b/Admin/lib/SharedLibrary.dll index 4d428cb7f..3f1157619 100644 Binary files a/Admin/lib/SharedLibrary.dll and b/Admin/lib/SharedLibrary.dll differ diff --git a/Admin/lib/System.Data.SQLite.dll b/Admin/lib/System.Data.SQLite.dll index 8f4e0bf1a..54fba4e66 100644 Binary files a/Admin/lib/System.Data.SQLite.dll and b/Admin/lib/System.Data.SQLite.dll differ diff --git a/IW4M Admin.sln b/IW4M Admin.sln index c8d941fee..94a9b92ac 100644 --- a/IW4M Admin.sln +++ b/IW4M Admin.sln @@ -42,10 +42,10 @@ Global Debug|Mixed Platforms = Debug|Mixed Platforms Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x64 = Release|x64 - Release|x86 = Release|x86 + Release-Nightly|Any CPU = Release-Nightly|Any CPU + Release-Nightly|Mixed Platforms = Release-Nightly|Mixed Platforms + Release-Nightly|x64 = Release-Nightly|x64 + Release-Nightly|x86 = Release-Nightly|x86 Release-Stable|Any CPU = Release-Stable|Any CPU Release-Stable|Mixed Platforms = Release-Stable|Mixed Platforms Release-Stable|x64 = Release-Stable|x64 @@ -60,14 +60,14 @@ Global {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|x64.Build.0 = Debug|Any CPU {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|x86.ActiveCfg = Debug|Any CPU {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|x86.Build.0 = Debug|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|x64.ActiveCfg = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|x64.Build.0 = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|x86.ActiveCfg = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|x86.Build.0 = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x64.Build.0 = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x86.Build.0 = Release|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|Any CPU @@ -84,14 +84,14 @@ Global {4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|x64.Build.0 = Debug|Any CPU {4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|x86.ActiveCfg = Debug|Any CPU {4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|x86.Build.0 = Debug|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.Build.0 = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|x64.ActiveCfg = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|x64.Build.0 = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|x86.ActiveCfg = Release|Any CPU - {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|x86.Build.0 = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x64.Build.0 = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x86.Build.0 = Release|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|Any CPU @@ -108,14 +108,14 @@ Global {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x64.Build.0 = Debug|Any CPU {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x86.ActiveCfg = Debug|Any CPU {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x86.Build.0 = Debug|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.Build.0 = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x64.ActiveCfg = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x64.Build.0 = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x86.ActiveCfg = Release|Any CPU - {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x86.Build.0 = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x64.Build.0 = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.Build.0 = Release|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|Any CPU @@ -132,14 +132,14 @@ Global {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x64.Build.0 = Debug|Any CPU {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x86.ActiveCfg = Debug|Any CPU {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x86.Build.0 = Debug|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Any CPU.Build.0 = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x64.ActiveCfg = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x64.Build.0 = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x86.ActiveCfg = Release|Any CPU - {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x86.Build.0 = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x64.Build.0 = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x86.Build.0 = Release|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|Any CPU @@ -156,14 +156,14 @@ Global {2321A25F-7871-47C3-8440-02551918D6A1}.Debug|x64.Build.0 = Debug|Any CPU {2321A25F-7871-47C3-8440-02551918D6A1}.Debug|x86.ActiveCfg = Debug|Any CPU {2321A25F-7871-47C3-8440-02551918D6A1}.Debug|x86.Build.0 = Debug|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|Any CPU.Build.0 = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|x64.ActiveCfg = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|x64.Build.0 = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|x86.ActiveCfg = Release|Any CPU - {2321A25F-7871-47C3-8440-02551918D6A1}.Release|x86.Build.0 = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|x64.Build.0 = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Nightly|x86.Build.0 = Release|Any CPU {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU {2321A25F-7871-47C3-8440-02551918D6A1}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|Any CPU @@ -180,14 +180,14 @@ Global {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Debug|x64.Build.0 = Debug|Any CPU {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Debug|x86.ActiveCfg = Debug|Any CPU {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Debug|x86.Build.0 = Debug|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|Any CPU.Build.0 = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|x64.ActiveCfg = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|x64.Build.0 = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|x86.ActiveCfg = Release|Any CPU - {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release|x86.Build.0 = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x64.Build.0 = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x86.Build.0 = Release|Any CPU {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU {428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|Any CPU @@ -202,12 +202,12 @@ Global {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Debug|x64.ActiveCfg = Debug|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Debug|x86.ActiveCfg = Debug|Any CPU - {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release|Any CPU.Build.0 = Release|Any CPU - {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release|x64.ActiveCfg = Release|Any CPU - {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release|x86.ActiveCfg = Release|Any CPU + {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x86.ActiveCfg = Release|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|Any CPU @@ -224,14 +224,14 @@ Global {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x64.Build.0 = Debug|Any CPU {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x86.ActiveCfg = Debug|Any CPU {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x86.Build.0 = Debug|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Any CPU.Build.0 = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x64.ActiveCfg = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x64.Build.0 = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x86.ActiveCfg = Release|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x86.Build.0 = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x64.Build.0 = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.Build.0 = Release|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|Any CPU diff --git a/SharedLibrary/Database.cs b/SharedLibrary/Database.cs index b62446621..d616eb2c0 100644 --- a/SharedLibrary/Database.cs +++ b/SharedLibrary/Database.cs @@ -141,8 +141,10 @@ namespace SharedLibrary { CommandText = String.Format("SELECT * FROM {0} WHERE `{1}`=@{1};", tableName, where.Key) }; - updatecmd.Parameters.AddWithValue('@' + where.Key, where.Value); var Con = GetNewConnection(); + updatecmd.Parameters.AddWithValue('@' + where.Key, where.Value); + updatecmd.Connection = Con; + try { @@ -166,6 +168,7 @@ namespace SharedLibrary { DataTable dt = new DataTable(); var Con = GetNewConnection(); + cmd.Connection = Con; try { Con.Open(); @@ -178,7 +181,7 @@ namespace SharedLibrary catch (Exception e) { //LOGME - Console.Write($"Line 181: {e.Message}"); + Console.WriteLine($"Line 181: {e.Message}"); } return dt; diff --git a/SharedLibrary/Event.cs b/SharedLibrary/Event.cs index cf9270b79..9ef2130cb 100644 --- a/SharedLibrary/Event.cs +++ b/SharedLibrary/Event.cs @@ -100,19 +100,6 @@ namespace SharedLibrary Owner = S; } - public Command isValidCMD(List list) - { - string[] cmd = this.Data.Substring(1, this.Data.Length - 1).Split(' '); - - foreach (Command C in list) - { - if (C.Name == cmd[0].ToLower() || C.Alias == cmd[0].ToLower()) - return C; - } - - return null; - } - public static Event requestEvent(String[] line, Server SV) { #if DEBUG == false diff --git a/SharedLibrary/SQLite.Interop.dll b/SharedLibrary/SQLite.Interop.dll new file mode 100644 index 000000000..ef2d6a77b Binary files /dev/null and b/SharedLibrary/SQLite.Interop.dll differ diff --git a/SharedLibrary/Server.cs b/SharedLibrary/Server.cs index d475773bb..0fd3668f3 100644 --- a/SharedLibrary/Server.cs +++ b/SharedLibrary/Server.cs @@ -186,7 +186,7 @@ namespace SharedLibrary /// Event parameter /// Command requested from the event /// - abstract public Task ProcessCommand(Event E, Command C); + abstract public Task ValidateCommand(Event E); virtual public Task ProcessUpdatesAsync(CancellationToken cts) { @@ -220,6 +220,9 @@ namespace SharedLibrary /// Message to be sent to all players public async Task Broadcast(String Message) { +#if DEBUG + return; +#endif await this.ExecuteCommandAsync($"sayraw {Message}"); } @@ -230,6 +233,9 @@ namespace SharedLibrary /// Player to send message to public async Task Tell(String Message, Player Target) { +#if DEBUG + return; +#endif if (Target.clientID > -1 && Message.Length > 0 && Target.Level != Player.Permission.Console && !Target.lastEvent.Remote) await this.ExecuteCommandAsync($"tellraw {Target.clientID} {Message}^7"); diff --git a/SharedLibrary/SharedLibrary.csproj b/SharedLibrary/SharedLibrary.csproj index 06ade6fa8..2aa5b492a 100644 --- a/SharedLibrary/SharedLibrary.csproj +++ b/SharedLibrary/SharedLibrary.csproj @@ -12,6 +12,8 @@ v4.5 512 + + AnyCPU @@ -53,8 +55,9 @@ - - ..\Admin\lib\System.Data.SQLite.dll + + ..\packages\System.Data.SQLite.Core.1.0.105.1\lib\net45\System.Data.SQLite.dll + True @@ -93,15 +96,31 @@ + + + PreserveNewest + + - mkdir "$(SolutionDir)Admin\$(OutDir)plugins + move "$(TargetDir)Newtonsoft.Json.dll" "$(TargetDir)lib\Newtonsoft.Json.dll" +copy /Y "$(TargetDir)SQLite.Interop.dll" "$(SolutionDir)BUILD\lib" +copy /Y "$(TargetDir)System.Data.SQLite.dll" "$(SolutionDir)BUILD\lib" +copy /Y "$(TargetDir)SQLite.Interop.dll" "$(SolutionDir)Admin\lib" +copy /Y "$(TargetDir)System.Data.SQLite.dll" "$(SolutionDir)Admin\lib" +mkdir "$(SolutionDir)Admin\$(OutDir)plugins copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\lib" copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)Admin\lib" -copy /Y "$(TargetDir)System.Data.SQLite.dll" "$(SolutionDir)BUILD\lib" copy /Y "$(TargetDir)Newtonsoft.Json.dll" "$(SolutionDir)BUILD\lib" copy /Y "$(TargetDir)Newtonsoft.Json.dll" "$(SolutionDir)Admin\lib" + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + +