/// <summary> /// </summary> public static void Initialize(PureImageProxy imageProxy) { TileImageProxy = imageProxy; // triggers dynamic SQLite loading, call this before you use SQLite for other reasons than caching maps SQLitePureImageCache.Ping(); }
private void InitCache() { ImageCache = new SQLitePureImageCache(); string newCache = CacheLocation; string oldCache = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + Path.DirectorySeparatorChar + "GKMap" + Path.DirectorySeparatorChar; // move database to non-roaming user directory if (Directory.Exists(oldCache)) { try { if (Directory.Exists(newCache)) { Directory.Delete(oldCache, true); } else { Directory.Move(oldCache, newCache); } ImageCacheLocation = newCache; } catch (Exception ex) { ImageCacheLocation = oldCache; Trace.WriteLine("SQLitePureImageCache, moving data: " + ex); } } else { ImageCacheLocation = newCache; } }
/// <summary> /// triggers dynamic sqlite loading, /// call this before you use sqlite for other reasons than caching maps /// </summary> public void SQLitePing() { #if SQLite #if !MONO SQLitePureImageCache.Ping(); #endif #endif }
private void gMapControl2_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { SQLitePureImageCache map = new SQLitePureImageCache(); MemoryCache memory = new MemoryCache(); map.CacheLocation = @"D:\Alexandr Olegovich\Projects\PrognozCS\PrognozCS\bin\x86\Debug\GMap.NET\TileDBv5\en\Data.gmdb"; } }
/// <summary> /// imports GMDB file to current map cache /// only new records will be added /// </summary> /// <param name="file"></param> /// <returns></returns> public bool ImportFromGMDB(string file) { if (PrimaryCache is GMap.NET.CacheProviders.SQLitePureImageCache) { StringBuilder db = new StringBuilder((PrimaryCache as SQLitePureImageCache).GtileCache); db.AppendFormat(CultureInfo.InvariantCulture, "{0}{1}Data.gmdb", GMapProvider.LanguageStr, Path.DirectorySeparatorChar); return(SQLitePureImageCache.ExportMapDataToDB(file, db.ToString())); } return(false); }
/// <summary> /// exports current map cache to GMDB file /// if file exsist only new records will be added /// otherwise file will be created and all data exported /// </summary> /// <param name="file"></param> /// <returns></returns> public bool ExportToGMDB(string file) { #if SQLite if (PrimaryCache is SQLitePureImageCache) { StringBuilder db = new StringBuilder((PrimaryCache as SQLitePureImageCache).GtileCache); db.AppendFormat(CultureInfo.InvariantCulture, "{0}{1}Data.gmdb", GMapProvider.LanguageStr, Path.DirectorySeparatorChar); return(SQLitePureImageCache.ExportMapDataToDB(db.ToString(), file)); } #endif return(false); }
/// <summary> /// optimizes map database, *.gmdb /// </summary> /// <param name="file">database file name or null to optimize current user db</param> /// <returns></returns> public bool OptimizeMapDb(string file) { if (PrimaryCache is GMap.NET.CacheProviders.SQLitePureImageCache) { if (string.IsNullOrEmpty(file)) { StringBuilder db = new StringBuilder((PrimaryCache as SQLitePureImageCache).GtileCache); db.AppendFormat(CultureInfo.InvariantCulture, "{0}{1}Data.gmdb", GMapProvider.LanguageStr, Path.DirectorySeparatorChar); return(SQLitePureImageCache.VacuumDb(db.ToString())); } else { return(SQLitePureImageCache.VacuumDb(file)); } } return(false); }
/// <summary> /// imports GMDB file to current map cache /// only new records will be added /// </summary> /// <param name="file"></param> /// <returns></returns> public bool 加载地图(string file) { var __result = SQLitePureImageCache.加载地图(file); return(__result); }
/// <summary> /// triggers dynamic sqlite loading, /// call this before you use sqlite for other reasons than caching maps /// </summary> public void SQLitePing() { SQLitePureImageCache.Ping(); }