1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

added console page back

This commit is contained in:
RaidMax
2018-02-23 01:06:13 -06:00
parent 8368add46a
commit 5f18972209
16 changed files with 195 additions and 34 deletions

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
{
public class CommandResponseInfo
{
public string Response { get; set; }
public int ClientId { get; set; }
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Helpers
{
public class CommandResult
{
public string Message { get; set; }
public int Clientd { get; set; }
}
}

View File

@ -10,6 +10,7 @@ using SharedLibrary.Commands;
using System.Threading.Tasks;
using SharedLibrary.Helpers;
using SharedLibrary.Objects;
using SharedLibrary.Dtos;
namespace SharedLibrary
{
@ -171,12 +172,12 @@ namespace SharedLibrary
Console.WriteLine(Utilities.StripColors(Message));
Console.ForegroundColor = ConsoleColor.Gray;
}
if (commandResult.Count > 15)
commandResult.RemoveAt(0);
commandResult.Add(new CommandResult()
if (CommandResult.Count > 15)
CommandResult.RemoveAt(0);
CommandResult.Add(new CommandResponseInfo()
{
Message = Utilities.StripColors(Message),
Clientd = Target.ClientId
Response = Utilities.StripColors(Message),
ClientId = Target.ClientId
});
}
@ -398,6 +399,6 @@ namespace SharedLibrary
protected DateTime LastPoll;
//Remote
public IList<CommandResult> commandResult = new List<CommandResult>();
public IList<CommandResponseInfo> CommandResult = new List<CommandResponseInfo>();
}
}

View File

@ -57,7 +57,7 @@ namespace SharedLibrary.Services
// set the level to the level of the existing client if they have the same IP + Name but new NetworkId
// fixme: issues?
Level = hasExistingAlias ?
context.Clients.First(c => c.AliasLinkId== existingAlias.LinkId).Level :
context.Clients.First(c => c.AliasLinkId == existingAlias.LinkId).Level :
Player.Permission.User,
FirstConnection = DateTime.UtcNow,
Connections = 1,
@ -240,14 +240,39 @@ namespace SharedLibrary.Services
var iqClients = (from alias in context.Aliases
.AsNoTracking()
where alias.Name
.Contains(name)
join link in context.AliasLinks
on alias.LinkId equals link.AliasLinkId
join client in context.Clients
where alias.Name
.Contains(name)
join link in context.AliasLinks
on alias.LinkId equals link.AliasLinkId
join client in context.Clients
.AsNoTracking()
on alias.LinkId equals client.AliasLinkId
select client)
.Distinct()
.Include(c => c.CurrentAlias)
.Include(c => c.AliasLink.Children);
return await iqClients.ToListAsync();
}
}
public async Task<IList<EFClient>> GetClientByIP(int ipAddress)
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
var iqClients = (from alias in context.Aliases
.AsNoTracking()
on alias.LinkId equals client.AliasLinkId
select client)
where alias.IPAddress == ipAddress
join link in context.AliasLinks
on alias.LinkId equals link.AliasLinkId
join client in context.Clients
.AsNoTracking()
on alias.LinkId equals client.AliasLinkId
select client)
.Distinct()
.Include(c => c.CurrentAlias)
.Include(c => c.AliasLink.Children);

View File

@ -151,6 +151,7 @@
<Compile Include="Database\Models\EFClient.cs" />
<Compile Include="Database\Models\EFPenalty.cs" />
<Compile Include="Database\Models\SharedEntity.cs" />
<Compile Include="Dtos\CommandResponseInfo.cs" />
<Compile Include="Dtos\PlayerInfo.cs" />
<Compile Include="Dtos\ClientInfo.cs" />
<Compile Include="Dtos\ProfileMeta.cs" />
@ -164,7 +165,6 @@
<Compile Include="Exceptions\NetworkException.cs" />
<Compile Include="Exceptions\SerializationException.cs" />
<Compile Include="Exceptions\ServerException.cs" />
<Compile Include="Helpers\CommandResult.cs" />
<Compile Include="Helpers\ConfigurationManager.cs" />
<Compile Include="Helpers\ParseEnum.cs" />
<Compile Include="Helpers\Vector3.cs" />

View File

@ -96,7 +96,8 @@ namespace SharedLibrary
{
if (str == null)
return "";
return Regex.Replace(str, @"(\^+((?![a-z]|[A-Z]).){0,1})+", "");
return Regex.Replace(str, @"(\^+((?![a-z]|[A-Z]).){0,1})+", "")
.Replace("/", " /");
}
/// <summary>
@ -346,7 +347,7 @@ namespace SharedLibrary
AliasLink = client.AliasLink,
AliasLinkId = client.AliasLinkId,
ClientId = client.ClientId,
ClientNumber = 0,
ClientNumber = -1,
FirstConnection = client.FirstConnection,
Connections = client.Connections,
NetworkId = client.NetworkId,