private void DeleteDir(string path)
        {
            path = GetRelativePath(path);

            if (!_fileSystem.FolderExists(path))
            {
                throw new Exception(LangRes("E_DeleteDirInvalidPath"));
            }

            if (path == FileRoot)
            {
                throw new Exception(LangRes("E_CannotDeleteRoot"));
            }

            //throw new Exception(LangRes("E_DeleteNonEmpty"));

            try
            {
                _fileSystem.DeleteFolder(path);

                Response.Write(GetResultString());
            }
            catch (Exception ex)
            {
                throw new Exception(LangRes("E_CannotDeleteDir") + ": " + ex.Message);
            }
        }
Пример #2
0
        public virtual void DeleteCachedImages()
        {
            for (int i = 0; i < 10; i++)
            {
                try
                {
                    foreach (var file in _fileSystem.ListFiles(_thumbsRootDir))
                    {
                        if (!file.Name.IsCaseInsensitiveEqual("placeholder") && !file.Name.IsCaseInsensitiveEqual("placeholder.txt"))
                        {
                            _fileSystem.DeleteFile(file.Path);
                        }
                    }
                    foreach (var dir in _fileSystem.ListFolders(_thumbsRootDir))
                    {
                        _fileSystem.DeleteFolder(dir.Path);
                    }

                    return;
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            }
        }
Пример #3
0
 public virtual void Clear()
 {
     for (int i = 0; i < 10; i++)
     {
         try
         {
             _fileSystem.DeleteFolder(_thumbsRootDir);
             _fileSystem.CreateFolder(_thumbsRootDir);
         }
         catch (Exception ex)
         {
             Logger.Error(ex);
         }
     }
 }
Пример #4
0
        private void DeleteDir(string path)
        {
            path = GetRelativePath(path);

            if (path == FileRoot)
            {
                throw new Exception(LangRes("E_CannotDeleteRoot"));
            }

            try
            {
                _fileSystem.DeleteFolder(path);
                Response.Write(GetResultString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }