Provides a structure for storing and comparing IP addresses and ranges.
Inheritance: IXmlConvertible
Esempio n. 1
0
 /// <summary>
 /// Compares this ip address with another ip address.
 /// </summary>
 /// <param name="other">The ip address to compare this ip address with.</param>
 /// <returns>
 /// <c>true</c> if the two addresses are equal; otherwise <c>false</c>.
 /// </returns>
 public bool Equals(IpAddress other)
 {
     return
         object.Equals(other.Address, this.Address) &&
         object.Equals(other.To, this.To);
 }
        /// <inheritdoc/>
        public void Parse(XmlElement configuration)
        {
            foreach (XmlElement element in configuration.SelectNodes("p:addresses/p:developers/p:ip", XmlNamespaces.Manager))
            {
                if (element.GetAttribute("address") == "*")
                {
                    allDeveloper = true;
                    continue;
                }

                var address = new IpAddress(element);
                if (!developerIPs.Contains(address))
                    developerIPs.Add(address);
            }

            foreach (XmlElement element in configuration.SelectNodes("p:addresses/p:blocked/p:ip", XmlNamespaces.Manager))
            {
                if (element.GetAttribute("address") == "*")
                {
                    allBlocked = true;
                    continue;
                }

                var address = new IpAddress(element);
                if (!blockedIPs.Contains(address))
                    blockedIPs.Add(address);
            }
        }