/// <summary> /// This program finds an executable on the PATH. It can also find other stuff on the path, but /// mostly it finds the executable.s /// </summary> /// <param name="args"></param> private void Run(string[] args) { Console.OutputEncoding = Encoding.GetEncoding(Encoding.Default.CodePage); Args = new InputArgs("ddupe", string.Format(resource.IDS_TITLE, AppVersion.Get()) + "\r\n" + resource.IDS_COPYRIGHT); Args.Add(InputArgType.Flag, "recursive", false, Presence.Optional, resource.IDS_CMD_recursive_doc); Args.Add(InputArgType.Flag, "rename", false, Presence.Optional, resource.IDS_CMD_rename_doc); Args.Add(InputArgType.Parameter, "cache", null, Presence.Optional, resource.IDS_CMD_cache_doc); Args.Add(InputArgType.Flag, "delete", false, Presence.Optional, resource.IDS_CMD_delete_doc); Args.Add(InputArgType.SizeInBytes, "minsize", 0, Presence.Optional, resource.IDS_CMD_minsize_doc); Args.Add(InputArgType.RemainingParameters, "DIR {DIR}", null, Presence.Required, resource.IDS_CMD_dir_doc); if (Args.Process(args)) { UseDatabase = DatabaseCache.Initialize(Args.GetString("cache"), Cache); Recursive = Args.GetFlag("recursive"); RenameFiles = Args.GetFlag("rename"); DeleteFiles = Args.GetFlag("delete"); MinSize = Args.GetSizeInBytes("minsize"); foreach (string directory in Args.GetStringList("DIR {DIR}")) { Read(SanitizeInput(directory)); } } if (FilesChecked > 0) { DatabaseCache.Flush(); TimeSpan elapsed = DateTime.Now - StartupTime; Console.WriteLine("____________________________________________________________________________________"); Console.WriteLine(resource.IDS_finished, elapsed); Console.WriteLine(resource.IDS_total_checked, FilesChecked, BytesAsString(BytesChecked), HashesRead, TimeSpentCalculatingMD5s); if (RenameFiles) { Console.WriteLine(resource.IDS_total_renamed, FilesRenamed, BytesAsString(BytesRenamed)); Console.WriteLine(resource.IDS_total_hashes, RenamedHashes, BytesAsString(RenamedBytes)); } Console.WriteLine(resource.IDS_total_dupes, FilesDetected, BytesAsString(BytesDetected), ((double)FilesDetected) / ((double)FilesChecked), ((double)BytesDetected) / ((double)BytesChecked)); } }