static void Main(string[] args) { DisplayHeader(); try { var options = new ProcessingOptions(); var proceed = ProcessArguments(args, options); if (!proceed) { DisplayHelp(); return; } proceed = !(options.UpdateWindowsFiles && options.UpdateiTunesFiles); if (!proceed) { DisplayUpdatingRestrictions(); } if (options.RemoveRatingOneTracks) proceed = ConfirmDelete(); if (proceed) { var processManager = new ProcessManager(options); processManager.Execute(); } } catch (Exception exception) { Console.WriteLine(string.Empty); Console.WriteLine(exception.Message); } }
public ProcessManager(ProcessingOptions options) { _options = options; _defaultColour = System.Console.ForegroundColor; }
private static bool ProcessArguments(string[] argumentList, ProcessingOptions options) { if (argumentList.Count() <= 0) return false; var result = true; foreach (var argument in argumentList) { if (!result) break; switch (argument.ToUpper()) { case "/D": options.DisplayInformation = true; break; case "/W": options.UpdateWindowsFiles = true; break; case "/I": options.UpdateiTunesFiles = true; break; case "/REN": options.RenameFiles = true; break; case "/DEL": options.RemoveRatingOneTracks = true; break; case "/L": options.LogAllMessages = true; break; case "/LI": options.LogInformationMessages = true; break; case "/LW": options.LogWarningMessages = true; break; case "/LE": options.LogErrorMessages = true; break; default: System.Console.WriteLine(string.Format(Literals.UnknownArgument, argument)); result = false; break; } } return result; }