ArchiveComparer2.Library.ArchiveDuplicateDetector.Search C# (CSharp) Method

Search() public method

public Search ( DuplicateSearchOption option ) : List
option DuplicateSearchOption
return List
        public List<DuplicateArchiveInfoList> Search(DuplicateSearchOption option)
        {
            NotifyCaller("Target Count: " + option.Paths.Count, OperationStatus.READY);

            if (option.PreventStanby)
            {
                NotifyCaller("Disabling Sleep", OperationStatus.READY);
                Util.PreventSleep();
            }

            List<FileInfo> fileList =  BuildFileList(option);
            List<DuplicateArchiveInfo> list = CalculateCRC(fileList, option);
            List<DuplicateArchiveInfoList> dupList = BuildDuplicateList(list, option);
            dupList = CleanUpDuplicate(dupList);

            Util.AllowStanby();

            return dupList;
        }

Usage Example

Example #1
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            Logger.Debug("Hello World");

            ArchiveDuplicateDetector worker = new ArchiveDuplicateDetector();
            worker.Notify +=new ArchiveDuplicateDetector.NotifyEventHandler(worker_Notify);

            List<string> paths = new List<string>();
            paths.Add(@"D:\New Folder");
            DuplicateSearchOption option = new DuplicateSearchOption() { Paths = paths };
            List<DuplicateArchiveInfoList> list = worker.Search(option);

            foreach (var item in list)
            {
                System.Console.WriteLine(item.Original.ToString());
                foreach (var dup in item.Duplicates)
                {
                    System.Console.WriteLine(" - " + dup.ToString());
                }
            }

            System.Console.ReadLine();
        }