Merge branch '2.3' into 2.4-pr
This commit is contained in:
commit
dfecb99d07
@ -55,7 +55,9 @@ namespace IW4MAdmin.Application.IO
|
||||
long fileSize = _reader.Length;
|
||||
|
||||
if (previousFileSize == 0)
|
||||
{
|
||||
previousFileSize = fileSize;
|
||||
}
|
||||
|
||||
long fileDiff = fileSize - previousFileSize;
|
||||
|
||||
@ -63,9 +65,7 @@ namespace IW4MAdmin.Application.IO
|
||||
if (fileDiff < 1 && fileSize != -1)
|
||||
return;
|
||||
|
||||
previousFileSize = fileSize;
|
||||
|
||||
var events = await _reader.ReadEventsFromLog(_server, fileDiff, 0);
|
||||
var events = await _reader.ReadEventsFromLog(_server, fileDiff, previousFileSize);
|
||||
|
||||
foreach (var ev in events)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IW4MAdmin.Application.IO
|
||||
@ -37,13 +38,28 @@ namespace IW4MAdmin.Application.IO
|
||||
// open the file as a stream
|
||||
using (var rd = new StreamReader(new FileStream(LogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Utilities.EncodingType))
|
||||
{
|
||||
// take the old start position and go back the number of new characters
|
||||
rd.BaseStream.Seek(-fileSizeDiff, SeekOrigin.End);
|
||||
char[] buff = new char[fileSizeDiff];
|
||||
rd.BaseStream.Seek(startPosition, SeekOrigin.Begin);
|
||||
await rd.ReadAsync(buff, 0, (int)fileSizeDiff);
|
||||
|
||||
string newLine;
|
||||
while (!string.IsNullOrEmpty(newLine = await rd.ReadLineAsync()))
|
||||
var stringBuilder = new StringBuilder();
|
||||
foreach (char c in buff)
|
||||
{
|
||||
logLines.Add(newLine);
|
||||
if (c == '\n')
|
||||
{
|
||||
logLines.Add(stringBuilder.ToString());
|
||||
stringBuilder = new StringBuilder();
|
||||
}
|
||||
|
||||
else if (c != '\r')
|
||||
{
|
||||
stringBuilder.Append(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
logLines.Add(stringBuilder.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,10 @@ namespace IW4MAdmin.Plugins.Stats
|
||||
|
||||
await Manager.AddStandardKill(E.Origin, E.Target);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
break;
|
||||
case GameEvent.EventType.Damage:
|
||||
if (!E.Owner.CustomCallback && !ShouldIgnoreEvent(E.Origin, E.Target))
|
||||
|
@ -489,15 +489,8 @@ namespace SharedLibraryCore.Services
|
||||
var iqClients = context.Clients
|
||||
.Where(_client => _client.Active);
|
||||
|
||||
if (networkId.HasValue)
|
||||
{
|
||||
iqClients = iqClients.Where(_client => networkId.Value == _client.NetworkId);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
iqClients = iqClients.Where(_client => linkIds.Contains(_client.AliasLinkId));
|
||||
}
|
||||
iqClients = iqClients.Where(_client => networkId == _client.NetworkId || linkIds.Contains(_client.AliasLinkId));
|
||||
|
||||
// we want to project our results
|
||||
var iqClientProjection = iqClients.OrderByDescending(_client => _client.LastConnection)
|
||||
|
Loading…
Reference in New Issue
Block a user