public static bool TryParse(string text, out Host host) { string[] t = text.Split(':'); if ((t.Length == 2) && IP.TryParse(t[0], out IP ip) && int.TryParse(t[1], out int port)) { host = new Host(ip, port); return(true); } else { host = Host.None(0); return(false); } }
public static bool TryParse(string text, out IP ip) { string[] t = text.Split('.'); if (t.Length == 4 && byte.TryParse(t[0], out byte a) && byte.TryParse(t[1], out byte b) && byte.TryParse(t[2], out byte c) && byte.TryParse(t[3], out byte d)) { ip = new IP(a, b, c, d); return(true); } else { ip = Local; return(false); } }
public override int GetHashCode() => IP.GetHashCode() * 65536 + Port;
public static bool TryParse(JIP j, out IP sid) => IP.TryParse(j, out sid);
public static JIP Value(IP ip) => new JIP(ip);