예제 #1
0
        private void rbSxGeoCity_CheckedChanged(object sender, EventArgs e)
        {
            if (rbSxGeoCity.Checked)
            {
                b_cl.dbPath = b_cl.dbDir + b_cl.SxGeoCity;
            }
            else
            {
                b_cl.dbPath = b_cl.dbDir + b_cl.SxGeo;
            }

            SxGeo = new SxGeoDB(b_cl.dbPath);
        }
예제 #2
0
        private ushort MaxRecordSize = 0;    //максимальный размер записи в байтах (MaxRegion и т.д.)


        public SxGToDataSet(DataSet ds, SxGeoDB db)
        {
            SxDS     = ds;
            Database = db;
        }
예제 #3
0
        public Dictionary <string, object> GetIPInfo(string IP)
        {
            Dictionary <string, object> buf = new Dictionary <string, object>();
            string NormalForm = string.Empty;
            string InputIP    = string.Empty;

            if (!IPConverter.IsIP(IP))
            {
                buf.Add("ip", IP);
                buf.Add("status", "ERROR: Not valid IP address");
                return(buf);
            }
            SxGeoDB db = new SxGeoDB(DatabasePath);

            db.DatabaseMode = SxGeoMode.FileMode;
            if (!db.OpenDB())
            {
                buf.Add("status", "ERROR: " + db.ErrorMessage);
                return(buf);
            }

            NormalForm = IPConverter.ToStandForm(IP);
            if (NormalForm != IP)
            {
                InputIP = IP;
                IP      = NormalForm;
            }

            string spec = CheckSpecDiaps(IP);

            if (spec != string.Empty)
            {
                buf.Add("ip", IP);
                if (InputIP != string.Empty)
                {
                    buf.Add("input_ip", InputIP);
                }
                buf.Add("status", "WARNING: " + spec);
                return(buf);
            }

            buf = db.GetIPInfo(IP, SxGeoInfoType.FullInfo);
            if (buf == null)
            {
                buf = new Dictionary <string, object>();
                buf.Add("ip", IP);
                if (InputIP != string.Empty)
                {
                    buf.Add("input_ip", InputIP);
                }
                buf.Add("status", db.ErrorMessage);
                return(buf);
            }

            if (InputIP != string.Empty)
            {
                buf.Add("input_ip", InputIP);
            }
            buf.Add("status", "OK");
            db.CloseDB();

            return(buf);
        }
예제 #4
0
 private void frmMain_Load(object sender, EventArgs e)
 {
     SxGeo = new SxGeoDB(b_cl.dbPath);
 }