public static void DoClean(PerforceConnection PerforceClient, string LocalRootPath, string ClientRootPath, IReadOnlyList <string> SyncPaths, TextWriter Log) { // Figure out which folders to clean FolderToClean RootFolderToClean = new FolderToClean(new DirectoryInfo(LocalRootPath)); using (FindFoldersToCleanTask QueryWorkspace = new FindFoldersToCleanTask(PerforceClient, RootFolderToClean, ClientRootPath, SyncPaths, Log)) { string ErrorMessage; if (!ModalTaskWindow.Execute(QueryWorkspace, "Clean Workspace", "Querying files in Perforce, please wait...", out ErrorMessage)) { if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(ErrorMessage); } return; } } // If there's nothing to delete, don't bother displaying the dialog at all if (RootFolderToClean.FilesToClean.Count == 0 && RootFolderToClean.SubFolders.Count == 0) { MessageBox.Show("You have no local files which are not in Perforce.", "Workspace Clean", MessageBoxButtons.OK); return; } // Populate the tree CleanWorkspaceWindow CleanWorkspace = new CleanWorkspaceWindow(RootFolderToClean); CleanWorkspace.ShowDialog(); }
public static void DoClean(PerforceConnection PerforceClient, string LocalRootPath, string ClientRootPath, IReadOnlyList<string> SyncPaths, TextWriter Log) { // Figure out which folders to clean FolderToClean RootFolderToClean = new FolderToClean(new DirectoryInfo(LocalRootPath)); using(FindFoldersToCleanTask QueryWorkspace = new FindFoldersToCleanTask(PerforceClient, RootFolderToClean, ClientRootPath, SyncPaths, Log)) { string ErrorMessage; if(!ModalTaskWindow.Execute(QueryWorkspace, "Clean Workspace", "Querying files in Perforce, please wait...", out ErrorMessage)) { if(!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(ErrorMessage); } return; } } // If there's nothing to delete, don't bother displaying the dialog at all if(RootFolderToClean.FilesToClean.Count == 0 && RootFolderToClean.SubFolders.Count == 0) { MessageBox.Show("You have no local files which are not in Perforce.", "Workspace Clean", MessageBoxButtons.OK); return; } // Populate the tree CleanWorkspaceWindow CleanWorkspace = new CleanWorkspaceWindow(RootFolderToClean); CleanWorkspace.ShowDialog(); }