Пример #1
0
        public bool ComapreIPGWNet(IPAddress mask, IPAddress gw)
        {
            if (!mask.SubnetMaskValidation())
            {
                throw new Exception(ClientServiceLocator.GetService <ILanguage>().GetText("NonValidSubNetMask"));
            }

            IPAddress gwNet = gw & mask;
            IPAddress ipNet = this & mask;

            return(gwNet.Compare(ipNet));
        }
Пример #2
0
        public bool ValidateIPWithMask(IPAddress mask)
        {
            if (!mask.SubnetMaskValidation())
            {
                throw new Exception(ClientServiceLocator.GetService <ILanguage>().GetText("NonValidSubNetMask"));
            }

            IPAddress negMask   = ~mask;
            IPAddress pcAddress = this & negMask;

            if (pcAddress.IsZero())             //address of network
            {
                return(false);
            }
            IPAddress broadTest = pcAddress ^ negMask;

            return(!broadTest.IsZero());
        }
Пример #3
0
        public bool ValidateIPWithMask(IPAddress mask)
        {
            if (!mask.SubnetMaskValidation())
                throw new Exception(ClientServiceLocator.GetService<ILanguage>().GetText("NonValidSubNetMask"));

            IPAddress negMask = ~mask;
            IPAddress pcAddress = this & negMask;
            if (pcAddress.IsZero()) //address of network
                return false;
            IPAddress broadTest = pcAddress ^ negMask;
            return !broadTest.IsZero();
        }
Пример #4
0
        public bool ComapreIPGWNet(IPAddress mask, IPAddress gw)
        {
            if (!mask.SubnetMaskValidation())
                throw new Exception(ClientServiceLocator.GetService<ILanguage>().GetText("NonValidSubNetMask"));

            IPAddress gwNet = gw & mask;
            IPAddress ipNet = this & mask;

            return gwNet.Compare(ipNet);
        }