/// <summary> /// Start processing - delete the files specified on the command line. /// </summary> /// <param name="args">Arguments specified on the command line.</param> private static void RealMain(string[] args) { if (args.Length < 1) ExitMainWithHelp(); bool verbose = false; bool quiet = false; bool debug = false; foreach (string option in args) { if (option.Equals("/Q", StringComparison.OrdinalIgnoreCase)) quiet = true; else if (option.Equals("/V", StringComparison.OrdinalIgnoreCase)) verbose = true; else if (option.Equals("/D", StringComparison.OrdinalIgnoreCase)) debug = true; } if ((verbose || debug) && quiet) { ShowVersionInformation(); Console.Out.WriteLine("The option /Q can not be specified with /V or /D."); System.Environment.Exit(1); } if (!quiet || verbose || debug) ShowVersionInformation(); Logger.Debug = debug; Logger.Quiet = quiet; Logger.Verbose = verbose; FileDeleter deleter = new FileDeleter(); int returnCode = 0; foreach (string fileName in args) { if (!(fileName.Length == 2 && fileName.StartsWith("/", StringComparison.Ordinal))) if (!deleter.Delete(fileName)) returnCode = 1; } Logger.Log(LogLevel.Debug, string.Empty); Logger.Log(LogLevel.Debug, "Done, exiting with RC=" + returnCode); Logger.Flush(); Console.Out.WriteLine(); System.Environment.Exit(returnCode); }
/// <summary> /// Start processing - delete the files specified on the command line. /// </summary> /// <param name="args">Arguments specified on the command line.</param> private static void RealMain(string[] args) { if (args.Length < 1) { ExitMainWithHelp(); } bool verbose = false; bool quiet = false; bool debug = false; foreach (string option in args) { if (option.Equals("/Q", StringComparison.OrdinalIgnoreCase)) { quiet = true; } else if (option.Equals("/V", StringComparison.OrdinalIgnoreCase)) { verbose = true; } else if (option.Equals("/D", StringComparison.OrdinalIgnoreCase)) { debug = true; } } if ((verbose || debug) && quiet) { ShowVersionInformation(); Console.Out.WriteLine("The option /Q can not be specified with /V or /D."); System.Environment.Exit(1); } if (!quiet || verbose || debug) { ShowVersionInformation(); } Logger.Debug = debug; Logger.Quiet = quiet; Logger.Verbose = verbose; FileDeleter deleter = new FileDeleter(); int returnCode = 0; foreach (string fileName in args) { if (!(fileName.Length == 2 && fileName.StartsWith("/", StringComparison.Ordinal))) { if (!deleter.Delete(fileName)) { returnCode = 1; } } } Logger.Log(LogLevel.Debug, string.Empty); Logger.Log(LogLevel.Debug, "Done, exiting with RC=" + returnCode); Logger.Flush(); Console.Out.WriteLine(); System.Environment.Exit(returnCode); }