void HandleAllDataChanges() { if (this.ReadOnly) { return; } if (HeadersChanged || BodyChanged || UrlPathPartsChanged || QueryParametersChanged || BodyParametersChanged || CookieParametersChanged || HeadersParametersChanged) { ShowStatusMsg(""); } if (HeadersChanged) { Request NewRequest = new Request(HeadersTBP.GetText(), UseSSLCB.Checked); if (DisplayedRequest.HasBody) { if (DisplayedRequest.IsBinary) { NewRequest.BodyArray = BodyTBP.GetBytes(); } else { NewRequest.BodyString = BodyTBP.GetText(); } } this.DisplayedRequest = NewRequest; SetUrlPathPartsParameters(this.DisplayedRequest); SetQueryParameters(this.DisplayedRequest); SetCookieParameters(this.DisplayedRequest); SetHeadersParameters(this.DisplayedRequest); ResetHeadersChangedStatus(); ResetUrlPathPartsChangedStatus(); ResetQueryParametersChangedStatus(); ResetCookieParametersChangedStatus(); ResetHeadersParametersChangedStatus(); } if (BodyChanged && this.DisplayedRequest != null) { if (BodyTBP.IsBinary) { this.DisplayedRequest.BodyArray = BodyTBP.GetBytes(); } else { this.DisplayedRequest.BodyString = BodyTBP.GetText(); } AutoDetectFormatAndSetBodyParameters(this.DisplayedRequest); //SetBodyParameters(this.DisplayedRequest); ClearBodyTypeFormatPluginsUi(); ResetBodyChangedStatus(); ResetBodyParametersChangedStatus(); } if (UrlPathPartsChanged && this.DisplayedRequest != null) { List <string> UrlPathParts = new List <string>(); foreach (DataGridViewRow Row in UrlPathPartsParametersGrid.Rows) { if (Row.Cells[1].Value == null) { UrlPathParts.Add(""); } else { UrlPathParts.Add(Row.Cells[1].Value.ToString()); } } this.DisplayedRequest.UrlPathParts = UrlPathParts; HeadersTBP.SetText(this.DisplayedRequest.GetHeadersAsStringWithoutFullURL()); ResetHeadersChangedStatus(); ResetUrlPathPartsChangedStatus(); } if (QueryParametersChanged && this.DisplayedRequest != null) { this.DisplayedRequest.Query.RemoveAll(); foreach (DataGridViewRow Row in QueryParametersGrid.Rows) { if (Row.Cells[1].Value == null) { this.DisplayedRequest.Query.Add(Row.Cells[0].Value.ToString(), ""); } else { this.DisplayedRequest.Query.Add(Row.Cells[0].Value.ToString(), Row.Cells[1].Value.ToString()); } } this.HeadersTBP.SetText(this.DisplayedRequest.GetHeadersAsStringWithoutFullURL()); ResetHeadersChangedStatus(); ResetQueryParametersChangedStatus(); } if (CookieParametersChanged && this.DisplayedRequest != null) { this.DisplayedRequest.Cookie.RemoveAll(); foreach (DataGridViewRow Row in CookieParametersGrid.Rows) { if (Row.Cells[1].Value == null) { this.DisplayedRequest.Cookie.Add(Row.Cells[0].Value.ToString(), ""); } else { this.DisplayedRequest.Cookie.Add(Row.Cells[0].Value.ToString(), Row.Cells[1].Value.ToString()); } } this.HeadersTBP.SetText(this.DisplayedRequest.GetHeadersAsStringWithoutFullURL()); ResetHeadersChangedStatus(); ResetCookieParametersChangedStatus(); } if (HeadersParametersChanged && this.DisplayedRequest != null) { foreach (string Name in this.DisplayedRequest.Headers.GetNames()) { if (Name != "Cookie") { this.DisplayedRequest.Headers.Remove(Name); } } foreach (DataGridViewRow Row in HeadersParametersGrid.Rows) { if (Row.Cells[1].Value == null) { this.DisplayedRequest.Headers.Add(Row.Cells[0].Value.ToString(), ""); } else { this.DisplayedRequest.Headers.Add(Row.Cells[0].Value.ToString(), Row.Cells[1].Value.ToString()); } } this.HeadersTBP.SetText(this.DisplayedRequest.GetHeadersAsStringWithoutFullURL()); ResetHeadersChangedStatus(); ResetHeadersParametersChangedStatus(); } if (BodyParametersChanged && this.DisplayedRequest != null) { if (GetSelectedFormatPluginName() == "Normal") { this.DisplayedRequest.Body.RemoveAll(); foreach (DataGridViewRow Row in BodyParametersGrid.Rows) { if (Row.Cells[1].Value == null) { this.DisplayedRequest.Body.Add(Row.Cells[0].Value.ToString(), ""); } else { this.DisplayedRequest.Body.Add(Row.Cells[0].Value.ToString(), Row.Cells[1].Value.ToString()); } } this.BodyTBP.SetText(this.DisplayedRequest.BodyString); ResetBodyChangedStatus(); ResetBodyParametersChangedStatus(); //ClearBodyTypeFormatPluginsUi(); } else { string[,] EditedNameValuePairs = new string[BodyParametersGrid.Rows.Count, 2]; foreach (DataGridViewRow Row in BodyParametersGrid.Rows) { EditedNameValuePairs[Row.Index, 0] = Row.Cells[0].Value.ToString(); if (Row.Cells[1].Value == null) { EditedNameValuePairs[Row.Index, 1] = ""; } else { EditedNameValuePairs[Row.Index, 1] = Row.Cells[1].Value.ToString(); } } string PluginName = GetSelectedFormatPluginName(); if (PluginName.Length > 0) { SerializeNewParametersWithFormatPlugin(EditedNameValuePairs, PluginName); } ResetBodyParametersChangedStatus(); } } //if (BodyTypeFormatPluginsParametersChanged && this.DisplayedRequest != null) //{ // string[,] EditedNameValuePairs = new string[BodyParametersGrid.Rows.Count, 2]; // foreach (DataGridViewRow Row in BodyParametersGrid.Rows) // { // EditedNameValuePairs[Row.Index, 0] = Row.Cells[0].Value.ToString(); // if (Row.Cells[1].Value == null) // EditedNameValuePairs[Row.Index, 1] = ""; // else // EditedNameValuePairs[Row.Index, 1] = Row.Cells[1].Value.ToString(); // } // string PluginName = GetSelectedFormatPluginName(); // if(PluginName.Length > 0) // SerializeNewParametersWithFormatPlugin(EditedNameValuePairs, PluginName); // ResetBodyTypeFormatPluginsParametersChangedStatus(); //} if (UseSslChanged && this.DisplayedRequest != null) { this.DisplayedRequest.SSL = UseSSLCB.Checked; ResetSslChangedStatus(); } }
void HandleAllDataChanges() { if (this.ReadOnly) { return; } if (HeadersChanged || BodyChanged) { ShowStatusMsg(""); } if (HeadersChanged) { Response NewResponse; if (DisplayedResponse.HasBody) { if (DisplayedResponse.IsBinary) { NewResponse = new Response(HeadersTBP.GetText(), BodyTBP.GetBytes()); } else { NewResponse = new Response(HeadersTBP.GetText(), BodyTBP.GetText()); } } else { NewResponse = new Response(HeadersTBP.GetText(), new byte[] {}); } this.DisplayedResponse = NewResponse; ResetHeadersChangedStatus(); } if (BodyChanged && this.DisplayedResponse != null) { if (BodyTBP.IsBinary) { this.DisplayedResponse.BodyArray = BodyTBP.GetBytes(); } else { this.DisplayedResponse.BodyString = BodyTBP.GetText(); } AutoDetectFormatAndSetBodyParameters(this.DisplayedResponse); ResetBodyChangedStatus(); CheckAndShowReflection(); } if (BodyTypeFormatPluginsParametersChanged && this.DisplayedResponse != null) { string[,] EditedNameValuePairs = new string[BodyFormatPluginsParametersGrid.Rows.Count, 2]; foreach (DataGridViewRow Row in BodyFormatPluginsParametersGrid.Rows) { EditedNameValuePairs[Row.Index, 0] = Row.Cells[0].Value.ToString(); if (Row.Cells[1].Value == null) { EditedNameValuePairs[Row.Index, 1] = ""; } else { EditedNameValuePairs[Row.Index, 1] = Row.Cells[1].Value.ToString(); } } string PluginName = GetSelectedFormatPluginName(); if (PluginName.Length > 0) { SerializeNewParametersWithFormatPlugin(EditedNameValuePairs, PluginName); } ResetBodyTypeFormatPluginsParametersChangedStatus(); } }