コード例 #1
0
 private void _updateUI(UIDataPackage info)
 {
     if (info.CurrentAction == ScanAction.Prescan)
     {
         lStatus.Text      = "Pre-scanning...";
         progressBar.Style = ProgressBarStyle.Marquee;
         lScanned.Text     = String.Format("Found {0} files", info.PreliminaryFilesFound.ToString("#,##"));
     }
     else if (info.CurrentAction == ScanAction.ScanComplete)
     {
         lStatus.Text = "Scan Complete!";
     }
     else
     {
         progressBar.Style   = ProgressBarStyle.Continuous;
         progressBar.Maximum = info.TotalFiles;
         progressBar.Value   = info.CompletedFiles;
         lStatus.Text        = "Scanning...";
         lScanned.Text       = String.Format("{0} / {1} Files scanned", info.CompletedFiles, info.TotalFiles);
         lRemaining.Text     = String.Format("{0} Files remaining", (info.TotalFiles - info.CompletedFiles));
         lPercent.Text       = String.Format("{0}%", (int)(((float)info.CompletedFiles / (float)info.TotalFiles) * 100));
         lDuplicates.Text    = String.Format("{0} Duplicate files", info.DuplicatesFound);
     }
     Application.DoEvents();
 }
コード例 #2
0
ファイル: Progress.cs プロジェクト: qJake/dupe-list
 public void UpdateUI(UIDataPackage info)
 {
     if (InvokeRequired)
     {
         Invoke((MethodInvoker)delegate()
         {
             _updateUI(info);
         });
     }
     else
     {
         _updateUI(info);
     }
 }
コード例 #3
0
 public void UpdateUI(UIDataPackage info)
 {
     if (InvokeRequired)
     {
         Invoke((MethodInvoker) delegate()
         {
             _updateUI(info);
         });
     }
     else
     {
         _updateUI(info);
     }
 }
コード例 #4
0
        private void ScanForDuplicates(string loc)
        {
            uiData = new UIDataPackage();

            uiData.CurrentAction = ScanAction.Prescan;
            updateUI(uiData);

            Hashtable prelimFiles = new Hashtable();
            int       FileCount   = GetFileCount(loc, ref prelimFiles);

            // create list of files to scan here
            List <string> filesToScan = new List <string>();

            foreach (DictionaryEntry kv in prelimFiles)
            {
                if (((List <string>)kv.Value).Count > 1)
                {
                    filesToScan.AddRange((List <string>)kv.Value);
                }
            }

            uiData.TotalFiles    = filesToScan.Count;
            uiData.CurrentAction = ScanAction.Scan;
            updateUI(uiData);

            Hashtable result = new Hashtable();

            GetFileHashtable(filesToScan, ref result);

            uiData.CurrentAction = ScanAction.ScanComplete;
            updateUI(uiData);

            List <List <string> > dupes = new List <List <string> >();

            foreach (DictionaryEntry kv in result)
            {
                if (((List <string>)kv.Value).Count > 1)
                {
                    dupes.Add((List <string>)kv.Value);
                }
            }

            if (OnFinishedProcessing != null)
            {
                OnFinishedProcessing(dupes);
            }
        }
コード例 #5
0
        private void ScanForDuplicates(string loc)
        {
            uiData = new UIDataPackage();

            uiData.CurrentAction = ScanAction.Prescan;
            updateUI(uiData);

            Hashtable prelimFiles = new Hashtable();
            int       FileCount   = GetFileCount(loc, ref prelimFiles);

            // create list of files to scan here
            List <string> filesToScan = new List <string>();

            foreach (DictionaryEntry kv in prelimFiles)
            {
                if (((List <string>)kv.Value).Count > 1)
                {
                    filesToScan.AddRange((List <string>)kv.Value);
                }
            }

            uiData.TotalFiles    = filesToScan.Count;
            uiData.CurrentAction = ScanAction.Scan;
            updateUI(uiData);

            Hashtable result = new Hashtable();

            GetFileHashtable(filesToScan, ref result, ref abortScanningFlag);

            uiData.CurrentAction = ScanAction.ScanComplete;
            updateUI(uiData);

            ArrayList keys = new ArrayList(result.Keys);

            foreach (var index in keys)
            {
                if (((List <string>)result[index]).Count == 1)
                {
                    result.Remove(index);
                }
            }

            if (OnFinishedProcessing != null)
            {
                OnFinishedProcessing(result);
            }
        }
コード例 #6
0
ファイル: Progress.cs プロジェクト: qJake/dupe-list
 private void _updateUI(UIDataPackage info)
 {
     if (info.CurrentAction == ScanAction.Prescan)
     {
         lStatus.Text = "Pre-scanning...";
         progressBar.Style = ProgressBarStyle.Marquee;
         lScanned.Text = String.Format("Found {0} files", info.PreliminaryFilesFound.ToString("#,##"));
     }
     else if (info.CurrentAction == ScanAction.ScanComplete)
     {
         lStatus.Text = "Scan Complete!";
     }
     else
     {
         progressBar.Style = ProgressBarStyle.Continuous;
         progressBar.Maximum = info.TotalFiles;
         progressBar.Value = info.CompletedFiles;
         lStatus.Text = "Scanning...";
         lScanned.Text = String.Format("{0} / {1} Files scanned", info.CompletedFiles, info.TotalFiles);
         lRemaining.Text = String.Format("{0} Files remaining", (info.TotalFiles - info.CompletedFiles));
         lPercent.Text = String.Format("{0}%", (int)(((float)info.CompletedFiles / (float)info.TotalFiles) * 100));
         lDuplicates.Text = String.Format("{0} Duplicate files", info.DuplicatesFound);
     }
     Application.DoEvents();
 }
コード例 #7
0
ファイル: DuplicateScanner.cs プロジェクト: qJake/dupe-list
        private void ScanForDuplicates(string loc)
        {
            uiData = new UIDataPackage();

            uiData.CurrentAction = ScanAction.Prescan;
            updateUI(uiData);

            Hashtable prelimFiles = new Hashtable();
            int FileCount = GetFileCount(loc, ref prelimFiles);

            // create list of files to scan here
            List<string> filesToScan = new List<string>();
            foreach (DictionaryEntry kv in prelimFiles)
            {
                if (((List<string>)kv.Value).Count > 1 )
                {
                    filesToScan.AddRange((List<string>)kv.Value);
                }
            }

            uiData.TotalFiles = filesToScan.Count;
            uiData.CurrentAction = ScanAction.Scan;
            updateUI(uiData);

            Hashtable result = new Hashtable();
            GetFileHashtable(filesToScan, ref result);

            uiData.CurrentAction = ScanAction.ScanComplete;
            updateUI(uiData);

            List<List<string>> dupes = new List<List<string>>();

            foreach (DictionaryEntry kv in result)
            {
                if (((List<string>)kv.Value).Count > 1)
                {
                    dupes.Add((List<string>)kv.Value);
                }
            }

            if (OnFinishedProcessing != null)
            {
                OnFinishedProcessing(dupes);
            }
        }