void Parse(Func <Memory, int> process, Action <Error> report, params string[] commandLineArguments) { var arguments = new ShellArguments(folderModel, commandLineArguments); arguments.LoadMemory().Select( e => { report(e); return(1); }, process); }
/// <summary> /// Handles the files from the Shell extension. /// </summary> /// <param name="args">The command line parameters passed to the program.</param> private static void CommandShell(ConsoleArguments args) { ShellArguments arguments = (ShellArguments)args; Task task = TaskFromCommandLine(arguments); //Confirm that the user wants the erase. if (arguments.Confirm) { //Do we have a parent dialog? IWin32Window parent = null; if (!string.IsNullOrEmpty(arguments.Parent)) { //We do. Get the handle parent = new Win32Window((IntPtr)(ulong) Convert.ChangeType(arguments.Parent, typeof(ulong))); //And find the top-level window of the handle. IWin32Window topLevel = UserApi.GetAncestor(parent, UserApi.GetAncestorFlags.GA_ROOT); if (topLevel != null) { parent = topLevel; } } using (Form dialog = new ShellConfirmationDialog(task)) { if (dialog.ShowDialog(parent) != DialogResult.Yes) { return; } } } //Then queue for erasure. using (eraserClient = CommandConnect()) eraserClient.Tasks.Add(task); }