예제 #1
0
        public static DLong GetAttributeDlong(Attributes.attr attrib)
        {
            if (attributeLookup == null)
                ini();

            int Id = 0;
            attributeLookup.TryGetValue(attrib, out Id);

            return DLong.shift(Id);

        }
예제 #2
0
        protected override void ExportMethod()
        {
            int max   = _gcList.Count * 3; //caches, waypoints, logs
            int index = 0;

            using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_EXPORTINGCB, STR_CREATINGFILE, max, 0))
            {
                string cbFile = System.IO.Path.Combine(_folder, "cachebox.db3");

                if (System.IO.File.Exists(cbFile))
                {
                    System.IO.File.Delete(cbFile);
                }
                CreateDatabase(cbFile);

                if (_dbcon != null)
                {
                    int    fixedCatId       = 1;
                    string fixedGpxFilename = "12345678.gpx";

                    _dbcon.ExecuteNonQuery("PRAGMA user_version = 1022");

                    _dbcon.ExecuteNonQuery(string.Format("insert into Config (Key, Value) values ('{0}', '{1}')", "DatabaseSchemeVersion", "1022"));
                    _dbcon.ExecuteNonQuery(string.Format("insert into Config (Key, Value) values ('{0}', '{1}')", "DatabaseSchemeVersionWin", "1022"));
                    _dbcon.ExecuteNonQuery(string.Format("insert into Config (Key, Value) values ('{0}', '{1}')", "DatabaseId", DateTime.Now.ToFileTime()));
                    _dbcon.ExecuteNonQuery(string.Format("insert into Config (Key, Value) values ('{0}', '{1}')", "MasterDatabaseId", DateTime.Now.ToFileTime() + 1));

                    _dbcon.ExecuteNonQuery(string.Format("insert into Category (Id, GpxFilename, Pinned) values ({0}, '{1}', {2})", fixedCatId, fixedGpxFilename, 0));
                    _dbcon.ExecuteNonQuery(string.Format("insert into GPXFilenames (Id, GpxFilename, Imported, CategoryId) values ({0}, '{1}', '{2}', {3})", 1, fixedGpxFilename, DateTime.Now.ToString("s"), fixedCatId));


                    //----------------------------
                    // CACHES
                    //----------------------------
                    DbCommand cmd = _dbcon.Command;
                    cmd.CommandText = "insert into Caches (Id, GcCode, GcId, Latitude, Longitude, Name, Size, Difficulty, Terrain, Archived, Available, Found, Type, PlacedBy, Owner, DateHidden, Hint, Description, Url, NumTravelbugs, Rating, Vote, VotePending, Notes, Solver, Favorit, AttributesPositive, AttributesNegative, TourName, GPXFilename_Id, HasUserData, ListingChanged, ImagesUpdated, DescriptionImagesUpdated, CorrectedCoordinates, AttributesPositiveHigh, AttributesNegativeHigh, State, Country) values (@Id, @GcCode, @GcId, @Latitude, @Longitude, @Name, @Size, @Difficulty, @Terrain, @Archived, @Available, @Found, @Type, @PlacedBy, @Owner, @DateHidden, @Hint, @Description, @Url, @NumTravelbugs, @Rating, @Vote, @VotePending, @Notes, @Solver, @Favorit, @AttributesPositive, @AttributesNegative, @TourName, @GPXFilename_Id, @HasUserData, @ListingChanged, @ImagesUpdated, @DescriptionImagesUpdated, @CorrectedCoordinates, @AttributesPositiveHigh, @AttributesNegativeHigh, @State, @Country)";
                    DbParameter par;
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Id";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@GcCode";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@GcId";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Latitude";
                    par.DbType        = DbType.Single;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Longitude";
                    par.DbType        = DbType.Single;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Name";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Size";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Difficulty";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Terrain";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Archived";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Available";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Found";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Type";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@PlacedBy";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Owner";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@DateHidden";
                    par.DbType        = DbType.DateTime;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Hint";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Description";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Url";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@NumTravelbugs";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Rating";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Vote";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@VotePending";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Notes";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Solver";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Favorit";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@AttributesPositive";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@AttributesNegative";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@TourName";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@GPXFilename_Id";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@HasUserData";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@ListingChanged";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@ImagesUpdated";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@DescriptionImagesUpdated";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@CorrectedCoordinates";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@AttributesPositiveHigh";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@AttributesNegativeHigh";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@State";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Country";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);

                    long startCacheId = DateTime.Now.ToFileTime() + 2;
                    long cacheId      = startCacheId;
                    foreach (Framework.Data.Geocache gc in _gcList)
                    {
                        cmd.Parameters["@Id"].Value     = cacheId;
                        cmd.Parameters["@GcCode"].Value = gc.Code;
                        cmd.Parameters["@GcId"].Value   = gc.ID;
                        if (gc.ContainsCustomLatLon)
                        {
                            cmd.Parameters["@Latitude"].Value  = (float)gc.CustomLat;
                            cmd.Parameters["@Longitude"].Value = (float)gc.CustomLon;
                        }
                        else
                        {
                            cmd.Parameters["@Latitude"].Value  = (float)gc.Lat;
                            cmd.Parameters["@Longitude"].Value = (float)gc.Lon;
                        }
                        cmd.Parameters["@Name"].Value = gc.Name ?? "";
                        switch (gc.Container.ID)
                        {
                        case 2:
                            cmd.Parameters["@Size"].Value = 1;
                            break;

                        case 8:
                            cmd.Parameters["@Size"].Value = 2;
                            break;

                        case 4:
                            cmd.Parameters["@Size"].Value = 3;
                            break;

                        case 5:
                            cmd.Parameters["@Size"].Value = 4;
                            break;

                        default:
                            cmd.Parameters["@Size"].Value = 0;
                            break;
                        }
                        cmd.Parameters["@Difficulty"].Value = (Int16)(gc.Difficulty * 2.0);
                        cmd.Parameters["@Terrain"].Value    = (Int16)(gc.Terrain * 2.0);
                        cmd.Parameters["@Archived"].Value   = gc.Archived;
                        cmd.Parameters["@Available"].Value  = gc.Available;
                        cmd.Parameters["@Found"].Value      = gc.Found;
                        switch (gc.GeocacheType.ID)
                        {
                        case 2:
                            cmd.Parameters["@Type"].Value = 0;
                            break;

                        case 3:
                            cmd.Parameters["@Type"].Value = 1;
                            break;

                        case 4:
                            cmd.Parameters["@Type"].Value = 8;
                            break;

                        case 5:
                            cmd.Parameters["@Type"].Value = 9;
                            break;

                        case 6:
                            cmd.Parameters["@Type"].Value = 5;
                            break;

                        case 8:
                            cmd.Parameters["@Type"].Value = 2;
                            break;

                        case 11:
                            cmd.Parameters["@Type"].Value = 3;
                            break;

                        case 13:
                            cmd.Parameters["@Type"].Value = 7;
                            break;

                        case 137:
                            cmd.Parameters["@Type"].Value = 4;
                            break;

                        case 453:
                            cmd.Parameters["@Type"].Value = 6;
                            break;

                        case 1858:
                            cmd.Parameters["@Type"].Value = 10;
                            break;

                        default:
                            cmd.Parameters["@Type"].Value = 13;
                            break;
                        }
                        cmd.Parameters["@PlacedBy"].Value   = gc.PlacedBy ?? "";
                        cmd.Parameters["@Owner"].Value      = gc.Owner ?? "";
                        cmd.Parameters["@DateHidden"].Value = gc.PublishedTime;
                        cmd.Parameters["@Hint"].Value       = gc.EncodedHints ?? "";
                        StringBuilder sb = new StringBuilder();
                        if (!string.IsNullOrEmpty(gc.ShortDescription))
                        {
                            if (gc.ShortDescriptionInHtml)
                            {
                                sb.Append(gc.ShortDescription);
                            }
                            else
                            {
                                sb.Append(HttpUtility.HtmlEncode(gc.ShortDescription).Replace("\r", "").Replace("\n", "<br />"));
                            }
                            sb.Append("<br />");
                        }
                        if (!string.IsNullOrEmpty(gc.LongDescription))
                        {
                            if (gc.LongDescriptionInHtml)
                            {
                                sb.Append(gc.LongDescription);
                            }
                            else
                            {
                                sb.Append(HttpUtility.HtmlEncode(gc.LongDescription).Replace("\r", "").Replace("\n", "<br />"));
                            }
                        }
                        cmd.Parameters["@Description"].Value   = sb.ToString();
                        cmd.Parameters["@Url"].Value           = gc.Url ?? "";
                        cmd.Parameters["@NumTravelbugs"].Value = 0;
                        cmd.Parameters["@Rating"].Value        = 0;
                        cmd.Parameters["@Vote"].Value          = 0;
                        cmd.Parameters["@VotePending"].Value   = false;
                        sb.Length = 0;
                        if (gc.ContainsNote)
                        {
                            if (!string.IsNullOrEmpty(gc.PersonaleNote))
                            {
                                sb.Append(gc.PersonaleNote);
                                sb.Append(" - ");
                            }
                            if (!string.IsNullOrEmpty(gc.Notes))
                            {
                                sb.Append(Utils.Conversion.StripHtmlTags(gc.Notes));
                            }
                        }
                        cmd.Parameters["@Notes"].Value   = sb.Length;
                        cmd.Parameters["@Solver"].Value  = "";
                        cmd.Parameters["@Favorit"].Value = false;

                        DLong      tmpAttributesNegative = new DLong(0, 0);
                        DLong      tmpAttributesPositive = new DLong(0, 0);
                        List <int> attrs = gc.AttributeIds;
                        foreach (int ix in attrs)
                        {
                            if (ix > 0)
                            {
                                tmpAttributesPositive.BitOr(Attributes.GetAttributeDlong(Attributes.getAttributeEnumByGcComId(ix).Attribute));
                            }
                            else
                            {
                                tmpAttributesNegative.BitOr(Attributes.GetAttributeDlong(Attributes.getAttributeEnumByGcComId(-ix).Attribute));
                            }
                        }
                        long AttributePositiveLow   = (long)tmpAttributesPositive.getLow();
                        long AttributePositiveHigh  = (long)tmpAttributesPositive.getHigh();
                        long AttributesNegativeLow  = (long)tmpAttributesNegative.getLow();
                        long AttributesNegativeHigh = (long)tmpAttributesNegative.getHigh();
                        cmd.Parameters["@AttributesPositive"].Value     = AttributePositiveLow;
                        cmd.Parameters["@AttributesNegative"].Value     = AttributesNegativeLow;
                        cmd.Parameters["@AttributesPositiveHigh"].Value = AttributePositiveHigh;
                        cmd.Parameters["@AttributesNegativeHigh"].Value = AttributesNegativeHigh;
                        cmd.Parameters["@TourName"].Value                 = "";
                        cmd.Parameters["@AttributesNegative"].Value       = 1;
                        cmd.Parameters["@HasUserData"].Value              = false;
                        cmd.Parameters["@ListingChanged"].Value           = false;
                        cmd.Parameters["@ImagesUpdated"].Value            = false;
                        cmd.Parameters["@DescriptionImagesUpdated"].Value = false;
                        cmd.Parameters["@CorrectedCoordinates"].Value     = false;
                        cmd.Parameters["@State"].Value   = gc.State ?? "";
                        cmd.Parameters["@Country"].Value = gc.Country ?? "";

                        cmd.ExecuteNonQuery();
                        cacheId++;

                        index++;
                        if (index % 200 == 0)
                        {
                            progress.UpdateProgress(STR_EXPORTINGCB, STR_CREATINGFILE, max, index);
                        }
                    }

                    //----------------------------
                    // WAYPOINTS
                    //----------------------------
                    cmd.Parameters.Clear();
                    cmd.CommandText   = "insert into Waypoint (GcCode, CacheId, Latitude, Longitude, Description, Clue, Type, SyncExclude, UserWaypoint, Title) values (@GcCode, @CacheId, @Latitude, @Longitude, @Description, @Clue, @Type, @SyncExclude, @UserWaypoint, @Title)";
                    par               = cmd.CreateParameter();
                    par.ParameterName = "@GcCode";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@CacheId";
                    par.DbType        = DbType.Int64;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Latitude";
                    par.DbType        = DbType.Single;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Longitude";
                    par.DbType        = DbType.Single;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Description";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Clue";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Type";
                    par.DbType        = DbType.Int16;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@SyncExclude";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@UserWaypoint";
                    par.DbType        = DbType.Boolean;
                    cmd.Parameters.Add(par);
                    par = cmd.CreateParameter();
                    par.ParameterName = "@Title";
                    par.DbType        = DbType.String;
                    cmd.Parameters.Add(par);

                    cacheId = startCacheId;
                    foreach (Framework.Data.Geocache gc in _gcList)
                    {
                        List <Framework.Data.Waypoint> wps = Utils.DataAccess.GetWaypointsFromGeocache(Core.Waypoints, gc.Code);
                        if (wps != null && wps.Count > 0)
                        {
                            foreach (Framework.Data.Waypoint wp in wps)
                            {
                                if (wp.Lat != null && wp.Lon != null)
                                {
                                    cmd.Parameters["@GcCode"].Value      = wp.Code;
                                    cmd.Parameters["@CacheId"].Value     = cacheId;
                                    cmd.Parameters["@Latitude"].Value    = (float)(double)wp.Lat;
                                    cmd.Parameters["@Longitude"].Value   = (float)(double)wp.Lon;
                                    cmd.Parameters["@Description"].Value = wp.Comment ?? "";
                                    cmd.Parameters["@Clue"].Value        = "";
                                    switch (wp.WPType.ID)
                                    {
                                    case 217:
                                        cmd.Parameters["@Type"].Value = 17;
                                        break;

                                    case 220:
                                        cmd.Parameters["@Type"].Value = 18;
                                        break;

                                    case 218:
                                        cmd.Parameters["@Type"].Value = 15;
                                        break;

                                    case 452:
                                        cmd.Parameters["@Type"].Value = 11;
                                        break;

                                    case 219:
                                        cmd.Parameters["@Type"].Value = 14;
                                        break;

                                    case 221:
                                        cmd.Parameters["@Type"].Value = 16;
                                        break;

                                    default:
                                        cmd.Parameters["@Type"].Value = 13;
                                        break;
                                    }
                                    cmd.Parameters["@SyncExclude"].Value  = false;
                                    cmd.Parameters["@UserWaypoint"].Value = string.IsNullOrEmpty(wp.Url) || !wp.Url.ToLower().StartsWith("http:");
                                    cmd.Parameters["@Title"].Value        = wp.Description ?? "";

                                    cmd.ExecuteNonQuery();
                                }
                            }
                        }
                        cacheId++;

                        index++;
                        if (index % 200 == 0)
                        {
                            progress.UpdateProgress(STR_EXPORTINGCB, STR_CREATINGFILE, max, index);
                        }
                    }
                    //----------------------------
                    // LOGS
                    //----------------------------
                    if (PluginSettings.Instance.MaxLogs > 0)
                    {
                        cmd.Parameters.Clear();
                        cmd.CommandText   = "insert into Logs (Id, CacheId, Timestamp, Finder, Type, Comment) values (@Id, @CacheId, @Timestamp, @Finder, @Type, @Comment)";
                        par               = cmd.CreateParameter();
                        par.ParameterName = "@Id";
                        par.DbType        = DbType.Int64;
                        cmd.Parameters.Add(par);
                        par = cmd.CreateParameter();
                        par.ParameterName = "@CacheId";
                        par.DbType        = DbType.Int64;
                        cmd.Parameters.Add(par);
                        par = cmd.CreateParameter();
                        par.ParameterName = "@Timestamp";
                        par.DbType        = DbType.DateTime;
                        cmd.Parameters.Add(par);
                        par = cmd.CreateParameter();
                        par.ParameterName = "@Finder";
                        par.DbType        = DbType.String;
                        cmd.Parameters.Add(par);
                        par = cmd.CreateParameter();
                        par.ParameterName = "@Type";
                        par.DbType        = DbType.Int16;
                        cmd.Parameters.Add(par);
                        par = cmd.CreateParameter();
                        par.ParameterName = "@Comment";
                        par.DbType        = DbType.String;
                        cmd.Parameters.Add(par);

                        long logId = 1;
                        cacheId = startCacheId;
                        foreach (Framework.Data.Geocache gc in _gcList)
                        {
                            List <Framework.Data.Log> logs = Utils.DataAccess.GetLogs(Core.Logs, gc.Code).Take(PluginSettings.Instance.MaxLogs).ToList();
                            if (logs != null && logs.Count > 0)
                            {
                                logs = logs.Take(PluginSettings.Instance.MaxLogs).ToList();
                                foreach (Framework.Data.Log lg in logs)
                                {
                                    long id = logId;
                                    if (lg.ID.StartsWith("GL"))
                                    {
                                        id = Utils.Conversion.GetCacheIDFromCacheCode(lg.ID);
                                    }
                                    else
                                    {
                                        long.TryParse(lg.ID, out id);
                                    }
                                    cmd.Parameters["@Id"].Value        = id;
                                    cmd.Parameters["@CacheId"].Value   = cacheId;
                                    cmd.Parameters["@Timestamp"].Value = lg.Date;
                                    cmd.Parameters["@Finder"].Value    = lg.Finder ?? "";
                                    switch (lg.LogType.ID)
                                    {
                                    case 2:
                                        cmd.Parameters["@Type"].Value = 0;
                                        break;

                                    case 3:
                                        cmd.Parameters["@Type"].Value = 1;
                                        break;

                                    case 4:
                                        cmd.Parameters["@Type"].Value = 2;
                                        break;

                                    case 24:
                                        cmd.Parameters["@Type"].Value = 3;
                                        break;

                                    case 23:
                                        cmd.Parameters["@Type"].Value = 4;
                                        break;

                                    case 45:
                                        cmd.Parameters["@Type"].Value = 5;
                                        break;

                                    case 22:
                                        cmd.Parameters["@Type"].Value = 6;
                                        break;

                                    case 46:
                                    case 47:
                                        cmd.Parameters["@Type"].Value = 7;
                                        break;

                                    case 9:
                                        cmd.Parameters["@Type"].Value = 8;
                                        break;

                                    case 10:
                                        cmd.Parameters["@Type"].Value = 9;
                                        break;

                                    case 11:
                                        cmd.Parameters["@Type"].Value = 10;
                                        break;

                                    case 5:
                                    case 6:
                                    case 12:
                                        cmd.Parameters["@Type"].Value = 11;
                                        break;

                                    case 18:
                                        cmd.Parameters["@Type"].Value = 12;
                                        break;

                                    case 7:
                                        cmd.Parameters["@Type"].Value = 13;
                                        break;

                                    default:
                                        cmd.Parameters["@Type"].Value = 2;
                                        break;
                                    }
                                    cmd.Parameters["@Comment"].Value = lg.Text ?? "";

                                    cmd.ExecuteNonQuery();
                                }
                            }

                            cacheId++;

                            index++;
                            if (index % 200 == 0)
                            {
                                progress.UpdateProgress(STR_EXPORTINGCB, STR_CREATINGFILE, max, index);
                            }
                        }
                    }


                    _dbcon.Dispose();
                }
            }
        }