System.Net.NetworkInformation.MibIPGlobalProperties.ToEndpoint C# (CSharp) Method

ToEndpoint() private method

private ToEndpoint ( string s ) : IPEndPoint
s string
return IPEndPoint
		IPEndPoint ToEndpoint (string s)
		{
			int idx = s.IndexOf (':');
			int port = int.Parse (s.Substring (idx + 1), NumberStyles.HexNumber);
			if (s.Length == 13)
				return new IPEndPoint (long.Parse (s.Substring (0, idx), NumberStyles.HexNumber), port);
			else {
				byte [] bytes = new byte [16];
				for (int i = 0; (i << 1) < idx; i++)
					bytes [i] = byte.Parse (s.Substring (i << 1, 2), NumberStyles.HexNumber);
				return new IPEndPoint (new IPAddress (bytes), port);
			}
		}