Пример #1
0
        public override IEnumerable <FileManagerFile> GetFiles(FileManagerFolder folder)
        {
            ArtsFileSystemItem artFolderItem = FindArtsFolderItem(folder);

            return(from artItem in ArtsDataProvider.GetArts()
                   where !artItem.IsFolder && artItem.ParentID == artFolderItem.ArtID
                   select new FileManagerFile(this, folder, artItem.Name, artItem.ArtID.ToString()));
        }
Пример #2
0
        protected ArtsFileSystemItem FindArtsFileItem(FileManagerFile file)
        {
            ArtsFileSystemItem artsFolderItem = FindArtsFolderItem(file.Folder);

            if (artsFolderItem == null)
            {
                return(null);
            }
            return(ArtsDataProvider.GetArts().FindAll(item => (int)item.ParentID == artsFolderItem.ArtID && !item.IsFolder && item.Name == file.Name).FirstOrDefault());
        }
Пример #3
0
 public override void UploadFile(FileManagerFolder folder, string fileName, Stream content)
 {
     ArtsDataProvider.InsertArt(new ArtsFileSystemItem {
         IsFolder      = false,
         LastWriteTime = DateTime.Now,
         Name          = fileName,
         ParentID      = FindArtsFolderItem(folder).ArtID,
         Data          = ReadAllBytes(content)
     });
 }
Пример #4
0
 public override void CreateFolder(FileManagerFolder parent, string name)
 {
     ArtsDataProvider.InsertArt(new ArtsFileSystemItem {
         IsFolder      = true,
         LastWriteTime = DateTime.Now,
         Name          = name,
         ParentID      = FindArtsFolderItem(parent).ArtID
     });
     RefreshFolderCache();
 }
Пример #5
0
 protected void RefreshFolderCache()
 {
     this.folderCache           = ArtsDataProvider.GetArts().FindAll(artItem => artItem.IsFolder).ToDictionary(artItem => artItem.ArtID);
     this.rootFolderDisplayName = (from artFolderItem in FolderCache.Values where artFolderItem.ArtID == ArtsRootItemID select artFolderItem.Name).First();
 }
Пример #6
0
 public override void DeleteFolder(FileManagerFolder folder)
 {
     ArtsDataProvider.DeleteArt(FindArtsFolderItem(folder));
     RefreshFolderCache();
 }
Пример #7
0
 public override void DeleteFile(FileManagerFile file)
 {
     ArtsDataProvider.DeleteArt(FindArtsFileItem(file));
 }
Пример #8
0
 public override void MoveFolder(FileManagerFolder folder, FileManagerFolder newParentFolder)
 {
     ArtsDataProvider.UpdateArt(FindArtsFolderItem(folder), artItem => artItem.ParentID = FindArtsFolderItem(newParentFolder).ArtID);
     RefreshFolderCache();
 }
Пример #9
0
 public override void MoveFile(FileManagerFile file, FileManagerFolder newParentFolder)
 {
     ArtsDataProvider.UpdateArt(FindArtsFileItem(file), artItem => artItem.ParentID = FindArtsFolderItem(newParentFolder).ArtID);
 }
Пример #10
0
 public override void RenameFolder(FileManagerFolder folder, string name)
 {
     ArtsDataProvider.UpdateArt(FindArtsFolderItem(folder), artItem => artItem.Name = name);
     RefreshFolderCache();
 }
Пример #11
0
 public override void RenameFile(FileManagerFile file, string name)
 {
     ArtsDataProvider.UpdateArt(FindArtsFileItem(file), artItem => artItem.Name = name);
 }