예제 #1
0
파일: Host.cs 프로젝트: MGanchkov/Chat
 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);
     }
 }
예제 #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);
     }
 }
예제 #3
0
파일: Host.cs 프로젝트: MGanchkov/Chat
 public override int GetHashCode() => IP.GetHashCode() * 65536 + Port;
예제 #4
0
 public static bool TryParse(JIP j, out IP sid) => IP.TryParse(j, out sid);
예제 #5
0
 public static JIP Value(IP ip) => new JIP(ip);