fixed issue with database command not having connection set, combined methods into Validate command

This commit is contained in:
RaidMax 2017-05-30 16:23:31 -05:00
parent 200c4d79fd
commit 354cec0951
14 changed files with 181 additions and 149 deletions

View File

@ -112,7 +112,7 @@
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
@ -156,6 +156,9 @@
<Content Include="lib\SQLite.Interop.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="lib\System.Data.SQLite.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="version.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@ -325,13 +328,11 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>move "$(TargetDir)Newtonsoft.Json.dll" "$(TargetDir)lib\Newtonsoft.Json.dll"
copy /Y "$(SolutionDir)lib\*.dll" "$(TargetDir)lib"
<PostBuildEvent>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"

View File

@ -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)

View File

@ -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<Command> ProcessCommand(Event E, Command C)
override public async Task<Command> 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();
@ -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, "<i>DISCONNECTED</i>", 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<string>("g_gametype")).Value.StripColors();
Hostname = (await this.GetDvarAsync<string>("sv_hostname")).Value.StripColors();
FSGame = (await this.GetDvarAsync<string>("fs_game")).Value.StripColors();

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -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;

View File

@ -100,19 +100,6 @@ namespace SharedLibrary
Owner = S;
}
public Command isValidCMD(List<Command> 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

Binary file not shown.

View File

@ -186,7 +186,7 @@ namespace SharedLibrary
/// <param name="E">Event parameter</param>
/// <param name="C">Command requested from the event</param>
/// <returns></returns>
abstract public Task<Command> ProcessCommand(Event E, Command C);
abstract public Task<Command> ValidateCommand(Event E);
virtual public Task ProcessUpdatesAsync(CancellationToken cts)
{
@ -220,6 +220,9 @@ namespace SharedLibrary
/// <param name="Message">Message to be sent to all players</param>
public async Task Broadcast(String Message)
{
#if DEBUG
return;
#endif
await this.ExecuteCommandAsync($"sayraw {Message}");
}
@ -230,6 +233,9 @@ namespace SharedLibrary
/// <param name="Target">Player to send message to</param>
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");

View File

@ -12,6 +12,8 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -53,8 +55,9 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\Admin\lib\System.Data.SQLite.dll</HintPath>
<Reference Include="System.Data.SQLite, Version=1.0.105.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.105.1\lib\net45\System.Data.SQLite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -93,15 +96,31 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="SQLite.Interop.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>mkdir "$(SolutionDir)Admin\$(OutDir)plugins
<PostBuildEvent>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"</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.105.1" targetFramework="net45" />
</packages>