private void OnStartApplication(IApplicationContext ctx) { if (ctx.Settings.ClearCacheOnStart) { FileSystemProvider.DeleteDirectory(ctx.LocalStorage); } }
public void ClearShared() { try { string path = Path.Combine(_context.LocalStorage, Provider.SharedDirectory); FileSystemProvider.DeleteDirectory(path); } catch (Exception e) { _context.HandleException( new InputOutputException(e, "Error occured during {0} operation", "ClearShared")); } }
public void ClearPrivate() { try { string path = Path.Combine(_context.LocalStorage, Provider.PrivateDirectory); FileSystemProvider.DeleteDirectory(path); string sentPath = Path.Combine(_context.LocalStorage, SentItems); if (!File.Exists(sentPath)) { File.Delete(sentPath); } } catch (Exception e) { _context.HandleException( new InputOutputException(e, "Error occured during {0} operation", "ClearPrivate")); } }
public void Delete(string name) { try { string path = FileSystemProvider.TranslatePath(_context.LocalStorage, name); if (File.Exists(path)) { File.Delete(path); } else if (Directory.Exists(path)) { FileSystemProvider.DeleteDirectory(path); } } catch (Exception e) { _context.HandleException( new InputOutputException(e, "Error occured during {0} operation", "Delete")); } }
/// <summary> /// Deletes a spefic directory from a virtual path /// </summary> /// <param name="VirtualPath">The path to delete</param> /// <remarks> /// Virtual path is the path starting from the /files/ containers /// The entity is queried against to current blog id /// </remarks> public static void DeleteDirectory(string VirtualPath) { FileSystemProvider.DeleteDirectory(VirtualPath); }