fix a small bug with new line truncation missing

This commit is contained in:
RaidMax 2020-02-12 15:11:43 -06:00
parent 68490bde57
commit 2e5ffe91fc
3 changed files with 10 additions and 3 deletions

View File

@ -195,7 +195,7 @@ namespace IW4MAdmin.Application.EventParsers
{
CurrentAlias = new EFAlias()
{
Name = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginName]].ToString(),
Name = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginName]].ToString().TrimNewLine(),
},
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()),
@ -221,7 +221,7 @@ namespace IW4MAdmin.Application.EventParsers
{
CurrentAlias = new EFAlias()
{
Name = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginName]].ToString()
Name = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginName]].ToString().TrimNewLine()
},
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()),

View File

@ -178,7 +178,7 @@ namespace IW4MAdmin.Application.RconParsers
continue;
}
string name = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConName]].Value.Trim();
string name = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConName]].Value.TrimNewLine();
int? ip = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConIpAddress]].Value.Split(':')[0].ConvertToIP();
var client = new EFClient()

View File

@ -831,6 +831,13 @@ namespace SharedLibraryCore
return Regex.IsMatch(message, @"^\u0014(?:[A-Z]|_)+$");
}
/// <summary>
/// trims new line and whitespace from string
/// </summary>
/// <param name="str">source string</param>
/// <returns></returns>
public static string TrimNewLine(this string str) => str.Trim().TrimEnd('\r', '\n');
public static Vector3 FixIW4Angles(this Vector3 vector)
{
float X = vector.X >= 0 ? vector.X : 360.0f + vector.X;