private void myFreeHttpWindow_OnUpdataFromSession(object sender, EventArgs e) { Session tempSession = Fiddler.FiddlerObject.UI.GetFirstSelectedSession(); if (tempSession != null) { ShowMes(string.Format("Get http session in {0}", tempSession.fullUrl)); ((FreeHttpWindow)sender).SetModificSession(tempSession); } else { Fiddler.FiddlerObject.UI.ShowAlert(new frmAlert("STOP", "please select a session", "OK")); //((FreeHttpWindow)sender).MarkWarnControl(Fiddler.FiddlerApplication.UI.Controls[0]); FreeHttpWindow.MarkWarnControl(Fiddler.FiddlerApplication.UI.lvSessions); } }
public ParameterPick GetParameterPickInfo() { Action <Control, string> MyThrowException = (myControl, errorMes) => { FreeHttpWindow.MarkWarnControl(myControl); this.errorProvider_addParameter.SetIconAlignment(myControl, ErrorIconAlignment.MiddleRight); this.errorProvider_addParameter.SetIconPadding(myControl, -20); this.errorProvider_addParameter.SetError(myControl, errorMes); myControl.Select(); myControl.Focus(); throw new Exception(errorMes); }; this.errorProvider_addParameter.Clear(); ParameterPick returnParameterPick = new ParameterPick(); ParameterPickType tempParameterPickType; if (string.IsNullOrEmpty(tb_ParameterName.Text)) { MyThrowException(tb_ParameterName, "your ParameterName is empty"); } returnParameterPick.ParameterName = tb_ParameterName.Text; returnParameterPick.PickRange = (ParameterPickRange)Enum.Parse(typeof(ParameterPickRange), cb_pickRange.Text); if (!Enum.TryParse <ParameterPickType>(cb_ParameterType.Text, out tempParameterPickType)) { MyThrowException(cb_ParameterType, "ParameterPickType Error"); } returnParameterPick.PickType = tempParameterPickType; returnParameterPick.PickTypeAdditional = cb_ParameterTypeAddition.Text; returnParameterPick.PickTypeExpression = tb_ParameterExpression.Text; string tempError = ParameterPickHelper.CheckParameterPickExpression(returnParameterPick); if (tempError != null) { if (tempError.Contains("PickTypeAdditional")) { MyThrowException(cb_ParameterTypeAddition, tempError); } else { MyThrowException(tb_ParameterExpression, tempError); } } return(returnParameterPick); }
void myFreeHttpWindow_OnGetSessionRawData(object sender, FreeHttpWindow.GetSessionRawDataEventArgs e) { Session tempSession = Fiddler.FiddlerObject.UI.GetFirstSelectedSession(); if (tempSession != null) { if (e.IsGetCookies) { myFreeHttpWindow.SetClientCookies(tempSession.RequestHeaders["Cookie"]); } else { string tempStr = FiddlerSessionTamper.GetSessionRawData(tempSession, e.IsShowResponse); ShowMes(tempStr == null ? "error session" : string.Format("Get Raw Data\r\n{0}", tempStr)); myFreeHttpWindow.ShowOwnerWindow(tempSession.fullUrl, tempStr); } } else { Fiddler.FiddlerObject.UI.ShowAlert(new frmAlert("STOP", "please select a session", "OK")); //((FreeHttpWindow)sender).MarkWarnControl(Fiddler.FiddlerApplication.UI.lvSessions); FreeHttpWindow.MarkWarnControl(Fiddler.FiddlerApplication.UI.lvSessions); } }