Ejemplo n.º 1
0
 public FSNodeStream(FSNode item)
 {
     Item      = item;
     _uploader = new Uploader(Item);
 }
Ejemplo n.º 2
0
 public Uploader(FSNode node)
 {
     Node = node;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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__ } }));
 }
Ejemplo n.º 5
0
 public async Task <bool> DeleteItem(FSNode node)
 {
     return((await RestClient.Api <RestResponse <object> >($"Drive/Item/{node.Item.Drive_Item__}", "DELETE")) != null);
 }
Ejemplo n.º 6
0
 public DriveProvider(Rest.Drive drive)
 {
     Drive = drive;
     _root = new FSNode(Drive.Root);
 }