fix issue with log reader

fix issue with searching names on webfront that could be parsed to hex
This commit is contained in:
RaidMax 2019-08-01 19:42:44 -05:00
parent 034d887abd
commit 1c66ac9117
4 changed files with 10 additions and 13 deletions

View File

@ -55,7 +55,9 @@ namespace IW4MAdmin.Application.IO
long fileSize = _reader.Length; long fileSize = _reader.Length;
if (previousFileSize == 0) if (previousFileSize == 0)
{
previousFileSize = fileSize; previousFileSize = fileSize;
}
long fileDiff = fileSize - previousFileSize; long fileDiff = fileSize - previousFileSize;
@ -63,9 +65,7 @@ namespace IW4MAdmin.Application.IO
if (fileDiff < 1 && fileSize != -1) if (fileDiff < 1 && fileSize != -1)
return; return;
previousFileSize = fileSize; var events = await _reader.ReadEventsFromLog(_server, fileDiff, previousFileSize);
var events = await _reader.ReadEventsFromLog(_server, fileDiff, fileSize - fileDiff);
foreach (var ev in events) foreach (var ev in events)
{ {

View File

@ -39,7 +39,7 @@ namespace IW4MAdmin.Application.IO
using (var rd = new StreamReader(new FileStream(LogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Utilities.EncodingType)) using (var rd = new StreamReader(new FileStream(LogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Utilities.EncodingType))
{ {
char[] buff = new char[fileSizeDiff]; char[] buff = new char[fileSizeDiff];
rd.BaseStream.Seek(-fileSizeDiff, SeekOrigin.End); rd.BaseStream.Seek(startPosition, SeekOrigin.Begin);
await rd.ReadAsync(buff, 0, (int)fileSizeDiff); await rd.ReadAsync(buff, 0, (int)fileSizeDiff);
var stringBuilder = new StringBuilder(); var stringBuilder = new StringBuilder();

View File

@ -100,6 +100,10 @@ namespace IW4MAdmin.Plugins.Stats
await Manager.AddStandardKill(E.Origin, E.Target); await Manager.AddStandardKill(E.Origin, E.Target);
} }
else
{
throw new Exception();
}
break; break;
case GameEvent.EventType.Damage: case GameEvent.EventType.Damage:
if (!E.Owner.CustomCallback && !ShouldIgnoreEvent(E.Origin, E.Target)) if (!E.Owner.CustomCallback && !ShouldIgnoreEvent(E.Origin, E.Target))

View File

@ -489,15 +489,8 @@ namespace SharedLibraryCore.Services
var iqClients = context.Clients var iqClients = context.Clients
.Where(_client => _client.Active); .Where(_client => _client.Active);
if (networkId.HasValue)
{ iqClients = iqClients.Where(_client => networkId == _client.NetworkId || linkIds.Contains(_client.AliasLinkId));
iqClients = iqClients.Where(_client => networkId.Value == _client.NetworkId);
}
else
{
iqClients = iqClients.Where(_client => linkIds.Contains(_client.AliasLinkId));
}
// we want to project our results // we want to project our results
var iqClientProjection = iqClients.OrderByDescending(_client => _client.LastConnection) var iqClientProjection = iqClients.OrderByDescending(_client => _client.LastConnection)