parent
95e4ee672e
commit
1056c7c335
@ -6,7 +6,7 @@
|
|||||||
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
|
||||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
<Version>2.2.5.7</Version>
|
<Version>2.2.5.8</Version>
|
||||||
<Authors>RaidMax</Authors>
|
<Authors>RaidMax</Authors>
|
||||||
<Company>Forever None</Company>
|
<Company>Forever None</Company>
|
||||||
<Product>IW4MAdmin</Product>
|
<Product>IW4MAdmin</Product>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
<TieredCompilation>true</TieredCompilation>
|
<TieredCompilation>true</TieredCompilation>
|
||||||
<AssemblyVersion>2.2.5.7</AssemblyVersion>
|
<AssemblyVersion>2.2.5.8</AssemblyVersion>
|
||||||
<FileVersion>2.2.5.6</FileVersion>
|
<FileVersion>2.2.5.8</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -98,8 +98,8 @@ if "%CurrentConfiguration%" == "Release" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo making start scripts
|
echo making start scripts
|
||||||
@(echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.cmd"
|
@(echo @echo off && echo @title IW4MAdmin && echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.cmd"
|
||||||
@(echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.cmd"
|
@(echo @echo off && echo @title IW4MAdmin && echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.cmd"
|
||||||
|
|
||||||
@(echo #!/bin/bash && echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.sh"
|
@(echo #!/bin/bash && echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.sh"
|
||||||
@(echo #!/bin/bash && echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.sh"
|
@(echo #!/bin/bash && echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.sh"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using SharedLibraryCore.Database.Models;
|
using SharedLibraryCore.Database.Models;
|
||||||
using SharedLibraryCore.Exceptions;
|
using SharedLibraryCore.Exceptions;
|
||||||
using SharedLibraryCore.Objects;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -23,7 +22,9 @@ namespace SharedLibraryCore.Commands
|
|||||||
foreach (Command cmd in Manager.GetCommands())
|
foreach (Command cmd in Manager.GetCommands())
|
||||||
{
|
{
|
||||||
if (cmd.Name == CommandString.ToLower() || cmd.Alias == CommandString.ToLower())
|
if (cmd.Name == CommandString.ToLower() || cmd.Alias == CommandString.ToLower())
|
||||||
|
{
|
||||||
C = cmd;
|
C = cmd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C == null)
|
if (C == null)
|
||||||
@ -34,6 +35,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
|
|
||||||
E.Data = E.Data.RemoveWords(1);
|
E.Data = E.Data.RemoveWords(1);
|
||||||
String[] Args = E.Data.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
String[] Args = E.Data.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
// todo: the code below can be cleaned up
|
||||||
|
|
||||||
if (E.Origin.Level < C.Permission)
|
if (E.Origin.Level < C.Permission)
|
||||||
{
|
{
|
||||||
@ -48,31 +50,36 @@ namespace SharedLibraryCore.Commands
|
|||||||
throw new CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
|
throw new CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C.RequiresTarget || Args.Length > 0)
|
if (C.RequiresTarget)
|
||||||
{
|
{
|
||||||
if (!Int32.TryParse(Args[0], out int cNum))
|
if (Args.Length > 0)
|
||||||
cNum = -1;
|
|
||||||
|
|
||||||
if (Args[0][0] == '@') // user specifying target by database ID
|
|
||||||
{
|
{
|
||||||
int dbID = -1;
|
if (!Int32.TryParse(Args[0], out int cNum))
|
||||||
int.TryParse(Args[0].Substring(1, Args[0].Length - 1), out dbID);
|
|
||||||
|
|
||||||
var found = await Manager.GetClientService().Get(dbID);
|
|
||||||
if (found != null)
|
|
||||||
{
|
{
|
||||||
E.Target = found;
|
cNum = -1;
|
||||||
E.Target.CurrentServer = E.Owner;
|
|
||||||
E.Data = String.Join(" ", Args.Skip(1));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
else if (Args[0].Length < 3 && cNum > -1 && cNum < E.Owner.MaxClients) // user specifying target by client num
|
if (Args[0][0] == '@') // user specifying target by database ID
|
||||||
{
|
|
||||||
if (E.Owner.Clients[cNum] != null)
|
|
||||||
{
|
{
|
||||||
E.Target = E.Owner.Clients[cNum];
|
int dbID = -1;
|
||||||
E.Data = String.Join(" ", Args.Skip(1));
|
int.TryParse(Args[0].Substring(1, Args[0].Length - 1), out dbID);
|
||||||
|
|
||||||
|
var found = await Manager.GetClientService().Get(dbID);
|
||||||
|
if (found != null)
|
||||||
|
{
|
||||||
|
E.Target = found;
|
||||||
|
E.Target.CurrentServer = E.Owner;
|
||||||
|
E.Data = String.Join(" ", Args.Skip(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (Args[0].Length < 3 && cNum > -1 && cNum < E.Owner.MaxClients) // user specifying target by client num
|
||||||
|
{
|
||||||
|
if (E.Owner.Clients[cNum] != null)
|
||||||
|
{
|
||||||
|
E.Target = E.Owner.Clients[cNum];
|
||||||
|
E.Data = String.Join(" ", Args.Skip(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +110,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (E.Target == null && C.RequiresTarget) // Find active player as single word
|
if (E.Target == null && C.RequiresTarget && Args.Length > 0) // Find active player as single word
|
||||||
{
|
{
|
||||||
matchingPlayers = E.Owner.GetClientByName(Args[0]);
|
matchingPlayers = E.Owner.GetClientByName(Args[0]);
|
||||||
if (matchingPlayers.Count > 1)
|
if (matchingPlayers.Count > 1)
|
||||||
@ -115,6 +122,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
}
|
}
|
||||||
throw new CommandException($"{E.Origin} had multiple players found for {C.Name}");
|
throw new CommandException($"{E.Origin} had multiple players found for {C.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchingPlayers.Count == 1)
|
else if (matchingPlayers.Count == 1)
|
||||||
{
|
{
|
||||||
E.Target = matchingPlayers.First();
|
E.Target = matchingPlayers.First();
|
||||||
@ -141,6 +149,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
throw new CommandException($"{E.Origin} specified invalid player for \"{C.Name}\"");
|
throw new CommandException($"{E.Origin} specified invalid player for \"{C.Name}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
E.Data = E.Data.Trim();
|
E.Data = E.Data.Trim();
|
||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,12 @@ namespace SharedLibraryCore.Configuration
|
|||||||
|
|
||||||
public void Build()
|
public void Build()
|
||||||
{
|
{
|
||||||
var configContent = File.ReadAllText(_configurationPath);
|
try
|
||||||
_configuration = JsonConvert.DeserializeObject<T>(configContent);
|
{
|
||||||
|
var configContent = File.ReadAllText(_configurationPath);
|
||||||
if (_configuration == null)
|
_configuration = JsonConvert.DeserializeObject<T>(configContent);
|
||||||
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
_configuration = default(T);
|
_configuration = default(T);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user