/// <summary> /// Background Worker processor /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string[] files = e.Argument as string[]; BackgroundWorker wrk = sender as BackgroundWorker; int i = 0; SetButton1Visiblablity(false); foreach (string fn in files) { if (wrk.CancellationPending) { e.Cancel = true; break; } backgroundWorker1.ReportProgress(1, fn); try { if (hoot.IsIndexed(fn) == false) { using (TextReader tf = File.OpenText(fn)) { string s = ""; if (tf != null) { s = tf.ReadToEnd(); } if (s != "") { if (Path.GetExtension(fn).Equals(".html", StringComparison.OrdinalIgnoreCase)) { hoot.Index(new myDoc(new FileInfo(fn), s), true, new HtmlFilter()); } else { hoot.Index(new myDoc(new FileInfo(fn), s), true); } } } } } catch { } i++; if (i > 1000) { i = 0; hoot.Save(); } backgroundWorker1.ReportProgress(1, "File Load Complete."); } hoot.Save(); SetButton1Visiblablity(true); //hoot.OptimizeIndex(); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string[] files = e.Argument as string[]; BackgroundWorker wrk = sender as BackgroundWorker; int i = 0; foreach (string fn in files) { if (wrk.CancellationPending) { e.Cancel = true; break; } backgroundWorker1.ReportProgress(1, fn); try { if (hoot.IsIndexed(fn) == false) { using (TextReader tf = new EPocalipse.IFilter.FilterReader(fn)) { string s = ""; if (tf != null) { s = tf.ReadToEnd(); } if (s != "") { hoot.Index(new myDoc(new FileInfo(fn), s), true); } } } } catch { } i++; if (i > 1000) { i = 0; hoot.Save(); } } hoot.Save(); //hoot.OptimizeIndex(); }