/// <summary>
 /// Removes all cache entries in the isolated storage.
 /// </summary>
 public void ClearCache()
 {
     using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
     {
         isf.DeleteDirectoryRecursive(PathToCache);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Removes all files from the log and dump cache.
 /// </summary>
 public static void ClearCache()
 {
     using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
     {
         try
         {
             isf.DeleteDirectoryRecursive("/Debug");
         }
         catch (Exception)
         {
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Removes cartridge cache entries (not savegames or cartridge files). Loaded cartridge tags
        /// are unloaded from memory.
        /// </summary>
        public void ClearCache()
        {
            // Clears the cache.
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                try
                {
                    isf.DeleteDirectoryRecursive(CartridgeTag.GlobalCachePath);
                }
                catch (Exception)
                {
                }
            }

            // Clears this collection.
            lock (_syncRoot)
            {
                this.Items.Clear();
            }
        }
        public static void DeleteDirectoryRecursive(this IsolatedStorageFile storeFile, string dir)
        {
            // Avoids an exception.
            if (!storeFile.DirectoryExists(dir))
            {
                return;
            }

            // Goes in depth.
            foreach (string innerDir in storeFile.GetDirectoryNames(dir + "/*"))
            {
                storeFile.DeleteDirectoryRecursive(Path.Combine(dir, innerDir));
            }

            // Delete all files in this directory.
            foreach (string file in storeFile.GetFileNames(dir + "/*"))
            {
                storeFile.DeleteFile(Path.Combine(dir, file));
            }

            // Deletes this directory.
            storeFile.DeleteDirectory(dir);
        }