/// <summary> /// copy a file - the containing folder will be created if it does not exist /// </summary> /// <param name="sourceFileName">source pathname</param> /// <param name="destinationFileName">destination pathname</param> /// <param name="allowOverwrite">set to true to overwrite an existing file</param> public void FileCopy(string sourceFileName, string destinationFileName, bool allowOverwrite) { if (!MtpPath.IsMtpPath(sourceFileName) && !MtpPath.IsMtpPath(destinationFileName)) { _fileUtilities.FileCopy(sourceFileName, destinationFileName, allowOverwrite); } else { var sourceFileInfo = _fileInfoProvider.GetFileInfo(sourceFileName); using (var sourceStream = OpenReadStream(sourceFileName)) { using (var destinationStream = OpenWriteStream(destinationFileName, sourceFileInfo.Length, allowOverwrite)) { _streamHelper.Copy(sourceStream, destinationStream); } } } }