///<summary>The first parameter, 'sourceFileName', must be a file that exists.</summary> public static void Copy(string sourceFileName, string destinationFileName, FileAtoZSourceDestination sourceDestination, string uploadMessage = "Copying file...", bool isFolder = false) { if (CloudStorage.IsCloudStorage) { sourceFileName = CloudStorage.PathTidy(sourceFileName); destinationFileName = CloudStorage.PathTidy(destinationFileName); FormProgress FormP = CreateFormProgress(uploadMessage, isFolder); OpenDentalCloud.TaskState state; if (sourceDestination == FileAtoZSourceDestination.AtoZToAtoZ) { state = CloudStorage.CopyAsync(sourceFileName, destinationFileName, new OpenDentalCloud.ProgressHandler(FormP.OnProgress)); } else if (sourceDestination == FileAtoZSourceDestination.LocalToAtoZ) { state = CloudStorage.UploadAsync(Path.GetDirectoryName(destinationFileName), Path.GetFileName(destinationFileName), File.ReadAllBytes(sourceFileName), new OpenDentalCloud.ProgressHandler(FormP.OnProgress)); } else if (sourceDestination == FileAtoZSourceDestination.AtoZToLocal) { state = CloudStorage.DownloadAsync(Path.GetDirectoryName(sourceFileName), Path.GetFileName(sourceFileName), new OpenDentalCloud.ProgressHandler(FormP.OnProgress)); } else { throw new Exception("Unsupported " + nameof(FileAtoZSourceDestination) + ": " + sourceDestination); } FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.Cancel) { state.DoCancel = true; return; } if (sourceDestination == FileAtoZSourceDestination.AtoZToLocal) { File.WriteAllBytes(destinationFileName, ((OpenDentalCloud.Core.TaskStateDownload)state).FileContent); } } else //Not cloud { File.Copy(sourceFileName, destinationFileName); } }