Example #1
0
        public Task PutAsync(string targetFilename, string sourceFilePath, CancellationToken cancelToken)
        {
            string targetFilePath = GetRemoteName(targetFilename);

            if (m_moveFile)
            {
                if (systemIO.FileExists(targetFilePath))
                {
                    systemIO.FileDelete(targetFilePath);
                }

                var sourceFileInfo   = new FileInfo(sourceFilePath);
                var sourceFileLength = sourceFileInfo.Exists ? (long?)sourceFileInfo.Length : null;

                systemIO.FileMove(sourceFilePath, targetFilePath);
                if (m_verifyDestinationLength)
                {
                    VerifyMatchingSize(targetFilePath, null, sourceFileLength);
                }
            }
            else
            {
                systemIO.FileCopy(sourceFilePath, targetFilePath, true);
                if (m_verifyDestinationLength)
                {
                    VerifyMatchingSize(targetFilePath, sourceFilePath);
                }
            }

            return(Task.FromResult(true));
        }