示例#1
0
 /*
  * 检查设置项,如果存在不符合条件的则恢复为默认值
  */
 private RunningEnv ConfigCheck(RunningEnv runningEnv)
 {
     if (runningEnv.CheckData.CheckThreshold >= 100 || runningEnv.CheckData.CheckThreshold < 1)
     {
         runningEnv.CheckData.CheckThreshold = 13;
     }
     if (runningEnv.CheckData.CheckWay != 0 && runningEnv.CheckData.CheckWay != 1)
     {
         runningEnv.CheckData.CheckWay = 0;
     }
     if (runningEnv.CheckData.MinBytes < 0)
     {
         runningEnv.CheckData.MinBytes = 0;
     }
     if (runningEnv.CheckData.MinWords < 0 || runningEnv.CheckData.MinWords > 99998)
     {
         runningEnv.CheckData.MinWords = 0;
     }
     if (runningEnv.SettingData.CheckThreadCnt >= 100 || runningEnv.SettingData.CheckThreadCnt < 1)
     {
         runningEnv.SettingData.CheckThreadCnt = 3;
     }
     if (runningEnv.SettingData.ConvertThreadCnt >= 100 || runningEnv.SettingData.ConvertThreadCnt < 1)
     {
         runningEnv.SettingData.ConvertThreadCnt = 2;
     }
     return(runningEnv);
 }
示例#2
0
        /*
         * 检查设置项,如果存在不符合条件的则恢复为默认值
         */
        private void ConfigCheck()
        {
            RunningEnv runningEnv = GetRunningEnv();

            if (runningEnv.CheckData.CheckThreshold >= 100 || runningEnv.CheckData.CheckThreshold < 1)
            {
                txtCheckThreshold.Text = "12";
            }
            if (runningEnv.CheckData.CheckWay != 0 && runningEnv.CheckData.CheckWay != 1)
            {
                cmbCheckWay.SelectedIndex = 0;
            }
            if (runningEnv.CheckData.MinBytes < 0)
            {
                txtMinBytes.Text = "1";
            }
            if (runningEnv.CheckData.MinWords < 0 || runningEnv.CheckData.MinWords > 99998)
            {
                txtMinWords.Text = "1";
            }
            if (runningEnv.SettingData.CheckThreadCnt >= 100 || runningEnv.SettingData.CheckThreadCnt < 1)
            {
                txtCheckThreadCnt.Text = "3";
            }
            if (runningEnv.SettingData.ConvertThreadCnt >= 100 || runningEnv.SettingData.ConvertThreadCnt < 1)
            {
                txtConvertThreadCnt.Text = "2";
            }
        }
示例#3
0
        /*
         * 获取当前UI的设置项的快照数据
         */
        private RunningEnv GetRunningEnv()
        {
            RunningEnv runningEnv = new RunningEnv(this);

            runningEnv.CheckData.CheckWay         = cmbCheckWay.SelectedIndex;
            runningEnv.CheckData.CheckThreshold   = int.Parse(txtCheckThreshold.Text);
            runningEnv.CheckData.Recover          = chkRecover.Checked;
            runningEnv.CheckData.StatisTable      = chkStatisTable.Checked;
            runningEnv.CheckData.ToCheckPaperPath = txtToCheckPaperPath.Text;
            runningEnv.CheckData.FinalReportPath  = txtFinalReportPath.Text;
            runningEnv.CheckData.Blocklist        = txtBlocklist.Text;

            runningEnv.LibraryData.PaperSourcePath = txtPaperSourcePath.Text;

            runningEnv.SettingData.CheckThreadCnt   = int.Parse(txtCheckThreadCnt.Text);
            runningEnv.SettingData.ConvertThreadCnt = int.Parse(txtConvertThreadCnt.Text);
            runningEnv.CheckData.MinWords           = int.Parse(txtMinWords.Text);
            runningEnv.CheckData.MinBytes           = int.Parse(txtMinBytes.Text);
            runningEnv.SettingData.SuportPdf        = chkSuportPdf.Checked;
            runningEnv.SettingData.SuportDoc        = chkSuportDoc.Checked;
            runningEnv.SettingData.SuportDocx       = chkSuportDocx.Checked;
            runningEnv.SettingData.SuportTxt        = chkSuportTxt.Checked;

            return(runningEnv);
        }
示例#4
0
        /*
         * UI快照数据还原至UI
         */
        private void RestoreRunningEnv(RunningEnv runningEnv)
        {
            cmbCheckWay.SelectedIndex = runningEnv.CheckData.CheckWay;
            txtCheckThreshold.Text    = runningEnv.CheckData.CheckThreshold.ToString();
            chkRecover.Checked        = runningEnv.CheckData.Recover;
            chkStatisTable.Checked    = runningEnv.CheckData.StatisTable;
            txtToCheckPaperPath.Text  = runningEnv.CheckData.ToCheckPaperPath;
            txtFinalReportPath.Text   = runningEnv.CheckData.FinalReportPath;

            txtPaperSourcePath.Text = runningEnv.LibraryData.PaperSourcePath;

            txtCheckThreadCnt.Text   = runningEnv.SettingData.CheckThreadCnt.ToString();
            txtConvertThreadCnt.Text = runningEnv.SettingData.ConvertThreadCnt.ToString();
            txtMinWords.Text         = runningEnv.CheckData.MinWords.ToString();
            txtMinBytes.Text         = runningEnv.CheckData.MinBytes.ToString();
            chkSuportPdf.Checked     = runningEnv.SettingData.SuportPdf;
            chkSuportDoc.Checked     = runningEnv.SettingData.SuportDoc;
            chkSuportDocx.Checked    = runningEnv.SettingData.SuportDocx;
            chkSuportTxt.Checked     = runningEnv.SettingData.SuportTxt;
        }