예제 #1
0
        public void CreateTable(string Table, string Format, SxGeoDirType tabletype)
        {
            TableName    = Table;
            RecordFormat = Format;
            TableType    = tabletype;
            SxGeoHeader Header = Database.GetHeader();

            Unpacker = new SxGeoUnpack(RecordFormat,
                                       Header.DBEncoding);

            //добавляем табличку
            SxDS.Tables.Add(TableName);

            Dictionary <string, Type> RecordTypes = Unpacker.GetRecordTypes();

            //добавляем колонки
            foreach (string FieldName in RecordTypes.Keys)
            {
                SxDS.Tables[TableName].Columns.Add(FieldName,
                                                   RecordTypes[FieldName]);
            }

            switch (TableType)
            {
            case SxGeoDirType.Cites:
            {
                TableStart    = Header.cites_begin;
                TableSize     = Header.CitySize;
                MaxRecordSize = Header.MaxCity;
            }; break;

            case SxGeoDirType.Countries:
            {
                TableStart    = Header.countries_begin + 1;     //вот хз почему +1, иначе не работает
                TableSize     = Header.CountrySize;
                MaxRecordSize = Header.MaxCountry;
            }; break;

            case SxGeoDirType.Regions:
            {
                TableStart    = Header.regions_begin + 1;   //вот хз почему +1, иначе не работает
                TableSize     = Header.RegionSize;
                MaxRecordSize = Header.MaxRegion;
            }; break;
            }
        }
예제 #2
0
        private void btnInfo_Click(object sender, EventArgs e)
        {
            SxGeo.OpenDB();
            SxGeo.CloseDB();
            SxGeoHeader Header = SxGeo.GetHeader();

            if (Header.PackFormat == null)
            {
                Header.PackFormat = string.Empty;
            }

            frmInfo fInfo = new frmInfo();

            fInfo.Header = Header;
            fInfo.ShowDialog();
        }