/// <summary> /// 采集工作初始化 /// </summary> /// <returns></returns> private bool WorkInit() { if (ckbIsStartClearMessageBox.Checked) { rtxtMessage.Clear(); } UpdateWorkMessage("采集正在初始化...\n"); //检查输入是否合法 if (!CheckInput()) { return false; } //先保存配置 SaveConfig(true); _config = FrmFormatConfig.GetConfig(); if (_config == null) { MessageBox.Show("html格式化配置不存在,请先设置再开始", "网络采集器", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } _task = GetTaskModelFromInput(); return true; }
private void btnSubmit_Click(object sender, EventArgs e) { Config config = new Config(); config.WrapTag = txtWrapTag.Text; config.WhiteTag = txtWhiteTag.Text; config.IndentTag = txtIndentTag.Text; config.WrapTagTo = txtWrapTagTo.Text; config.WhiteTagTo = txtWhiteTagTo.Text; config.IndentTagTo = txtIndentTagTo.Text; config.OutputTitleFormat = txtOutputTitleFormat.Text; using (TextWriter writer = new StreamWriter(SysConfig.HtmlFormatConfigPath, false)) { _xmlSerializer.Serialize(writer, config); writer.Close(); } MessageBox.Show("配置已保存", "网络采集器", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); }
public Worker(HttpClient httpRequest, Config config, Task task) { _httpRequest = httpRequest; _config = config; _task = task; }