private void insertTable(SfxFiddlerRule rule) { //var dic = new Dictionary<string, object>() { // { "url" ,session.fullUrl }, // { "referer", session.oRequest["referer"] }, // { "status", session.responseCode}, // { "duration", (int)duration }, // { "FiddlerId", session.id }, // { "requestContent", session.GetRequestBodyAsString() }, // { "responseContent", "" }, // { "keyword", "" }, // { "insertTime", DateTime.Now }, // { "ServerGotRequestTime",session.Timers.ServerGotRequest }, // { "ServerDoneResponseTime",session.Timers.ServerDoneResponse } //}; //using (var conn = new SQLiteConnection(dataSource)) //{ // using (var cmd = new SQLiteCommand()) // { // cmd.Connection = conn; // conn.Open(); // var sh = new SQLiteHelper(cmd); // sh.Insert("", dic); // } //} }
private void LoadRules() { using (var conn = new SQLiteConnection(dataSource)) { using (var cmd = new SQLiteCommand()) { cmd.Connection = conn; conn.Open(); var sh = new SQLiteHelper(cmd); var dt = sh.Select("select * from SfxFiddlerRule"); List <SfxFiddlerRule> list = new List <SfxFiddlerRule>(); foreach (DataRow row in dt.Rows) { SfxFiddlerRule rule = new SfxFiddlerRule(); rule.Id = int.Parse(row["Id"].ToString()); rule.RuleName = row["RuleName"].ToString(); rule.StartUrl = row["StartUrl"].ToString(); rule.EndUrl = row["EndUrl"].ToString(); rule.Module = row["Module"].ToString(); rule.Version = row["Version"].ToString(); rule.InsertTime = DateTime.Parse(row["InsertTime"].ToString()); rule.EndKeyword = row["EndKeyword"].ToString(); rule.StartKeyword = row["StartKeyword"].ToString(); rule = replaceIP(rule); list.Add(rule); } cbRules.DataSource = list; cbRules.DisplayMember = "RuleName"; cbRules.ValueMember = "RuleName"; } } }
private SfxFiddlerRule replaceIP(SfxFiddlerRule rule) { rule.StartUrl = rule.StartUrl.Replace("{HISIP}", HISIP); rule.EndUrl = rule.EndUrl.Replace("{HISIP}", HISIP); return(rule); }