Ejemplo n.º 1
0
        private void sortByMD5ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Debugging Tool. MD5 hash groups will be returned on completion" + Environment.NewLine + "This might take a VERY long time with more than 100 files");
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                if (Checkfolder(workingFolders, folderBrowserDialog1.SelectedPath) == false)
                {
                    MessageBox.Show("Two chosen folders are the same. Please pick different folders");
                }
                else
                {
                    string fold = folderBrowserDialog1.SelectedPath;
                    Dictionary<string, int> hashCounts = new Dictionary<string, int>();
                    ImageMatcherSpeed md5Matcher = new ImageMatcherSpeed();
                    ProcceingDialog proDialog = new ProcceingDialog();
                    ThreadStart threadDelegateMD5 = delegate { md5Matcher.CheckMD5s(fold); };
                    ThreadStart threadDelegateDialog = delegate { proDialog.ShowDialog(); };
                    Thread threadMD5 = new Thread(threadDelegateMD5);
                    Thread threadDialog = new Thread(threadDelegateDialog);
                    threadMD5.Start();
                    threadDialog.Start();
                    int once = 1;
                    while (threadMD5.IsAlive)
                    {
                        Thread.Sleep(50);

                        if (proDialog.cancel == true)
                        {
                            threadMD5.Abort();
                            threadDialog.Abort();
                        }

                        if (once == 1 && md5Matcher.getProgressMax() >= 2)
                        {
                            proDialog.SetProgressMax(md5Matcher.getProgressMax());
                            once = 0;
                        }
                        proDialog.UpdateProgress(md5Matcher.getProgress());

                        if (md5Matcher.getProgress() == md5Matcher.getProgressMax())
                        {
                            threadMD5.Join();
                            threadDialog.Join();
                        }
                    }
                    threadMD5.Abort();
                    threadDialog.Abort();
                    ArrayList fingerprints = md5Matcher.GetFingerprints();
                    int i = 0;
                    foreach (string print in fingerprints)
                    {
                        int incer;
                        if (hashCounts.TryGetValue(print, out incer))
                        {
                            hashCounts[print] = incer + 1;
                        }
                        else
                        {
                            hashCounts.Add(print, 1);
                        }
                        i++;
                    }
                    ErrorDialog exp = new ErrorDialog(hashCounts);
                    exp.StartPosition = FormStartPosition.CenterParent;
                    if (exp.ShowDialog() == DialogResult.OK){}
                }
            }
        }
Ejemplo n.º 2
0
 // Triggered when picking the duplicate folder thus the finalfold
 private void finalFold()
 {
     try
     {
         processImageDirectory();
         lineCount++;
         // Recreate the logger with the new paras
         logger = new Logging(workingFolders[dupFold], storedSettings.LogValue);
         SetPicture();
     }
     catch (Exception ex)
     {
         ErrorDialog exp = new ErrorDialog(ex, "ERROR:");
         exp.StartPosition = FormStartPosition.CenterParent;
         if (exp.ShowDialog() == DialogResult.OK){}
     }
 }
Ejemplo n.º 3
0
 private void showLastErrorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ErrorDialog errorDialog = new ErrorDialog(logger.getLastError());
     errorDialog.StartPosition = FormStartPosition.CenterParent;
     if (errorDialog.ShowDialog() == DialogResult.OK){}
 }