Friday, July 19, 2019

Essay --

/* * Copyright 2005 dotlucene.net * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Diagnostics; using System.Drawing; using System.IO; using System.Windows.Forms; using Lucene.Net.Analysis.Standard; using Lucene.Net.Documents; using Lucene.Net.Index; using Lucene.Net.QueryParsers; using Lucene.Net.Search; using DesktopSearch1.Icons; using DesktopSearch1.Parsing; namespace DesktopSearch1 { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private string pathIndex; private IndexWriter indexWriter; private string[] patterns = {"*.doc", "*.xls", "*.ppt", "*.htm", "*.txt"}; private SystemImageList imageListDocuments; private IndexSearcher searcher = null; // statistics private long bytesTotal = 0; private int countTotal = 0; private int countSkipped = 0; private System.Windows.Forms.TextBox textBoxPath; private System.Windows.Forms.Button buttonBrowse; private System.Windows.Forms.Button buttonIndex; private System.Windows.Forms.Label labelStatus; private System.Windows.Forms.TextBox textBoxQuery; private System.Windows.Forms.Button buttonSearch; private System.Windows.Forms.ListView listViewResults; ... ...ond) { return first } private void listViewResults_DoubleClick(object sender, System.EventArgs e) { if (this.listViewResults.SelectedItems.Count != 1) return; string path = (string) this.listViewResults.SelectedItems[0].Tag; Process.Start(path); } private void textBoxQuery_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) search(); } private void buttonBrowse_Click(object sender, System.EventArgs e) { this.folderBrowserDialog1.SelectedPath = this.textBoxPath.Text; if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK) { this.textBoxPath.Text = this.folderBrowserDialog1.SelectedPath; } } private void buttonClean_Click(object sender, System.EventArgs e) { Directory.Delete(this.pathIndex, true); checkIndex(); } } }

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.