deleter.cs

来自「用C#编写的一个款搜索engine的源代码!摘自<Visual c#200」· CS 代码 · 共 82 行

CS
82
字号
using System;
using System.IO;
using System.Threading;
using SECompare.Config;
using SECompare.SearchAPI;
using SECompare.Structure;

namespace SECompare.Kernel
{
	/// <summary>
	/// Summary description for Deleter.
	/// </summary>
	public class Deleter:ThreadStatus
	{

		public Deleter()
		{
			this.threadStart = new ThreadStart(Delete);
		}
	
		private void Delete()
		{
			try
			{
				//Get all samplinged queries list files
				String[] files = Directory.GetFiles((new Config.Config()).SamplingedQueryRoot);
				for(int i=0;i<files.Length;i++)
				{				
					//************Progress Status Report***********
					this.mFilePercentage = (float)i/files.Length;
					//*********************************************
					this.Delete(files[i]);
				}
				
			}
			catch(ThreadInterruptedException)
			{
			
			}
			finally
			{
				this.mIsFinished = true;
			}
		}

		/// <summary>
		/// Delete crawled data.
		/// </summary>
		/// <param name="filename">File name</param>
		private void Delete(String filename)
		{
			FileInfo file = new FileInfo(filename);
				
			//read query samples
			String category = file.Name;
			CrawlSample sample = new CrawlSample();
			sample.Load(category,filename);

			//get query strings
			String[] queries = sample.GetQueries();
			//get all selected engines
			String[] engines = this.mEngineSetting.SelectedEngines;

			for(int i=0;i<queries.Length;i++)
			{
				String words = queries[i];

				//************Progress Status Report***********
				this.mProcessingFile  = category;  
				this.mProcessingEntry = words;
				this.mEntryPercentage = (float)(i+1)/queries.Length;  
				//*********************************************
			
				//For each selected engines, delete
				foreach(String engine in engines)
					QueryRecord.Delete(words,engine);
			}

		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?