Esempio n. 1
0
 private void OnStartApplication(IApplicationContext ctx)
 {
     if (ctx.Settings.ClearCacheOnStart)
     {
         FileSystemProvider.DeleteDirectory(ctx.LocalStorage);
     }
 }
Esempio n. 2
0
 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"));
     }
 }
Esempio n. 3
0
        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"));
            }
        }
Esempio n. 4
0
        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"));
            }
        }
Esempio n. 5
0
 /// <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);
 }