Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
 public override int GetHashCode() => IP.GetHashCode() * 65536 + Port;
Beispiel #4
0
 public static bool TryParse(JIP j, out IP sid) => IP.TryParse(j, out sid);
Beispiel #5
0
 public static JIP Value(IP ip) => new JIP(ip);