예제 #1
0
        public static async Task CopyFileAsync(this IFile copySource, string targetFilePath)
        {
            if (copySource == null)
            {
                throw new ArgumentNullException("copySource");
            }
            if (targetFilePath == null)
            {
                throw new ArgumentNullException("targetFilePath");
            }
            var targetFile = await PathHelper.GetOrCreateFileAsync(targetFilePath);

            await copySource.CopyFileAsync(targetFile);
        }
예제 #2
0
        public static async Task CopyFileAsync(this IFile copySource, IFolder targetFolder, CreationCollisionOption collisionOption = CreationCollisionOption.ReplaceExisting)
        {
            if (copySource == null)
            {
                throw new ArgumentNullException("copySource");
            }
            if (targetFolder == null)
            {
                throw new ArgumentNullException("targetFolder");
            }
            var targetFile = await targetFolder.CreateFileAsync(copySource.Name, collisionOption, CancellationToken.None);

            await copySource.CopyFileAsync(targetFile);
        }