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

Player search not showing duplicates anymore

removed extra information on player search
fixed kdr innaccuracy on profile page
shortened cache-length
This commit is contained in:
RaidMax
2018-02-16 22:24:03 -06:00
parent 89cfb80798
commit 0752013fdf
19 changed files with 10840 additions and 253 deletions

View File

@ -942,7 +942,7 @@ namespace SharedLibrary.Commands
inactiveUsers.ForEach(c => c.Level = Player.Permission.User);
await context.SaveChangesAsync();
}
await E.Origin.Tell($"Pruned inactive {inactiveUsers.Count} privileged users");
await E.Origin.Tell($"Pruned {inactiveUsers.Count} inactive privileged users");
}
}

View File

@ -46,7 +46,6 @@ namespace SharedLibrary.Database
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
// todo: custom load DBSets from plugins
// https://aleemkhan.wordpress.com/2013/02/28/dynamically-adding-dbset-properties-in-dbcontext-for-entity-framework-code-first/
foreach (string dllPath in System.IO.Directory.GetFiles($"{Environment.CurrentDirectory}{System.IO.Path.DirectorySeparatorChar}Plugins"))
{

View File

@ -10,7 +10,7 @@ namespace SharedLibrary
public class RemoteFile : IFile
{
string Location;
string[] FileCache;
string[] FileCache = new string[0];
public RemoteFile(string location) : base(string.Empty)
{
@ -25,7 +25,7 @@ namespace SharedLibrary
public override string[] Tail(int lineCount)
{
Retrieve();
// Retrieve();
return FileCache;
}

View File

@ -194,6 +194,25 @@ namespace SharedLibrary.Services
.ToListAsync();
}
public async Task<bool> IsAuthenticated(int clientIP)
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
var iqMatching = from alias in context.Aliases
where alias.IPAddress == clientIP
join client in context.Clients
on alias.LinkId equals client.AliasLinkId
where client.Level > Player.Permission.Trusted
select client;
return (await iqMatching.CountAsync()) > 0;
}
}
public async Task<IList<EFClient>> GetPrivilegedClients()
{
using (var context = new DatabaseContext())
@ -228,6 +247,7 @@ namespace SharedLibrary.Services
.AsNoTracking()
on alias.LinkId equals client.AliasLinkId
select client)
.Distinct()
.Include(c => c.CurrentAlias)
.Include(c => c.AliasLink.Children);

View File

@ -77,7 +77,7 @@
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
@ -152,6 +152,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>move "$(TargetDir)Newtonsoft.Json.dll" "$(TargetDir)lib\Newtonsoft.Json.dll"
move "$(TargetDir)Newtonsoft.Json.dll" "$(SolutionDir)BUILD\Lib\Newtonsoft.Json.dll"
copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\lib"
copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)Admin\lib"
copy /Y "$(TargetDir)Newtonsoft.Json.dll" "$(SolutionDir)BUILD\lib"
@ -159,7 +160,10 @@ copy /Y "$(TargetDir)Newtonsoft.Json.dll" "$(SolutionDir)Admin\lib"
if not exist "$(TargetDir)x86" md "$(TargetDir)x86"
xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\x86\*.*" "$(TargetDir)x86"
if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64"
xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64"</PostBuildEvent>
xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64"
xcopy /Y /I /E "$(TargetDir)*" "$(SolutionDir)BUILD\Lib"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>if exist "$(SolutionDir)BUILD\Plugins" rmdir /Q /S "$(SolutionDir)BUILD\Plugins"

View File

@ -199,12 +199,29 @@ namespace SharedLibrary
public static long ConvertLong(this string str)
{
return Int64.Parse(str, System.Globalization.NumberStyles.HexNumber);
try
{
return Int64.Parse(str, System.Globalization.NumberStyles.HexNumber);
}
catch (FormatException)
{
return -1;
}
}
public static int ConvertToIP(this string str)
{
return BitConverter.ToInt32(System.Net.IPAddress.Parse(str).GetAddressBytes(), 0);
try
{
return BitConverter.ToInt32(System.Net.IPAddress.Parse(str).GetAddressBytes(), 0);
}
catch (FormatException)
{
return 0;
}
}
public static string ConvertIPtoString(this int ip)