public static IEnumerable<IPAddress> GetIPRange(IPAddress startIP, IPAddress endIP)
 {
     uint sIP = startIP.ToUint();
     uint eIP = endIP.ToUint();
     while (sIP <= eIP)
     {
         yield return new IPAddress(reverseBytesArray(sIP));
         sIP++;
     }
 }
Exemplo n.º 2
0
 public bool Match(IPAddress ip, out string note)
 {
     note = null;
     bool match = false;
     var ipValue = ip.ToUint();
     foreach (var item in _list)
     {
         match = (item.Type == IPItemType.IP)
             ? (ipValue == item.FromIPValue)
             : (ipValue >= item.FromIPValue && ipValue <= item.ToIPValue);
         if (match)
         {
             note = item.Note;
             break;
         }
     }
     return match;
 }