/// <summary> /// Loads the http properties. /// </summary> /// <param name="httpProperties"> The HttpProperties type.</param> public void LoadHttpProperties(HttpProperties httpProperties) { this.RequestHeaders = httpProperties; PropertyTable bag = new PropertyTable(); string category = "Request Headers"; // string category2 = "Authentication"; //PropertySpec item = new PropertySpec("Headers",typeof(HttpPropertiesWrapper),category,"Request Headers"); PropertySpec accept = new PropertySpec("Accept", typeof(string),category); PropertySpec contentLength = new PropertySpec("Content Length",typeof(string), category); PropertySpec contentType = new PropertySpec("Content Type",typeof(string), category); PropertySpec ifModifiedSince = new PropertySpec("If Modified Since",typeof(DateTime), category); PropertySpec keepAlive = new PropertySpec("Keep Alive",typeof(bool), category); PropertySpec mediaType = new PropertySpec("Media Type",typeof(string), category); PropertySpec pipeline = new PropertySpec("Pipeline",typeof(bool), category); PropertySpec referer = new PropertySpec("Referer",typeof(string), category); PropertySpec sendChunked = new PropertySpec("Send Chunked",typeof(bool), category); PropertySpec transferEncoding = new PropertySpec("Transfer Encoding",typeof(string), category); PropertySpec userAgent = new PropertySpec("User Agent",typeof(string), category); PropertySpec timeout = new PropertySpec("Timeout",typeof(int), category); // PropertySpec addonHeaders = new PropertySpec("Additional headers",typeof(string[]), category); // PropertySpec ntlmAuth = new PropertySpec("Windows Integrated Security", typeof(bool), category2); // accept.ConverterTypeName = "Ecyware.GreenBlue.Controls.HttpPropertiesWrapper"; bag.Properties.AddRange(new PropertySpec[] {accept, contentLength, contentType, ifModifiedSince, keepAlive, mediaType, pipeline, referer, sendChunked, transferEncoding, userAgent, timeout}); bag[accept.Name] = httpProperties.Accept; bag[contentLength.Name] = httpProperties.ContentLength; bag[contentType.Name] = httpProperties.ContentType; bag[ifModifiedSince.Name] = httpProperties.IfModifiedSince; bag[keepAlive.Name] = httpProperties.KeepAlive; bag[mediaType.Name] = httpProperties.MediaType; bag[pipeline.Name] = httpProperties.Pipeline; bag[referer.Name] = httpProperties.Referer; bag[sendChunked.Name] = httpProperties.SendChunked; bag[transferEncoding.Name] = httpProperties.TransferEncoding; bag[userAgent.Name] = httpProperties.UserAgent; bag[timeout.Name] = httpProperties.Timeout; //bag[addonHeaders.Name] = new string[0]; // bag[ntlmAuth.Name] = httpProperties.AuthenticationSettings.UseNTLMAuthentication; this.pgHeaders.SelectedObject = bag; }
/// <summary> /// Adds a new header. /// </summary> private void AddNewHeader() { string name = txtHeaderName.Text; if ( _propertyTable[name] != null ) { MessageBox.Show("There is an existing header, please insert a new header name.", AppLocation.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { PropertySpec property = new PropertySpec(name,typeof(string),"Additional Headers"); _propertyTable.Properties.Add(property); _propertyTable[name] = string.Empty; this.pgHeaders.SelectedObject = _propertyTable; } }
private void ApplicationOptions_Load(object sender, System.EventArgs e) { // Load options txtUserAgent.Text = ClientSettings.UserAgent; txtContentType.Text = ClientSettings.ContentType; txtMediaType.Text = ClientSettings.MediaType; chkPipeline.Checked = ClientSettings.Pipeline; chkAllowAutoRedirects.Checked = ClientSettings.AllowAutoRedirects; maxAutoRedirects.Value = ClientSettings.MaximumAutoRedirects; chkKeepAlive.Checked = ClientSettings.KeepAlive; chkAllowWriteStreamBuffering.Checked = ClientSettings.AllowWriteStreamBuffering; if ( ClientSettings.SecurityProtocol == System.Net.SecurityProtocolType.Ssl3 ) { rbSsl.Checked = true; rbTls.Checked = false; } else { rbTls.Checked = true; rbSsl.Checked = false; } // Additional Headers for (int i=0;i<ClientSettings.AdditionalHeaders.Length;i++) { PropertySpec property = new PropertySpec(ClientSettings.AdditionalHeaders[i].Name,typeof(string),"Additional Headers"); _propertyTable.Properties.Add(property); _propertyTable[ClientSettings.AdditionalHeaders[i].Name] = ClientSettings.AdditionalHeaders[i].Value; } this.pgHeaders.SelectedObject = _propertyTable; }
public PropertySpecDescriptor(PropertySpec item, PropertyBag bag, string name, Attribute[] attrs) : base(name, attrs) { this.bag = bag; this.item = item; }
/// <summary> /// Displays the cookies. /// </summary> public void DisplayCookies() { PropertyTable bag = new PropertyTable(); string category = "Cookies"; foreach ( Cookie cookie in this.Cookies ) { PropertySpec nameItem = new PropertySpec(cookie.Name,typeof(CookieWrapper),category,"Cookie"); nameItem.ConverterTypeName = "Ecyware.GreenBlue.Controls.CookieWrapper"; PropertySpec[] items = {nameItem}; bag.Properties.AddRange(items); // add values bag[cookie.Name] = new CookieWrapper(cookie); } this.cookieProperties.SelectedObject = bag; }
/// <summary> /// Inserts a PropertySpec object into the PropertySpecCollection at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value">The PropertySpec to insert.</param> public void Insert(int index, PropertySpec value) { innerArray.Insert(index, value); }
/// <summary> /// Removes the first occurrence of a specific object from the PropertySpecCollection. /// </summary> /// <param name="obj">The PropertySpec to remove from the PropertySpecCollection.</param> public void Remove(PropertySpec obj) { innerArray.Remove(obj); }
/// <summary> /// Copies the PropertySpecCollection or a portion of it to a one-dimensional array. /// </summary> /// <param name="array">The one-dimensional Array that is the destination of the elements copied /// from the collection.</param> /// <param name="index">The zero-based index in array at which copying begins.</param> public void CopyTo(PropertySpec[] array, int index) { innerArray.CopyTo(array, index); }
/// <summary> /// Searches for the specified PropertySpec and returns the zero-based index of the first /// occurrence within the entire PropertySpecCollection. /// </summary> /// <param name="value">The PropertySpec to locate in the PropertySpecCollection.</param> /// <returns>The zero-based index of the first occurrence of value within the entire PropertySpecCollection, /// if found; otherwise, -1.</returns> public int IndexOf(PropertySpec value) { return innerArray.IndexOf(value); }
/// <summary> /// Determines whether a PropertySpec is in the PropertySpecCollection. /// </summary> /// <param name="item">The PropertySpec to locate in the PropertySpecCollection. The element to locate /// can be a null reference (Nothing in Visual Basic).</param> /// <returns>true if item is found in the PropertySpecCollection; otherwise, false.</returns> public bool Contains(PropertySpec item) { return innerArray.Contains(item); }
/// <summary> /// Copies the entire PropertySpecCollection to a compatible one-dimensional Array, starting at the /// beginning of the target array. /// </summary> /// <param name="array">The one-dimensional Array that is the destination of the elements copied /// from PropertySpecCollection. The Array must have zero-based indexing.</param> public void CopyTo(PropertySpec[] array) { innerArray.CopyTo(array); }
/// <summary> /// Adds the elements of an array of PropertySpec objects to the end of the PropertySpecCollection. /// </summary> /// <param name="array">The PropertySpec array whose elements should be added to the end of the /// PropertySpecCollection.</param> public void AddRange(PropertySpec[] array) { innerArray.AddRange(array); }
/// <summary> /// Adds a PropertySpec to the end of the PropertySpecCollection. /// </summary> /// <param name="value">The PropertySpec to be added to the end of the PropertySpecCollection.</param> /// <returns>The PropertySpecCollection index at which the value has been added.</returns> public int Add(PropertySpec value) { int index = innerArray.Add(value); return index; }
/// <summary> /// Initializes a new instance of the PropertySpecEventArgs class. /// </summary> /// <param name="property">The PropertySpec that represents the property whose /// value is being requested or set.</param> /// <param name="val">The current value of the property.</param> public PropertySpecEventArgs(PropertySpec property, object val) { this.property = property; this.val = val; }
/// <summary> /// Adds the cookie collection to the property grid. /// </summary> /// <param name="cookies"> The cookies.</param> private void SetCookies(Ecyware.GreenBlue.Engine.Scripting.Cookie[] cookies) { PropertyTable bag = new PropertyTable(); bag.Properties.Clear(); // bag.GetValue += new PropertySpecEventHandler(bag_GetValue); // bag.SetValue += new PropertySpecEventHandler(bag_SetValue); string category = "Cookies"; foreach ( Ecyware.GreenBlue.Engine.Scripting.Cookie cookie in cookies ) { PropertySpec nameItem = new PropertySpec(cookie.Name,typeof(CookieWrapper),category,"Cookie"); nameItem.ConverterTypeName = "Ecyware.GreenBlue.Controls.CookieWrapperExtended"; PropertySpec[] items = {nameItem}; bag.Properties.AddRange(items); // add values bag[cookie.Name] = new CookieWrapperExtended(cookie); } this.pgCookies.SelectedObject = bag; }
/// <summary> /// Adds the cookie collection to the property grid. /// </summary> /// <param name="cookies"> The cookies.</param> public void SetCookies(CookieCollection cookies) { // Set current cookies Cookies = cookies; PropertyTable bag = new PropertyTable(); // bag.GetValue += new PropertySpecEventHandler(bag_GetValue); // bag.SetValue += new PropertySpecEventHandler(bag_SetValue); string category = "Cookies"; foreach ( Cookie cookie in cookies ) { PropertySpec nameItem = new PropertySpec(cookie.Name,typeof(CookieWrapper),category,"Cookie"); nameItem.ConverterTypeName = "Ecyware.GreenBlue.Controls.CookieWrapper"; PropertySpec[] items = {nameItem}; bag.Properties.AddRange(items); // // add values bag[cookie.Name] = new CookieWrapper(cookie); } this.cookieProperties.SelectedObject = bag; }