⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 敏感词过滤系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ChineseWordUnit
{
    public partial class Form1 : Form
    {
        string InitFileName = "E:\\temp\\敏感词\\敏感词\\WordFilter.txt";

        public Form1()
        {
            ChineseParse.InitFromFile(InitFileName);
            InitializeComponent();
        }

        private void btnFileOpen_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            if (opdFile.ShowDialog() == DialogResult.OK)
            {
                InitFileName = opdFile.FileName;
                try
                {
                    // Create an instance of StreamReader to read from a file.
                    // The using statement also closes the StreamReader.
                    //using (StreamReader sr = new StreamReader(opdFile.OpenFile()))
                    //{
                        //String line;
                        // Read and display lines from the file until the end of 
                        // the file is reached.
                        //while ((line = sr.ReadLine()) != null)
                        //{
                        //    sb.Append(line);
                        //    sb.Append("\n");
                        //    //Console.WriteLine(line);
                        //}
                      rtxOld.Text =  File.ReadAllText(InitFileName, Encoding.Default);
                        //rtxOld.Text = sb.ToString();
                    //}
                }
                catch (Exception ee)
                {
                    // Let the user know what went wrong.
                    Console.WriteLine("The file could not be read:");
                    Console.WriteLine(ee.Message);
                }
            }


        }

        private void btnFilter_Click(object sender, EventArgs e)
        {
            //string[] newString = ChineseParse.ParseChinese(rtxOld.Text);
            //for (int i = 0; i < newString.Length; i++ )
            //{
            //    rtxNew.Text += newString[i] + "/";
            //    //rtxNew.Text += newString[i];
                
            //}
            rtxNew.Text = ChineseParse.ParseChinese(rtxOld.Text);
        }

    }
}

⌨️ 快捷键说明

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