FubarDev.FtpServer.FileSystem.OneDrive.OneDriveFileSystem.ReplaceAsync C# (CSharp) Method

ReplaceAsync() public method

public ReplaceAsync ( IUnixFileEntry fileEntry, Stream data, CancellationToken cancellationToken ) : Task
fileEntry IUnixFileEntry
data Stream
cancellationToken System.Threading.CancellationToken
return Task
        public async Task<IBackgroundTransfer> ReplaceAsync(IUnixFileEntry fileEntry, Stream data, CancellationToken cancellationToken)
        {
            var fileItem = ((OneDriveFileEntry)fileEntry).Item;
            var parentId = fileItem.ParentReference.Id;
            var fileName = fileItem.Name;
            var tempData = await _supportFactory.CreateTemporaryData(data, cancellationToken);
            var targetId = GetFileId(parentId, fileName);
            var backgroundUploads = new BackgroundUpload(targetId, parentId, fileName, tempData, this);
            await _uploadsLock.WaitAsync(cancellationToken);
            try
            {
                var fileId = GetFileId(parentId, fileName);
                _uploads.Add(fileId, backgroundUploads);
            }
            finally
            {
                _uploadsLock.Release();
            }
            return backgroundUploads;
        }