rtfparser.cs

来自「小型搜索软件的源代码」· CS 代码 · 共 54 行

CS
54
字号
using System;
using System.Windows.Forms;
using ShootSearch.Plugin;

namespace ShootSearch.Plugin.RTF
{
	/// <summary>
	/// Parses RTF files.
	/// </summary>
	public class RTFParser : IParserPlugin
	{
		public RTFParser()
		{
		}
		#region IParserPlugin Members

		/// <summary>
		/// This is the main parsing method. It extracts the plain text from a file.
		/// </summary>
		/// <param name="path">Full path to the file.</param>
		/// <returns>Content of the file as plain text.</returns>
		public string Extract(string path)
		{
			RichTextBox rtb = new RichTextBox();
			rtb.LoadFile(path);
			return rtb.Text;
		}

		/// <summary>
		/// You can specify the analyzer to be used for files parsed by this plugin. If you return null the default analyzer (StandardAnalyzer) will be used.
		/// </summary>
		public Lucene.Net.Analysis.Analyzer Analyzer
		{
			get
			{
				return null;
			}
		}

		/// <summary>
		/// This property should return a field of all extensions handled by this plugin.
		/// </summary>
		public string[] Extensions
		{
			get
			{
				return new string[] {".rtf"};
			}
		}

		#endregion
	}
}

⌨️ 快捷键说明

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