コード例 #1
0
ファイル: D7FileSynchronizer.cs プロジェクト: orf53975/ErrH
        private async Task <bool> ReplaceRemoteNode(RemoteVsLocalFile inf, CancellationToken cancelToken)
        {
            if (!await LoadFolderNodeIfNull())
            {
                return(false);
            }

            var newFid = await UploadLocalFile(inf, cancelToken);

            if (newFid <= 0)
            {
                return(false);
            }

            //inf.Status = "Getting the freshest version of the File node...";
            //var node   = await _client.Node<SyncableFileDto>(inf.Remote.Nid);
            //if (!node.IsValidNode()) return false;

            inf.Status = "Updating node to refer to newly upload file...";
            var dto = new SyncableFileDtoRevision(inf, newFid);

            if ((await _client.Put(dto, cancelToken)).IsValidNode())
            {
                inf.Status = "File uploaded; node updated.";
                return(Debug_n("Successfully updated File node.", ""));
            }
            else
            {
                return(Warn_n("Something went wrong in updating File node.", ""));
            }
        }
コード例 #2
0
ファイル: D7FileSynchronizer.cs プロジェクト: peterson1/ErrH
        private async Task<bool> ReplaceRemoteNode(RemoteVsLocalFile inf, CancellationToken cancelToken)
        {
            if (!await LoadFolderNodeIfNull()) return false;

            var newFid  = await UploadLocalFile(inf, cancelToken);
            if (newFid <= 0) return false;

            //inf.Status = "Getting the freshest version of the File node...";
            //var node   = await _client.Node<SyncableFileDto>(inf.Remote.Nid);
            //if (!node.IsValidNode()) return false;

            inf.Status = "Updating node to refer to newly upload file...";
            var dto = new SyncableFileDtoRevision(inf, newFid);
            if ((await _client.Put(dto, cancelToken)).IsValidNode())
            {
                inf.Status = "File uploaded; node updated.";
                return Debug_n("Successfully updated File node.", "");
            }
            else
                return Warn_n("Something went wrong in updating File node.", "");
        }