Exemplo n.º 1
0
    public override IEnumerable <FileManagerFolder> GetFolders(FileManagerFolder parentFolder)
    {
        ArtsFileSystemItem artFolderItem = FindArtsFolderItem(parentFolder);

        return(from artItem in FolderCache.Values
               where artItem.IsFolder && artItem.ParentID == artFolderItem.ArtID
               select new FileManagerFolder(this, parentFolder, artItem.Name, artItem.ArtID.ToString()));
    }
Exemplo n.º 2
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()));
    }
Exemplo n.º 3
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());
    }
Exemplo n.º 4
0
 public static void DeleteArt(ArtsFileSystemItem art)
 {
     if (art.IsFolder)
     {
         List <ArtsFileSystemItem> childFolders = GetArts().FindAll(item => item.IsFolder && item.ParentID == art.ArtID);
         if (childFolders != null)
         {
             foreach (ArtsFileSystemItem childFolder in childFolders)
             {
                 DeleteArt(childFolder);
             }
         }
     }
     GetArts().Remove(art);
 }
Exemplo n.º 5
0
    protected string GetRelativeName(ArtsFileSystemItem artFolderItem)
    {
        if (artFolderItem.ArtID == ArtsRootItemID)
        {
            return(string.Empty);
        }
        if (artFolderItem.ParentID == ArtsRootItemID)
        {
            return(artFolderItem.Name);
        }
        if (!FolderCache.ContainsKey((int)artFolderItem.ParentID))
        {
            return(null);
        }
        string name = GetRelativeName(FolderCache[(int)artFolderItem.ParentID]);

        return(name == null ? null : Path.Combine(name, artFolderItem.Name));
    }
Exemplo n.º 6
0
 public static void UpdateArt(ArtsFileSystemItem art, Action <ArtsFileSystemItem> update)
 {
     update(art);
 }
Exemplo n.º 7
0
 public static void InsertArt(ArtsFileSystemItem newArt)
 {
     newArt.ArtID = GetNewArtID();
     GetArts().Add(newArt);
 }