private static void NotifyCreateDirectory(NotifyCreateDirectoryCallback notifyCreateDirectory, string directoryName) { if (notifyCreateDirectory != null) { notifyCreateDirectory(directoryName); } }
public MultiThreadCopyUICommand(string source, string destination, ConfirmCopyCallback confirmCopy, ConfirmCreateDirectoryCallback confirmCreateDirectory, NotifyCopyCallback notifyCopy, NotifyCreateDirectoryCallback notifyCreateDirectory) : base(source, destination, confirmCopy, confirmCreateDirectory, notifyCopy, notifyCreateDirectory) { }
public static bool CreateDirectory(string directoryName, ConfirmCreateDirectoryCallback confirmCreateDirectory, NotifyCreateDirectoryCallback notifyCreateDirectory) { if (!Directory.Exists(directoryName)) { if (ConfirmCreateDirectory(confirmCreateDirectory, directoryName)) { Directory.CreateDirectory(directoryName); NotifyCreateDirectory(notifyCreateDirectory, directoryName); return(true); } } return(false); }
public static bool CopyDirectory(DirectoryInfo source, string destination, ConfirmCopyCallback confirmCopy, NotifyCopyCallback notifyCopy, ConfirmCreateDirectoryCallback confirmCreateDirectory, NotifyCreateDirectoryCallback notifyCreateDirectory) { if (ConfirmCopy(confirmCopy, source, destination)) { if (CreateDirectory(destination, confirmCreateDirectory, notifyCreateDirectory)) { foreach (FileSystemInfo fsi in source.GetFileSystemInfos()) { if (fsi is FileInfo) { CopyFile((FileInfo)fsi, Path.Combine(destination, fsi.Name), confirmCopy, notifyCopy); } else if (fsi is DirectoryInfo) { CopyDirectory((DirectoryInfo)source, Path.Combine(destination, source.Name), confirmCopy, notifyCopy, confirmCreateDirectory, notifyCreateDirectory); } } } NotifyCopy(notifyCopy, source, destination); return(true); } return(false); }
public static bool CopyFile <T>(FileInfo source, string destination, ref int pbCancel, T progressState, ProgressUpdate <T> progressUpdate, ConfirmCopyCallback confirmCopy, NotifyCopyCallback notifyCopy, ConfirmCreateDirectoryCallback confirmCreateDirectory, NotifyCreateDirectoryCallback notifyCreateDirectory) { string directoryName = Path.GetDirectoryName(destination); if (CreateDirectory(directoryName, confirmCreateDirectory, notifyCreateDirectory)) { return(CopyFile(source, destination, ref pbCancel, progressState, progressUpdate, confirmCopy, notifyCopy)); } return(false); }
public static bool CopyFile(FileInfo source, string destination, ConfirmCopyCallback confirmCopy, NotifyCopyCallback notifyCopy, ConfirmCreateDirectoryCallback confirmCreateDirectory, NotifyCreateDirectoryCallback notifyCreateDirectory) { string directoryName = Path.GetDirectoryName(destination); if (CreateDirectory(directoryName, confirmCreateDirectory, notifyCreateDirectory)) { return(CopyFile(source, destination, confirmCopy, notifyCopy)); } return(false); }