我在网上遵循了一个关于如何构建一个 fiddlercore C# 应用程序的教程,该应用程序获取帖子 URL 并将它们输出到 listbox1。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
delegate void UpdateUI();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Fiddler.FiddlerApplication.AfterSessionComplete += new Fiddler.SessionStateHandler(FiddlerApplication_AfterSessionComplete);
Fiddler.FiddlerApplication.Startup(0, Fiddler.FiddlerCoreStartupFlags.Default);
}
void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)
{
listBox1.Invoke(new UpdateUI(() =>
{
listBox1.Items.Add(oSession.url);
}));
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Fiddler.FiddlerApplication.Shutdown();
}
}
}
如何将此应用程序转换为仅在命令窗口项目中输出的命令项目?