public Cache() { #region singleton check if (Instance != null) { throw (new System.Exception("You have tried to create a new singleton class where you should have instanced it. Replace your \"new class()\" with \"class.Instance\"")); } #endregion ImageCache = new SQLitePureImageCache(); //ImageCacheSecond = new HttpPureImageCache("http://127.0.0.1:7777"); }
public Cache() { #region singleton check if (Instance != null) { throw new Exception( "You have tried to create a new singleton class where you should have instanced it. Replace your \"new class()\" with \"class.Instance\""); } #endregion #if SQLite ImageCache = new SQLitePureImageCache(); #else // you can use $ms stuff if you like too ;} ImageCache = new MsSQLCePureImageCache(); #endif { string newCache = CacheLocator.Location; string oldCache = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + Path.DirectorySeparatorChar + "GMap.NET" + 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); } CacheLocation = newCache; } catch (Exception ex) { CacheLocation = oldCache; Trace.WriteLine("SQLitePureImageCache, moving data: " + ex.ToString()); } } else { CacheLocation = newCache; } } }
public Cache() { #region singleton check if (Instance != null) { throw (new System.Exception("You have tried to create a new singleton class where you should have instanced it. Replace your \"new class()\" with \"class.Instance\"")); } #endregion #if SQLite ImageCache = new SQLitePureImageCache(); #else // you can use $ms stuff if you like too ;} ImageCache = new MsSQLCePureImageCache(); #endif if (string.IsNullOrEmpty(CacheLocation)) { #if PocketPC // use sd card if exist for cache string sd = Native.GetRemovableStorageDirectory(); if (!string.IsNullOrEmpty(sd)) { CacheLocation = sd + Path.DirectorySeparatorChar + "GMap.NET" + Path.DirectorySeparatorChar; } else #endif { string oldCache = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + Path.DirectorySeparatorChar + "GMap.NET" + Path.DirectorySeparatorChar; #if PocketPC CacheLocation = oldCache; #else string newCache = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "GMap.NET" + Path.DirectorySeparatorChar; // move database to non-roaming user directory try { //changed to avoid exceptions if (Directory.Exists(oldCache) & !Directory.Exists(newCache)) { Directory.Move(oldCache, newCache); } CacheLocation = newCache; } catch (Exception ex) { Trace.WriteLine("SQLitePureImageCache, moving data: " + ex.ToString()); CacheLocation = oldCache; } #endif } } }
public Cache() { #region singleton check if (Instance != null) { throw (new System.Exception("You have tried to create a new singleton class where you should have instanced it. Replace your \"new class()\" with \"class.Instance\"")); } #endregion #if SQLite ImageCache = new SQLitePureImageCache(); #else #endif if (string.IsNullOrEmpty(CacheLocation)) { { string oldCache = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "MapTile" + Path.DirectorySeparatorChar; string newCache = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "MapTile" + 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); // } // CacheLocation = newCache; // } // catch(Exception ex) // { // CacheLocation = oldCache; // Trace.WriteLine("SQLitePureImageCache, moving data: " + ex.ToString()); // } //} //else //{ CacheLocation = newCache; //} } } }
private Cache() { #if SQLite ImageCache = new SQLitePureImageCache(); #else // you can use $ms stuff if you like too ;} ImageCache = new MsSQLCePureImageCache(); #endif { string newCache = CacheLocator.Location; string oldCache = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + Path.DirectorySeparatorChar + "GMap.NET" + 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); } CacheLocation = newCache; } catch (Exception ex) { CacheLocation = oldCache; Trace.WriteLine("SQLitePureImageCache, moving data: " + ex.ToString()); } } else { CacheLocation = newCache; } } }