Esempio n. 1
0
        public static void CreateFolder(ExplorerNode node)
        {
            if (node == node.GetRoot)
            {
                throw new Exception("Node is root.");
            }
            DropboxRequestAPIv2        client   = GetAPIv2(node.GetRoot.NodeType.Email);
            IDropbox_Response_MetaData metadata = client.create_folder(new Dropbox_path(node.GetFullPathString(false)));

            node.Info.ID = metadata.id;
        }
Esempio n. 2
0
        public static ExplorerNode GetMetaData(ExplorerNode node)
        {
            DropboxRequestAPIv2        client   = GetAPIv2(node.GetRoot.NodeType.Email);
            IDropbox_Response_MetaData metadata = client.GetMetadata(
                new Dropbox_Request_Metadata(string.IsNullOrEmpty(node.Info.ID) ? node.GetFullPathString(false, true) : "id:" + node.Info.ID));

            node.Info.Name    = metadata.name;
            node.Info.DateMod = DateTime.Parse(metadata.server_modified);
            node.Info.Size    = metadata.size;
            return(node);
        }
Esempio n. 3
0
        public static bool Move(ExplorerNode nodemove, ExplorerNode newparent, string newname = null)
        {
            if (nodemove.GetRoot.NodeType.Email != newparent.GetRoot.NodeType.Email || nodemove.GetRoot.NodeType.Type != newparent.GetRoot.NodeType.Type)
            {
                throw new Exception("Cloud not match.");
            }
            DropboxRequestAPIv2        client   = GetAPIv2(nodemove.GetRoot.NodeType.Email);
            IDropbox_Response_MetaData metadata = client.move(
                new Dropbox_Request_MoveCopy(nodemove.GetFullPathString(false),
                                             newparent.GetFullPathString(false) + "/" + newname == null ? nodemove.Info.Name : newname
                                             ));

            return(newparent.GetFullPathString(false) == metadata.path_display);
        }
Esempio n. 4
0
        public static bool Delete(ExplorerNode node, bool PernamentDelete)
        {
            DropboxRequestAPIv2 dropbox_client = GetAPIv2(node.GetRoot.NodeType.Email);
            string path = node.GetFullPathString(false);

            if (PernamentDelete)
            {
                dropbox_client.permanently_delete(new Dropbox_path(path));
                return(true);
            }
            else
            {
                IDropbox_Response_MetaData metadata = dropbox_client.delete(new Dropbox_path(path));
                return(true);
            }
        }
Esempio n. 5
0
        bool SaveUploadDropbox()
        {
            Dropbox.AutoCreateFolder(item.To.node.Parent);
            Dropbox_Request_UploadSessionFinish session_finish = new Dropbox_Request_UploadSessionFinish(
                new Dropbox_upload(item.To.node.GetFullPathString(false)),
                new Dropbox_Request_UploadSessionAppend(item.UploadID, item.SizeWasTransfer)
                );
            IDropbox_Response_MetaData json_ = ((DropboxRequestAPIv2)clientTo).upload_session_finish(session_finish);
            long size = json_.size;

            if (size == item.From.node.Info.Size)
            {
                return(true);
            }
            else
            {
                item.ErrorMsg = "File size was upload not match.";
                return(false);
            }
        }