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

📄 frmoption.cs

📁 用C#编写的一个款搜索engine的源代码!摘自<Visual c#2005 程序设计>
💻 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;
using System.Collections;

namespace SECompare.Forms
{
    public partial class FrmOption : Form
    {
        public FrmOption()
        {
            InitializeComponent();
            //Load <Crawler DIR> Clip
            this.Load_Crawler_DIR();
        }

        #region Crawler DIR Page

        //***************************Crawler DIR Page**********************

        private void Load_Crawler_DIR()
        {
            this.txtAppPath.Text = Directory.GetCurrentDirectory();
            Config.Config config = new Config.Config();
            this.txtDataRoot.Text = config.DataRoot;
            this.txtSampleRoot.Text = config.SampleRoot;
            this.txtSamplingedQueryRoot.Text = config.SamplingedQueryRoot;
        }


        private void btnCheckRoots_Click(object sender, System.EventArgs e)
        {
            StringBuilder sb = new StringBuilder(128);
            if (!Directory.Exists(this.txtSampleRoot.Text))
                sb.Append("Sample Root does not exist!\n");
            if (!Directory.Exists(this.txtSamplingedQueryRoot.Text))
                sb.Append("Samplinged Query Root does not exist!\n");
            if (!Directory.Exists(this.txtDataRoot.Text))
                sb.Append("Data Root does not exist!\n");

            if (sb.ToString().Length != 0)
                MessageBox.Show(sb.ToString() + "If you apply, the folders will be created.", "Directory Not Exist!");
            else
            {
                MessageBox.Show("All folders exist.", "Directory Exist");
            }
        }

        private void btnOK_Crawler_DIR()
        {
            Config.Config config = new Config.Config();
            config.DataRoot = this.txtDataRoot.Text;
            config.SampleRoot = this.txtSampleRoot.Text;
            config.SamplingedQueryRoot = this.txtSamplingedQueryRoot.Text;
            config.Save();
        }

        #endregion


        #region "OK" "Cancel" "Apply" Buttons

        //******************* "OK" "Cancel" "Apply" Buttons   ******************

        private void btnOK_Click(object sender, System.EventArgs e)
        {
            this.btnApply_Click(sender, e);
            this.Dispose();
        }

        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            this.Dispose();
        }

        private void btnApply_Click(object sender, System.EventArgs e)
        {
            this.btnOK_Crawler_DIR();
        }

        #endregion
    }
}

⌨️ 快捷键说明

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