Fixed truncated ips, thanks regex :)

This commit is contained in:
RaidMax 2017-11-19 01:50:25 -06:00
parent 2aa3aa5baf
commit c56d98d11c
3 changed files with 4 additions and 5 deletions

View File

@ -808,7 +808,7 @@ namespace IW4MAdmin
}; };
if (!recent && individual) if (!recent && individual && authed)
{ {
foreach (var a in ApplicationManager.GetInstance().GetAliases(pp)) foreach (var a in ApplicationManager.GetInstance().GetAliases(pp))
{ {

Binary file not shown.

View File

@ -56,11 +56,10 @@ namespace SharedLibrary
int Ping = -1; int Ping = -1;
Int32.TryParse(playerInfo[2], out Ping); Int32.TryParse(playerInfo[2], out Ping);
String cName = Utilities.StripColors(responseLine.Substring(46, 18)).Trim(); String cName = Utilities.StripColors(responseLine.Substring(46, 18)).Trim();
String npID = responseLine.Substring(29, 17).Trim(); // DONT TOUCH PLZ string npID = Regex.Match(responseLine, @"([a-z]|[0-9]){16}", RegexOptions.IgnoreCase).Value;
int.TryParse(playerInfo[0], out cID); int.TryParse(playerInfo[0], out cID);
String cIP = responseLine.Substring(72, 20).Trim().Split(':')[0]; var regex = Regex.Match(responseLine, @"\d+\.\d+\.\d+.\d+\:\d{1,5}");
if (cIP.Split(' ').Count() > 1) string cIP = regex.Value.Split(':')[0];
cIP = cIP.Split(' ')[1];
Player P = new Player(cName, npID, cID, cIP) { Ping = Ping }; Player P = new Player(cName, npID, cID, cIP) { Ping = Ping };
StatusPlayers.Add(P); StatusPlayers.Add(P);
} }