private void qqbot_Exited(object sender, EventArgs e) { qqbot.CancelOutputRead(); status = qqbotStatus.shutdown; start.Enabled = false; lookup.Enabled = false; runqq.Text = "启动机器人"; }
private void grabHTML_Load(object sender, EventArgs e) { uri = new Uri(Properties.Settings.Default.html); js = File.ReadAllText("readInfo.js"); index[0] = int.MaxValue; htmlpath.Text = Properties.Settings.Default.html; qqbotpath.Text = Properties.Settings.Default.qqbot; status = qqbotStatus.shutdown; start.Enabled = false; webBrowser.ScriptErrorsSuppressed = true; }
private void runqq_Click(object sender, EventArgs e) { if (status != qqbotStatus.shutdown) { stopqq(); } else { if (!File.Exists(qqbotpath.Text.Trim() + "\\qq.exe") || !File.Exists(qqbotpath.Text.Trim() + "\\qqbot.exe")) { MessageBox.Show("不是正确的qqbot路径"); return; } Properties.Settings.Default.qqbot = qqbotpath.Text.Trim(); Properties.Settings.Default.Save(); qq.StartInfo.FileName = qqbotpath.Text.Trim() + "\\qq.exe"; qq.StartInfo.UseShellExecute = false; qq.StartInfo.CreateNoWindow = true; qq.StartInfo.RedirectStandardOutput = true; qq.StartInfo.RedirectStandardError = true; qq.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; qqbot.StartInfo.FileName = qqbotpath.Text.Trim() + "\\qqbot.exe"; qqbot.StartInfo.UseShellExecute = false; qqbot.StartInfo.CreateNoWindow = true; qqbot.StartInfo.RedirectStandardOutput = true; qqbot.StartInfo.RedirectStandardError = true; qqbot.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; qqbot.Start(); qqbot.BeginOutputReadLine(); status = qqbotStatus.running; qqbotid = qqbot.Id; runqq.Enabled = false; start.Enabled = true; lookup.Enabled = true; } }