Beispiel #1
0
        private BitVector IpToBitVector(string ip)
        {
            string[] elements;
            if (ip == "::1")
            {
                //IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
                //ip=localIPs[localIPs.Length - 1].ToString();
                //elements = ip.Split('.');
                string testIp = "49.204.0.37";
                elements = testIp.Split('.');
            }
            else
            {
                elements = ip.Split('.');
            }

            BitVector bv = new BitVector();

            foreach (string e in elements)
            {
                if (e != "")
                {
                    int i = Int32.Parse(e);
                    bv.AddData(i, 8);
                }
            }
            return(bv);
        }