private static bool TryParseIPNetwork(string ip, CidrParseEnum cidrParseEnum, byte cidr, out IPNetwork ipn) { IPNetwork ipnetwork = null; if (cidrParseEnum == CidrParseEnum.Default) { if (!IPNetwork.TryParse(ip, out ipnetwork)) { ipn = null; return(false); } } else if (cidrParseEnum == CidrParseEnum.Value) { if (!IPNetwork.TryParse(ip, cidr, out ipnetwork)) { if (!IPNetwork.TryParse(ip, out ipnetwork)) { ipn = null; return(false); } } } ipn = ipnetwork; return(true); }
private static bool TryParseIPNetwork(string ip, CidrParseEnum cidrParseEnum, byte cidr, out IPNetwork ipn) { IPNetwork ipnetwork = null; if (cidrParseEnum == CidrParseEnum.Default) { if (!IPNetwork.TryParse(ip, out ipnetwork)) { ipn = null; return false; } } else if (cidrParseEnum == CidrParseEnum.Value) { if (!IPNetwork.TryParse(ip, cidr, out ipnetwork)) { if (!IPNetwork.TryParse(ip, out ipnetwork)) { ipn = null; return false; } } } ipn = ipnetwork; return true; }