/// <summary> /// Adds the elements of a <see cref="HtmlTagBase"/> array /// to the end of the <see cref="HtmlTagBaseList"/>. /// </summary> /// <param name="array">An <see cref="Array"/> of <see cref="HtmlTagBase"/> elements /// that should be added to the end of the <see cref="HtmlTagBaseList"/>.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="array"/> is a null reference.</exception> /// <exception cref="NotSupportedException"> /// <para>The <see cref="HtmlTagBaseList"/> is read-only.</para> /// <para>-or-</para> /// <para>The <b>HtmlTagBaseList</b> has a fixed size.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.AddRange"/> for details.</remarks> public virtual void AddRange(HtmlTagBase[] array) { if (array == null) throw new ArgumentNullException("array"); if (array.Length == 0) return; if (this._count + array.Length > this._array.Length) EnsureCapacity(this._count + array.Length); ++this._version; Array.Copy(array, 0, this._array, this._count, array.Length); this._count += array.Length; }
/// <summary> /// Searches the entire sorted <see cref="HtmlTagBaseList"/> for an /// <see cref="HtmlTagBase"/> element using the default comparer /// and returns the zero-based index of the element. /// </summary> /// <param name="value">The <see cref="HtmlTagBase"/> object /// to locate in the <see cref="HtmlTagBaseList"/>. /// This argument can be a null reference. /// </param> /// <returns>The zero-based index of <paramref name="value"/> in the sorted /// <see cref="HtmlTagBaseList"/>, if <paramref name="value"/> is found; /// otherwise, a negative number, which is the bitwise complement of the index /// of the next element that is larger than <paramref name="value"/> or, if there /// is no larger element, the bitwise complement of <see cref="Count"/>.</returns> /// <exception cref="InvalidOperationException"> /// Neither <paramref name="value"/> nor the elements of the <see cref="HtmlTagBaseList"/> /// implement the <see cref="IComparable"/> interface.</exception> /// <remarks>Please refer to <see cref="ArrayList.BinarySearch"/> for details.</remarks> public virtual int BinarySearch(HtmlTagBase value) { return Array.BinarySearch(this._array, 0, this._count, value); }
public void AddHtmlTag(HtmlTagBase tag) { _tags.Add(tag); }
public override void AddRange(HtmlTagBase[] array) { throw new NotSupportedException("Read-only collections cannot be modified."); }
/// <summary> /// Inserts a <see cref="HtmlTagBase"/> element into the /// <see cref="HtmlTagBaseList"/> at the specified index. /// </summary> /// <param name="index">The zero-based index at which <paramref name="value"/> /// should be inserted.</param> /// <param name="value">The <see cref="HtmlTagBase"/> object /// to insert into the <see cref="HtmlTagBaseList"/>. /// This argument can be a null reference. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <para><paramref name="index"/> is less than zero.</para> /// <para>-or-</para> /// <para><paramref name="index"/> is greater than <see cref="Count"/>.</para> /// </exception> /// <exception cref="NotSupportedException"> /// <para>The <see cref="HtmlTagBaseList"/> is read-only.</para> /// <para>-or-</para> /// <para>The <b>HtmlTagBaseList</b> has a fixed size.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.Insert"/> for details.</remarks> public virtual void Insert(int index, HtmlTagBase value) { if (index < 0) throw new ArgumentOutOfRangeException("index", index, "Argument cannot be negative."); if (index > this._count) throw new ArgumentOutOfRangeException("index", index, "Argument cannot exceed Count."); if (this._count == this._array.Length) EnsureCapacity(this._count + 1); ++this._version; if (index < this._count) Array.Copy(this._array, index, this._array, index + 1, this._count - index); this._array[index] = value; ++this._count; }
/// <summary> /// Copies the elements of the <see cref="HtmlTagBaseList"/> to a new /// <see cref="Array"/> of <see cref="HtmlTagBase"/> elements. /// </summary> /// <returns>A one-dimensional <see cref="Array"/> of <see cref="HtmlTagBase"/> /// elements containing copies of the elements of the <see cref="HtmlTagBaseList"/>.</returns> /// <remarks>Please refer to <see cref="ArrayList.ToArray"/> for details.</remarks> public virtual HtmlTagBase[] ToArray() { HtmlTagBase[] array = new HtmlTagBase[this._count]; Array.Copy(this._array, array, this._count); return array; }
public override void CopyTo(HtmlTagBase[] array) { lock (this._root) this._collection.CopyTo(array); }
/// <summary> /// Copies the entire <see cref="HtmlTagBaseList"/> to a one-dimensional <see cref="Array"/> /// of <see cref="HtmlTagBase"/> elements, starting at the specified index of the target array. /// </summary> /// <param name="array">The one-dimensional <see cref="Array"/> that is the destination of the /// <see cref="HtmlTagBase"/> elements copied from the <see cref="HtmlTagBaseList"/>. /// The <b>Array</b> must have zero-based indexing.</param> /// <param name="arrayIndex">The zero-based index in <paramref name="array"/> /// at which copying begins.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="array"/> is a null reference.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="arrayIndex"/> is less than zero.</exception> /// <exception cref="ArgumentException"><para> /// <paramref name="arrayIndex"/> is equal to or greater than the length of <paramref name="array"/>. /// </para><para>-or-</para><para> /// The number of elements in the source <see cref="HtmlTagBaseList"/> is greater than the /// available space from <paramref name="arrayIndex"/> to the end of the destination /// <paramref name="array"/>.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.CopyTo"/> for details.</remarks> public virtual void CopyTo(HtmlTagBase[] array, int arrayIndex) { CheckTargetArray(array, arrayIndex); Array.Copy(this._array, 0, array, arrayIndex, this._count); }
public override int BinarySearch(HtmlTagBase value) { lock (this._root) return this._collection.BinarySearch(value); }
public override bool Contains(HtmlTagBase value) { lock (this._root) return this._collection.Contains(value); }
public override void AddRange(HtmlTagBase[] array) { lock (this._root) this._collection.AddRange(array); }
public override int Add(HtmlTagBase value) { lock (this._root) return this._collection.Add(value); }
public override void Remove(HtmlTagBase value) { throw new NotSupportedException("Read-only collections cannot be modified."); }
/// <summary> /// Determines whether the <see cref="HtmlTagBaseList"/> /// contains the specified <see cref="HtmlTagBase"/> element. /// </summary> /// <param name="value">The <see cref="HtmlTagBase"/> object /// to locate in the <see cref="HtmlTagBaseList"/>. /// This argument can be a null reference. /// </param> /// <returns><c>true</c> if <paramref name="value"/> is found in the /// <see cref="HtmlTagBaseList"/>; otherwise, <c>false</c>.</returns> /// <remarks>Please refer to <see cref="ArrayList.Contains"/> for details.</remarks> public virtual bool Contains(HtmlTagBase value) { return (IndexOf(value) >= 0); }
public override void CopyTo(HtmlTagBase[] array, int arrayIndex) { lock (this._root) this._collection.CopyTo(array, arrayIndex); }
/// <overloads> /// Copies the <see cref="HtmlTagBaseList"/> or a portion of it to a one-dimensional array. /// </overloads> /// <summary> /// Copies the entire <see cref="HtmlTagBaseList"/> to a one-dimensional <see cref="Array"/> /// of <see cref="HtmlTagBase"/> elements, starting at the beginning of the target array. /// </summary> /// <param name="array">The one-dimensional <see cref="Array"/> that is the destination of the /// <see cref="HtmlTagBase"/> elements copied from the <see cref="HtmlTagBaseList"/>. /// The <b>Array</b> must have zero-based indexing.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="array"/> is a null reference.</exception> /// <exception cref="ArgumentException"> /// The number of elements in the source <see cref="HtmlTagBaseList"/> is greater /// than the available space in the destination <paramref name="array"/>.</exception> /// <remarks>Please refer to <see cref="ArrayList.CopyTo"/> for details.</remarks> public virtual void CopyTo(HtmlTagBase[] array) { CheckTargetArray(array, 0); Array.Copy(this._array, array, this._count); }
public override int IndexOf(HtmlTagBase value) { lock (this._root) return this._collection.IndexOf(value); }
/// <summary> /// Returns the zero-based index of the first occurrence of the specified /// <see cref="HtmlTagBase"/> in the <see cref="HtmlTagBaseList"/>. /// </summary> /// <param name="value">The <see cref="HtmlTagBase"/> object /// to locate in the <see cref="HtmlTagBaseList"/>. /// This argument can be a null reference. /// </param> /// <returns> /// The zero-based index of the first occurrence of <paramref name="value"/> /// in the <see cref="HtmlTagBaseList"/>, if found; otherwise, -1. /// </returns> /// <remarks>Please refer to <see cref="ArrayList.IndexOf"/> for details.</remarks> public virtual int IndexOf(HtmlTagBase value) { return Array.IndexOf(this._array, value, 0, this._count); }
public override void Insert(int index, HtmlTagBase value) { lock (this._root) this._collection.Insert(index, value); }
/// <summary> /// Removes the first occurrence of the specified <see cref="HtmlTagBase"/> /// from the <see cref="HtmlTagBaseList"/>. /// </summary> /// <param name="value">The <see cref="HtmlTagBase"/> object /// to remove from the <see cref="HtmlTagBaseList"/>. /// This argument can be a null reference. /// </param> /// <exception cref="NotSupportedException"> /// <para>The <see cref="HtmlTagBaseList"/> is read-only.</para> /// <para>-or-</para> /// <para>The <b>HtmlTagBaseList</b> has a fixed size.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.Remove"/> for details.</remarks> public virtual void Remove(HtmlTagBase value) { int index = IndexOf(value); if (index >= 0) RemoveAt(index); }
public override void Remove(HtmlTagBase value) { lock (this._root) this._collection.Remove(value); }
/// <summary> /// Initializes a new instance of the <see cref="HtmlTagBaseList"/> class /// that contains elements copied from the specified <see cref="HtmlTagBase"/> /// array and that has the same initial capacity as the number of elements copied. /// </summary> /// <param name="array">An <see cref="Array"/> of <see cref="HtmlTagBase"/> /// elements that are copied to the new collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="array"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList(ICollection)"/> for details.</remarks> public HtmlTagBaseList(HtmlTagBase[] array) { if (array == null) throw new ArgumentNullException("array"); this._array = new HtmlTagBase[array.Length]; AddRange(array); }
/// <summary> /// Adds a <see cref="HtmlTagBase"/> to the end of the <see cref="HtmlTagBaseList"/>. /// </summary> /// <param name="value">The <see cref="HtmlTagBase"/> object /// to be added to the end of the <see cref="HtmlTagBaseList"/>. /// This argument can be a null reference. /// </param> /// <returns>The <see cref="HtmlTagBaseList"/> index at which the /// <paramref name="value"/> has been added.</returns> /// <exception cref="NotSupportedException"> /// <para>The <see cref="HtmlTagBaseList"/> is read-only.</para> /// <para>-or-</para> /// <para>The <b>HtmlTagBaseList</b> has a fixed size.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.Add"/> for details.</remarks> public virtual int Add(HtmlTagBase value) { if (this._count == this._array.Length) EnsureCapacity(this._count + 1); ++this._version; this._array[this._count] = value; return this._count++; }
/// <summary> /// Sets the post data value to an element tag. /// </summary> /// <param name="postData"> The post data collection.</param> /// <param name="tag"> The current tag base.</param> /// <param name="index"> The index of the element.</param> private void SetTagValue(PostDataCollection postData, HtmlTagBase tag, int index) { // // Note: The input value has to UrlDecoded. // // Input Tag if (tag is HtmlInputTag) { HtmlInputTag input=(HtmlInputTag)tag; if ( postData[input.Name] != null ) { ArrayList values = postData[input.Name]; switch ( input.Type ) { case HtmlInputType.Radio: if ( input.Checked.ToLower() == "true" ) if ( values.Count == 1 ) { input.Value = EncodeDecode.UrlDecode((string)values[0]); } if ( values.Count > 1 ) { input.Value = EncodeDecode.UrlDecode((string)values[index]); } break; default: input.Value = EncodeDecode.UrlDecode((string)values[index]); break; } } } // Button Tag if (tag is HtmlButtonTag) { HtmlButtonTag button = (HtmlButtonTag)tag; if ( postData[button.Name] != null ) { ArrayList values = postData[button.Name]; button.Value = EncodeDecode.UrlDecode((string)values[index]); } } // Select Tag if (tag is HtmlSelectTag) { HtmlSelectTag select = (HtmlSelectTag)tag; if ( postData[select.Name] != null ) { ArrayList values = postData[select.Name]; select.Value = EncodeDecode.UrlDecode((string)values[index]); } } // Textarea Tag if (tag is HtmlTextAreaTag) { HtmlTextAreaTag textarea=(HtmlTextAreaTag)tag; if ( postData[textarea.Name] != null ) { ArrayList values = postData[textarea.Name]; textarea.Value = EncodeDecode.UrlDecode((string)values[index]); } } }
/// <summary> /// Adds a common tag. /// </summary> /// <param name="form"> The HtmlFormTag.</param> /// <param name="click"> The click event source code.</param> /// <param name="id"> The element id.</param> /// <param name="name"> The element name.</param> private void AddCommonTag(HtmlFormTag form,string click,string id, string name) { //add HtmlTagBase tag = new HtmlTagBase(); tag.Id = id; tag.OnClick = click; if ( form.ContainsKey(name) ) { // just add the value HtmlTagBaseList array = ((HtmlTagBaseList)form[name]); array.Add(tag); } else { HtmlTagBaseList list = new HtmlTagBaseList(); list.Add(tag); form.Add(tag.Id,list); } }