fix issue with PT6 guid parsing in log file
This commit is contained in:
parent
fa8dbe7988
commit
7e3f632399
@ -95,7 +95,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
|
|
||||||
if (message.Length > 0)
|
if (message.Length > 0)
|
||||||
{
|
{
|
||||||
long originId = matchResult.Groups[Configuration.Say.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong();
|
long originId = matchResult.Groups[Configuration.Say.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(Configuration.GuidNumberStyle);
|
||||||
|
|
||||||
if (message[0] == '!' || message[0] == '@')
|
if (message[0] == '!' || message[0] == '@')
|
||||||
{
|
{
|
||||||
@ -129,8 +129,8 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
|
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
long originId = match.Groups[Configuration.Kill.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].Value.ToString().ConvertGuidToLong(1);
|
long originId = match.Groups[Configuration.Kill.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].Value.ToString().ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
long targetId = match.Groups[Configuration.Kill.GroupMapping[ParserRegex.GroupType.TargetNetworkId]].Value.ToString().ConvertGuidToLong(1);
|
long targetId = match.Groups[Configuration.Kill.GroupMapping[ParserRegex.GroupType.TargetNetworkId]].Value.ToString().ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
|
|
||||||
return new GameEvent()
|
return new GameEvent()
|
||||||
{
|
{
|
||||||
@ -149,8 +149,8 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
|
|
||||||
if (regexMatch.Success)
|
if (regexMatch.Success)
|
||||||
{
|
{
|
||||||
long originId = regexMatch.Groups[Configuration.Damage.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(1);
|
long originId = regexMatch.Groups[Configuration.Damage.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
long targetId = regexMatch.Groups[Configuration.Damage.GroupMapping[ParserRegex.GroupType.TargetNetworkId]].ToString().ConvertGuidToLong(1);
|
long targetId = regexMatch.Groups[Configuration.Damage.GroupMapping[ParserRegex.GroupType.TargetNetworkId]].ToString().ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
|
|
||||||
return new GameEvent()
|
return new GameEvent()
|
||||||
{
|
{
|
||||||
@ -179,7 +179,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
{
|
{
|
||||||
Name = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginName]].ToString(),
|
Name = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginName]].ToString(),
|
||||||
},
|
},
|
||||||
NetworkId = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(),
|
NetworkId = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(Configuration.GuidNumberStyle),
|
||||||
ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()),
|
ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()),
|
||||||
State = EFClient.ClientState.Connecting,
|
State = EFClient.ClientState.Connecting,
|
||||||
},
|
},
|
||||||
@ -204,7 +204,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
{
|
{
|
||||||
Name = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginName]].ToString()
|
Name = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginName]].ToString()
|
||||||
},
|
},
|
||||||
NetworkId = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(),
|
NetworkId = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(Configuration.GuidNumberStyle),
|
||||||
ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()),
|
ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()),
|
||||||
State = EFClient.ClientState.Disconnecting
|
State = EFClient.ClientState.Disconnecting
|
||||||
},
|
},
|
||||||
@ -248,7 +248,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
{
|
{
|
||||||
Type = GameEvent.EventType.JoinTeam,
|
Type = GameEvent.EventType.JoinTeam,
|
||||||
Data = logLine,
|
Data = logLine,
|
||||||
Origin = new EFClient() { NetworkId = lineSplit[1].ConvertGuidToLong() },
|
Origin = new EFClient() { NetworkId = lineSplit[1].ConvertGuidToLong(Configuration.GuidNumberStyle) },
|
||||||
RequiredEntity = GameEvent.EventRequiredEntity.Target
|
RequiredEntity = GameEvent.EventRequiredEntity.Target
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -257,8 +257,8 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
if (eventType == "ScriptKill")
|
if (eventType == "ScriptKill")
|
||||||
{
|
{
|
||||||
|
|
||||||
long originId = lineSplit[1].ConvertGuidToLong(1);
|
long originId = lineSplit[1].ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
long targetId = lineSplit[2].ConvertGuidToLong(1);
|
long targetId = lineSplit[2].ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
|
|
||||||
return new GameEvent()
|
return new GameEvent()
|
||||||
{
|
{
|
||||||
@ -273,8 +273,8 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
// this is a custom event printed out by _customcallbacks.gsc (used for anticheat)
|
// this is a custom event printed out by _customcallbacks.gsc (used for anticheat)
|
||||||
if (eventType == "ScriptDamage")
|
if (eventType == "ScriptDamage")
|
||||||
{
|
{
|
||||||
long originId = lineSplit[1].ConvertGuidToLong(1);
|
long originId = lineSplit[1].ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
long targetId = lineSplit[2].ConvertGuidToLong(1);
|
long targetId = lineSplit[2].ConvertGuidToLong(Configuration.GuidNumberStyle, 1);
|
||||||
|
|
||||||
return new GameEvent()
|
return new GameEvent()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
@ -15,5 +16,6 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
public ParserRegex Kill { get; set; } = new ParserRegex();
|
public ParserRegex Kill { get; set; } = new ParserRegex();
|
||||||
public ParserRegex Damage { get; set; } = new ParserRegex();
|
public ParserRegex Damage { get; set; } = new ParserRegex();
|
||||||
public ParserRegex Action { get; set; } = new ParserRegex();
|
public ParserRegex Action { get; set; } = new ParserRegex();
|
||||||
|
public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ namespace IW4MAdmin.Application.RconParsers
|
|||||||
long networkId;
|
long networkId;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
networkId = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConNetworkId]].Value.ConvertGuidToLong();
|
networkId = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConNetworkId]].Value.ConvertGuidToLong(Configuration.GuidNumberStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
using SharedLibraryCore.RCon;
|
using SharedLibraryCore.RCon;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace IW4MAdmin.Application.RconParsers
|
namespace IW4MAdmin.Application.RconParsers
|
||||||
{
|
{
|
||||||
@ -15,5 +16,6 @@ namespace IW4MAdmin.Application.RconParsers
|
|||||||
public ParserRegex Dvar { get; set; } = new ParserRegex();
|
public ParserRegex Dvar { get; set; } = new ParserRegex();
|
||||||
public string ServerNotRunningResponse { get; set; }
|
public string ServerNotRunningResponse { get; set; }
|
||||||
public bool WaitForResponse { get; set; } = true;
|
public bool WaitForResponse { get; set; } = true;
|
||||||
|
public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ var eventParser;
|
|||||||
|
|
||||||
var plugin = {
|
var plugin = {
|
||||||
author: 'RaidMax, Xerxes',
|
author: 'RaidMax, Xerxes',
|
||||||
version: 0.4,
|
version: 0.5,
|
||||||
name: 'Plutonium T6 Parser',
|
name: 'Plutonium T6 Parser',
|
||||||
isParser: true,
|
isParser: true,
|
||||||
|
|
||||||
@ -35,6 +35,7 @@ var plugin = {
|
|||||||
rconParser.Configuration.Status.AddMapping(105, 6);
|
rconParser.Configuration.Status.AddMapping(105, 6);
|
||||||
|
|
||||||
eventParser.Configuration.GameDirectory = 't6r\\data';
|
eventParser.Configuration.GameDirectory = 't6r\\data';
|
||||||
|
eventParser.Configuration.GuidNumberStyle = 7; // Integer
|
||||||
|
|
||||||
rconParser.Version = 'Call of Duty Multiplayer - Ship COD_T6_S MP build 1.0.44 CL(1759941) CODPCAB2 CEG Fri May 9 19:19:19 2014 win-x86 813e66d5';
|
rconParser.Version = 'Call of Duty Multiplayer - Ship COD_T6_S MP build 1.0.44 CL(1759941) CODPCAB2 CEG Fri May 9 19:19:19 2014 win-x86 813e66d5';
|
||||||
rconParser.GameName = 7; // T6
|
rconParser.GameName = 7; // T6
|
||||||
|
@ -88,7 +88,7 @@ namespace SharedLibraryCore
|
|||||||
if (clientId > 0)
|
if (clientId > 0)
|
||||||
{
|
{
|
||||||
Client.ClientId = clientId;
|
Client.ClientId = clientId;
|
||||||
Client.NetworkId = clientId == 1 ? 0 : User.Claims.First(_claim => _claim.Type == ClaimTypes.PrimarySid).Value.ConvertGuidToLong();
|
Client.NetworkId = clientId == 1 ? 0 : User.Claims.First(_claim => _claim.Type == ClaimTypes.PrimarySid).Value.ConvertGuidToLong(System.Globalization.NumberStyles.HexNumber);
|
||||||
Client.Level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), User.Claims.First(c => c.Type == ClaimTypes.Role).Value);
|
Client.Level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), User.Claims.First(c => c.Type == ClaimTypes.Role).Value);
|
||||||
Client.CurrentAlias = new EFAlias() { Name = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value };
|
Client.CurrentAlias = new EFAlias() { Name = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value };
|
||||||
Authorized = Client.ClientId >= 0;
|
Authorized = Client.ClientId >= 0;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace SharedLibraryCore.Interfaces
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace SharedLibraryCore.Interfaces
|
||||||
{
|
{
|
||||||
public interface IEventParserConfiguration
|
public interface IEventParserConfiguration
|
||||||
{
|
{
|
||||||
@ -6,29 +8,40 @@
|
|||||||
/// stores the fs_game directory (this folder may vary between different clients)
|
/// stores the fs_game directory (this folder may vary between different clients)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string GameDirectory { get; set; }
|
string GameDirectory { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// stores the regex information for a say event printed in the game log
|
/// stores the regex information for a say event printed in the game log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParserRegex Say { get; set; }
|
ParserRegex Say { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// stores the regex information for a join event printed in the game log
|
/// stores the regex information for a join event printed in the game log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParserRegex Join { get; set; }
|
ParserRegex Join { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// stores the regex information for a quit event printed in the game log
|
/// stores the regex information for a quit event printed in the game log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParserRegex Quit { get; set; }
|
ParserRegex Quit { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// stores the regex information for a kill event printed in the game log
|
/// stores the regex information for a kill event printed in the game log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParserRegex Kill { get; set; }
|
ParserRegex Kill { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// stores the regex information for a damage event printed in the game log
|
/// stores the regex information for a damage event printed in the game log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParserRegex Damage { get; set; }
|
ParserRegex Damage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// stores the regex information for an action event printed in the game log
|
/// stores the regex information for an action event printed in the game log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParserRegex Action { get; set; }
|
ParserRegex Action { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// indicates the format expected for parsed guids
|
||||||
|
/// </summary>
|
||||||
|
NumberStyles GuidNumberStyle { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using SharedLibraryCore.RCon;
|
using SharedLibraryCore.RCon;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace SharedLibraryCore.Interfaces
|
namespace SharedLibraryCore.Interfaces
|
||||||
{
|
{
|
||||||
@ -34,5 +35,10 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
/// when executing a command
|
/// when executing a command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool WaitForResponse { get; set; }
|
bool WaitForResponse { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// indicates the format expected for parsed guids
|
||||||
|
/// </summary>
|
||||||
|
NumberStyles GuidNumberStyle { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ namespace SharedLibraryCore.Services
|
|||||||
long? networkId = null;
|
long? networkId = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
networkId = identifier.ConvertGuidToLong();
|
networkId = identifier.ConvertGuidToLong(System.Globalization.NumberStyles.HexNumber);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ namespace SharedLibraryCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long ConvertGuidToLong(this string str, long? fallback = null)
|
public static long ConvertGuidToLong(this string str, NumberStyles numberStyle, long? fallback = null)
|
||||||
{
|
{
|
||||||
str = str.Substring(0, Math.Min(str.Length, 19));
|
str = str.Substring(0, Math.Min(str.Length, 19));
|
||||||
var bot = Regex.Match(str, @"bot[0-9]+").Value;
|
var bot = Regex.Match(str, @"bot[0-9]+").Value;
|
||||||
@ -291,20 +291,24 @@ namespace SharedLibraryCore
|
|||||||
return fallback.Value;
|
return fallback.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a special case for Plutonium T6 and CoD4x
|
long id = 0;
|
||||||
if (long.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out long id))
|
|
||||||
|
if (numberStyle == NumberStyles.Integer)
|
||||||
{
|
{
|
||||||
|
long.TryParse(str, numberStyle, CultureInfo.InvariantCulture, out id);
|
||||||
|
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
{
|
{
|
||||||
id = (uint)id;
|
id = (uint)id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (long.TryParse(str.Length > 16 ? str.Substring(0, 16) : str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id))
|
else
|
||||||
{
|
{
|
||||||
|
long.TryParse(str.Length > 16 ? str.Substring(0, 16) : str, numberStyle, CultureInfo.InvariantCulture, out id);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!string.IsNullOrEmpty(bot))
|
if (!string.IsNullOrEmpty(bot))
|
||||||
{
|
{
|
||||||
id = -1;
|
id = -1;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user