2018-04-23 01:43:48 -04:00
|
|
|
|
using SharedLibraryCore;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
using SharedLibraryCore.Objects;
|
2018-04-15 00:26:27 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2018-04-23 01:43:48 -04:00
|
|
|
|
using System.Linq;
|
2018-04-15 00:26:27 -04:00
|
|
|
|
using System.Text;
|
2018-04-23 01:43:48 -04:00
|
|
|
|
using System.Text.RegularExpressions;
|
2018-04-15 00:26:27 -04:00
|
|
|
|
|
2018-04-25 02:38:59 -04:00
|
|
|
|
namespace IW4MAdmin.Application.EventParsers
|
2018-04-15 00:26:27 -04:00
|
|
|
|
{
|
|
|
|
|
class IW5EventParser : IW4EventParser
|
|
|
|
|
{
|
2018-04-23 01:43:48 -04:00
|
|
|
|
public override string GetGameDir() => "logs";
|
|
|
|
|
|
|
|
|
|
public override GameEvent GetEvent(Server server, string logLine)
|
|
|
|
|
{
|
|
|
|
|
string cleanedEventLine = Regex.Replace(logLine, @"[0-9]+:[0-9]+\ ", "").Trim();
|
|
|
|
|
|
|
|
|
|
if (cleanedEventLine.Contains("J;"))
|
|
|
|
|
{
|
|
|
|
|
string[] lineSplit = cleanedEventLine.Split(';');
|
|
|
|
|
|
|
|
|
|
int clientNum = Int32.Parse(lineSplit[2]);
|
|
|
|
|
|
|
|
|
|
var player = new Player()
|
|
|
|
|
{
|
|
|
|
|
NetworkId = lineSplit[1].ConvertLong(),
|
|
|
|
|
ClientNumber = clientNum,
|
|
|
|
|
Name = lineSplit[3]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new GameEvent()
|
|
|
|
|
{
|
|
|
|
|
Type = GameEvent.EventType.Connect,
|
|
|
|
|
Origin = new Player()
|
|
|
|
|
{
|
|
|
|
|
ClientId = 1
|
|
|
|
|
},
|
|
|
|
|
Target = new Player()
|
|
|
|
|
{
|
|
|
|
|
ClientId = 1
|
|
|
|
|
},
|
|
|
|
|
Owner = server,
|
|
|
|
|
Extra = player
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
return base.GetEvent(server, logLine);
|
|
|
|
|
}
|
2018-04-15 00:26:27 -04:00
|
|
|
|
}
|
|
|
|
|
}
|