Example #1
0
        public static void setInRamCache(
            string ip_address,
            string country,
            string city,
            string carrier,
            string organization,
            string ccode,
            string state,
            string sld)
        {
            ISPdatatable cacheElementsClass = new ISPdatatable();
            //получаем long ip
            long longIp = mgtCore.IPToLong(ip_address);

            //получаем из long ip обычный по маске 24 путем вычитания из long IP остатка от деления на 256
            ip_address = mgtCore.LongToIP(longIp - (longIp % 256));

            //вносим ip *.*.*.0
            cacheElementsClass.ip           = ip_address;
            cacheElementsClass.country      = country;
            cacheElementsClass.city         = city;
            cacheElementsClass.carrier      = carrier;
            cacheElementsClass.organization = organization;
            cacheElementsClass.ccode        = ccode;
            cacheElementsClass.state        = state;
            cacheElementsClass.sld          = sld;
            cacheList.Add(cacheElementsClass);
        }
Example #2
0
 private static bool findIp(ISPdatatable dbtable, string ip)
 {
     if (dbtable.ip == ip)
     {
         return(true);
     }
     {
         return(false);
     }
 }