private void testFilenameListToolStripMenuItem_Click(object sender, EventArgs e) { FileTester tester = new FileTester(); if (tester.ShowDialog() == DialogResult.OK) { if (!SetOperationRunning()) return; //reset in eventhandler HashSet<String> dirs = new HashSet<string>(); HashSet<String> files = new HashSet<string>(); HashSet<String> exts = new HashSet<string>(); string outputFileRoot = null; hashDic.CreateHelpers(); if (tester.knownDirBox.Checked) dirs.UnionWith(hashDic.DirListing); if (tester.customDirBox.Checked) AddToHashSetFromFile(dirs, tester.customDirFile); if (tester.knownFileBox.Checked) files.UnionWith(hashDic.FileListing); if (tester.customFileBox.Checked) { AddToHashSetFromFile(files, tester.customFileFile); if (!tester.knownFileBox.Checked) // special case where we only test custom files { outputFileRoot = tester.customFileFile; if (Path.HasExtension(outputFileRoot)) outputFileRoot = Path.GetDirectoryName(outputFileRoot) + "\\" + Path.GetFileNameWithoutExtension(outputFileRoot); } } if (tester.knownExtBox.Checked) exts.UnionWith(hashDic.ExtListing); if (tester.customExtBox.Checked) AddToHashSetFromFile(exts, tester.customExtFile); ThreadParam threadParam = new ThreadParam(dirs, files, exts, 0, 0, outputFileRoot); statusPB.Visible = true; statusPB.Maximum = ((dirs.Count == 0) ? 1 : dirs.Count) * ((exts.Count == 0) ? 1 : exts.Count); statusPB.Value = 0; hashCreator.event_FilenameTest += FilenameTestEventHandler; //reset in eventhandler t_worker = new Thread(new ParameterizedThreadStart(hashCreator.ParseDirFilenamesAndExtension)); t_worker.Start(threadParam); } }
private void testFilenameListToolStripMenuItem_Click(object sender, EventArgs e) { FileTester tester = new FileTester(); if (tester.ShowDialog() == DialogResult.OK) { if (!SetOperationRunning()) { return; //reset in eventhandler } HashSet <String> dirs = new HashSet <string>(); HashSet <String> files = new HashSet <string>(); HashSet <String> exts = new HashSet <string>(); string outputFileRoot = null; hashDic.CreateHelpers(); if (tester.knownDirBox.Checked) { dirs.UnionWith(hashDic.DirListing); } if (tester.customDirBox.Checked) { AddToHashSetFromFile(dirs, tester.customDirFile); } if (tester.knownFileBox.Checked) { files.UnionWith(hashDic.FileListing); } if (tester.customFileBox.Checked) { AddToHashSetFromFile(files, tester.customFileFile); if (!tester.knownFileBox.Checked) // special case where we only test custom files { outputFileRoot = tester.customFileFile; if (Path.HasExtension(outputFileRoot)) { outputFileRoot = Path.GetDirectoryName(outputFileRoot) + "\\" + Path.GetFileNameWithoutExtension(outputFileRoot); } } } if (tester.knownExtBox.Checked) { exts.UnionWith(hashDic.ExtListing); } if (tester.customExtBox.Checked) { AddToHashSetFromFile(exts, tester.customExtFile); } ThreadParam threadParam = new ThreadParam(dirs, files, exts, 0, 0, outputFileRoot); statusPB.Visible = true; statusPB.Maximum = ((dirs.Count == 0) ? 1 : dirs.Count) * ((exts.Count == 0) ? 1 : exts.Count); statusPB.Value = 0; hashCreator.event_FilenameTest += FilenameTestEventHandler; //reset in eventhandler t_worker = new Thread(new ParameterizedThreadStart(hashCreator.ParseDirFilenamesAndExtension)); t_worker.Start(threadParam); } }