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;
|
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, 0);
|
|
||||||
|
|
||||||
foreach (var ev in events)
|
foreach (var ev in events)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace IW4MAdmin.Application.IO
|
namespace IW4MAdmin.Application.IO
|
||||||
@ -37,13 +38,28 @@ namespace IW4MAdmin.Application.IO
|
|||||||
// open the file as a stream
|
// open the file as a stream
|
||||||
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))
|
||||||
{
|
{
|
||||||
// take the old start position and go back the number of new characters
|
char[] buff = new char[fileSizeDiff];
|
||||||
rd.BaseStream.Seek(-fileSizeDiff, SeekOrigin.End);
|
rd.BaseStream.Seek(startPosition, SeekOrigin.Begin);
|
||||||
|
await rd.ReadAsync(buff, 0, (int)fileSizeDiff);
|
||||||
|
|
||||||
string newLine;
|
var stringBuilder = new StringBuilder();
|
||||||
while (!string.IsNullOrEmpty(newLine = await rd.ReadLineAsync()))
|
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);
|
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))
|
||||||
|
@ -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.Value == _client.NetworkId);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
iqClients = iqClients.Where(_client => networkId == _client.NetworkId || linkIds.Contains(_client.AliasLinkId));
|
||||||
{
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user