private static IPEndPoint ParseLocalConnectionInformation(string line)
{
StringParser parser = new StringParser(line, ' ', skipEmpty: true);
parser.MoveNextOrFail(); // skip Index
string localAddressAndPort = parser.MoveAndExtractNext();
int indexOfColon = localAddressAndPort.IndexOf(':');
if (indexOfColon == -1)
{
throw ExceptionHelper.CreateForParseFailure();
}
string remoteAddressString = localAddressAndPort.Substring(0, indexOfColon);
IPAddress localIPAddress = ParseHexIPAddress(remoteAddressString);
string portString = localAddressAndPort.Substring(indexOfColon + 1, localAddressAndPort.Length - (indexOfColon + 1));
int localPort;
if (!int.TryParse(portString, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out localPort))
{
throw ExceptionHelper.CreateForParseFailure();
}
return new IPEndPoint(localIPAddress, localPort);
}