Пример #1
0
 public FSNodeStream(FSNode item)
 {
     Item      = item;
     _uploader = new Uploader(Item);
 }
Пример #2
0
 public Uploader(FSNode node)
 {
     Node = node;
 }
Пример #3
0
        public async Task <FSNode> FetchItem(string path)
        {
            if (path == "\\" || path == string.Empty)
            {
                return(_root);
            }

            if (!path.StartsWith("\\"))
            {
                path = "\\" + path;
            }

            if (excludedFiles.Contains(System.IO.Path.GetFileName(path)))
            {
                return(null);
            }

            FSNode item = _fileTree.GetItem(path);;

            if (item != null)
            {
                return(item);
            }

            var di = await Browse(path);

            if (di == null)
            {
                return(null);
            }
            // item = new FSNode(di, System.IO.Path.GetDirectoryName(path));
            // _fileTree.Add(item);


            var folders = new LinkedList <string>();
            var curpath = path;

            item = null;
            do
            {
                folders.AddFirst(Path.GetFileName(curpath));
                curpath = Path.GetDirectoryName(curpath);
                if (curpath == "\\" || string.IsNullOrEmpty(curpath))
                {
                    break;
                }

                item = _fileTree.GetItem(curpath);
            }while (item == null);

            if (item == null)
            {
                item = _root;
            }

            if (curpath == "\\")
            {
                curpath = string.Empty;
            }

            foreach (var name in folders)
            {
                var newpath = curpath + "\\" + name;

                var newnode = await Browse(item, name);

                if (newnode == null)
                {
                    // Log.Error("NonExisting path from server: " + itemPath);
                    return(null);
                }

                item = new FSNode(newnode, item.Path);
                _fileTree.Add(item);
                curpath = newpath;
            }

            return(item);
        }
Пример #4
0
 public async Task <List <DriveItem> > BrowseChildren(FSNode node)
 {
     return(await RestClient.retrieveAll <DriveItem>("Drive/" + Drive.Drive__ + "/Item", "GET", new Dictionary <string, object>() { { "Parent_Drive_Item__", node.Item.Drive_Item__ } }));
 }
Пример #5
0
 public async Task <bool> DeleteItem(FSNode node)
 {
     return((await RestClient.Api <RestResponse <object> >($"Drive/Item/{node.Item.Drive_Item__}", "DELETE")) != null);
 }
Пример #6
0
 public DriveProvider(Rest.Drive drive)
 {
     Drive = drive;
     _root = new FSNode(Drive.Root);
 }