using System;
using System.Collections;
namespace System.ComponentModel
{
/// Represents a collection of objects.
// Token: 0x020000B6 RID: 182
public class PropertyDescriptorCollection : ICollection, IDictionary, IEnumerable, IList
{
/// Initializes a new instance of the class.
/// An array of type that provides the properties for this collection.
// Token: 0x060005F0 RID: 1520 RVA: 0x0000F54C File Offset: 0x0000D74C
public PropertyDescriptorCollection(PropertyDescriptor[] properties)
{
this.properties = new ArrayList();
if (properties == null)
{
return;
}
this.properties.AddRange(properties);
}
/// Initializes a new instance of the class, which is optionally read-only.
/// An array of type that provides the properties for this collection.
/// If true, specifies that the collection cannot be modified.
// Token: 0x060005F1 RID: 1521 RVA: 0x0000F580 File Offset: 0x0000D780
public PropertyDescriptorCollection(PropertyDescriptor[] properties, bool readOnly)
: this(properties)
{
this.readOnly = readOnly;
}
// Token: 0x060005F2 RID: 1522 RVA: 0x0000F590 File Offset: 0x0000D790
private PropertyDescriptorCollection()
{
}
/// Adds an item to the .
/// The position into which the new element was inserted.
/// The item to add to the collection.
// Token: 0x060005F4 RID: 1524 RVA: 0x0000F5A8 File Offset: 0x0000D7A8
int IList.Add(object value)
{
return this.Add((PropertyDescriptor)value);
}
/// Adds an element with the provided key and value to the .
/// The to use as the key of the element to add.
/// The to use as the value of the element to add.
/// The collection is read-only.
///
/// is null.
// Token: 0x060005F5 RID: 1525 RVA: 0x0000F5B8 File Offset: 0x0000D7B8
void IDictionary.Add(object key, object value)
{
if (!(value is PropertyDescriptor))
{
throw new ArgumentException("value");
}
this.Add((PropertyDescriptor)value);
}
/// Removes all items from the collection.
/// The collection is read-only.
// Token: 0x060005F6 RID: 1526 RVA: 0x0000F5E0 File Offset: 0x0000D7E0
void IList.Clear()
{
this.Clear();
}
/// Removes all elements from the .
// Token: 0x060005F7 RID: 1527 RVA: 0x0000F5E8 File Offset: 0x0000D7E8
void IDictionary.Clear()
{
this.Clear();
}
/// Determines whether the collection contains a specific value.
/// true if the item is found in the collection; otherwise, false.
/// The item to locate in the collection.
// Token: 0x060005F8 RID: 1528 RVA: 0x0000F5F0 File Offset: 0x0000D7F0
bool IList.Contains(object value)
{
return this.Contains((PropertyDescriptor)value);
}
/// Determines whether the contains an element with the specified key.
/// true if the contains an element with the key; otherwise, false.
/// The key to locate in the .
// Token: 0x060005F9 RID: 1529 RVA: 0x0000F600 File Offset: 0x0000D800
bool IDictionary.Contains(object value)
{
return this.Contains((PropertyDescriptor)value);
}
/// Returns an for the .
/// An for the .
// Token: 0x060005FA RID: 1530 RVA: 0x0000F610 File Offset: 0x0000D810
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// Returns an enumerator for this class.
/// An enumerator of type .
// Token: 0x060005FB RID: 1531 RVA: 0x0000F618 File Offset: 0x0000D818
[global::System.MonoTODO]
IDictionaryEnumerator IDictionary.GetEnumerator()
{
throw new NotImplementedException();
}
/// Determines the index of a specified item in the collection.
/// The index of if found in the list, otherwise -1.
/// The item to locate in the collection.
// Token: 0x060005FC RID: 1532 RVA: 0x0000F620 File Offset: 0x0000D820
int IList.IndexOf(object value)
{
return this.IndexOf((PropertyDescriptor)value);
}
/// Inserts an item into the collection at a specified index.
/// The zero-based index at which should be inserted.
/// The item to insert into the collection.
/// The collection is read-only.
// Token: 0x060005FD RID: 1533 RVA: 0x0000F630 File Offset: 0x0000D830
void IList.Insert(int index, object value)
{
this.Insert(index, (PropertyDescriptor)value);
}
/// Removes the element with the specified key from the .
/// The key of the element to remove.
// Token: 0x060005FE RID: 1534 RVA: 0x0000F640 File Offset: 0x0000D840
void IDictionary.Remove(object value)
{
this.Remove((PropertyDescriptor)value);
}
/// Removes the first occurrence of a specified value from the collection.
/// The item to remove from the collection.
/// The collection is read-only.
// Token: 0x060005FF RID: 1535 RVA: 0x0000F650 File Offset: 0x0000D850
void IList.Remove(object value)
{
this.Remove((PropertyDescriptor)value);
}
/// Removes the item at the specified index.
/// The zero-based index of the item to remove.
/// The collection is read-only.
// Token: 0x06000600 RID: 1536 RVA: 0x0000F660 File Offset: 0x0000D860
void IList.RemoveAt(int index)
{
this.RemoveAt(index);
}
/// Gets a value indicating whether the has a fixed size.
/// true if the has a fixed size; otherwise, false.
// Token: 0x1700018D RID: 397
// (get) Token: 0x06000601 RID: 1537 RVA: 0x0000F66C File Offset: 0x0000D86C
bool IDictionary.IsFixedSize
{
get
{
return ((IList)this).IsFixedSize;
}
}
/// Gets a value indicating whether the collection has a fixed size.
/// true if the collection has a fixed size; otherwise, false.
// Token: 0x1700018E RID: 398
// (get) Token: 0x06000602 RID: 1538 RVA: 0x0000F674 File Offset: 0x0000D874
bool IList.IsFixedSize
{
get
{
return this.readOnly;
}
}
/// Gets a value indicating whether the is read-only.
/// true if the is read-only; otherwise, false.
// Token: 0x1700018F RID: 399
// (get) Token: 0x06000603 RID: 1539 RVA: 0x0000F67C File Offset: 0x0000D87C
bool IDictionary.IsReadOnly
{
get
{
return ((IList)this).IsReadOnly;
}
}
/// Gets a value indicating whether the collection is read-only.
/// true if the collection is read-only; otherwise, false.
// Token: 0x17000190 RID: 400
// (get) Token: 0x06000604 RID: 1540 RVA: 0x0000F684 File Offset: 0x0000D884
bool IList.IsReadOnly
{
get
{
return this.readOnly;
}
}
/// Gets a value indicating whether access to the collection is synchronized (thread safe).
/// true if access to the collection is synchronized (thread safe); otherwise, false.
// Token: 0x17000191 RID: 401
// (get) Token: 0x06000605 RID: 1541 RVA: 0x0000F68C File Offset: 0x0000D88C
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// Gets the number of elements contained in the collection.
/// The number of elements contained in the collection.
// Token: 0x17000192 RID: 402
// (get) Token: 0x06000606 RID: 1542 RVA: 0x0000F690 File Offset: 0x0000D890
int ICollection.Count
{
get
{
return this.Count;
}
}
/// Gets an object that can be used to synchronize access to the collection.
/// An object that can be used to synchronize access to the collection.
// Token: 0x17000193 RID: 403
// (get) Token: 0x06000607 RID: 1543 RVA: 0x0000F698 File Offset: 0x0000D898
object ICollection.SyncRoot
{
get
{
return null;
}
}
/// Gets an containing the keys of the .
/// An containing the keys of the .
// Token: 0x17000194 RID: 404
// (get) Token: 0x06000608 RID: 1544 RVA: 0x0000F69C File Offset: 0x0000D89C
ICollection IDictionary.Keys
{
get
{
string[] array = new string[this.properties.Count];
int num = 0;
foreach (object obj in this.properties)
{
PropertyDescriptor propertyDescriptor = (PropertyDescriptor)obj;
array[num++] = propertyDescriptor.Name;
}
return array;
}
}
/// Gets an containing the values in the .
/// An containing the values in the .
// Token: 0x17000195 RID: 405
// (get) Token: 0x06000609 RID: 1545 RVA: 0x0000F728 File Offset: 0x0000D928
ICollection IDictionary.Values
{
get
{
return (ICollection)this.properties.Clone();
}
}
/// Gets or sets the element with the specified key.
/// The element with the specified key.
/// The key of the element to get or set.
// Token: 0x17000196 RID: 406
object IDictionary.this[object key]
{
get
{
if (!(key is string))
{
return null;
}
return this[(string)key];
}
set
{
if (this.readOnly)
{
throw new NotSupportedException();
}
if (!(key is string) || !(value is PropertyDescriptor))
{
throw new ArgumentException();
}
int num = this.properties.IndexOf(value);
if (num == -1)
{
this.Add((PropertyDescriptor)value);
}
else
{
this.properties[num] = value;
}
}
}
/// Gets or sets an item from the collection at a specified index.
/// The element at the specified index.
/// The zero-based index of the item to get or set.
/// The collection is read-only.
///
/// is not a .
///
/// is less than 0. -or- is equal to or greater than .
// Token: 0x17000197 RID: 407
object IList.this[int index]
{
get
{
return this.properties[index];
}
set
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.properties[index] = value;
}
}
/// Adds the specified to the collection.
/// The index of the that was added to the collection.
/// The to add to the collection.
/// The collection is read-only.
// Token: 0x0600060E RID: 1550 RVA: 0x0000F7F8 File Offset: 0x0000D9F8
public int Add(PropertyDescriptor value)
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.properties.Add(value);
return this.properties.Count - 1;
}
/// Removes all objects from the collection.
/// The collection is read-only.
// Token: 0x0600060F RID: 1551 RVA: 0x0000F828 File Offset: 0x0000DA28
public void Clear()
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.properties.Clear();
}
/// Returns whether the collection contains the given .
/// true if the collection contains the given ; otherwise, false.
/// The to find in the collection.
// Token: 0x06000610 RID: 1552 RVA: 0x0000F848 File Offset: 0x0000DA48
public bool Contains(PropertyDescriptor value)
{
return this.properties.Contains(value);
}
/// Copies the entire collection to an array, starting at the specified index number.
/// An array of objects to copy elements of the collection to.
/// The index of the parameter at which copying begins.
// Token: 0x06000611 RID: 1553 RVA: 0x0000F858 File Offset: 0x0000DA58
public void CopyTo(Array array, int index)
{
this.properties.CopyTo(array, index);
}
/// Returns the with the specified name, using a Boolean to indicate whether to ignore case.
/// A with the specified name, or null if the property does not exist.
/// The name of the to return from the collection.
/// true if you want to ignore the case of the property name; otherwise, false.
// Token: 0x06000612 RID: 1554 RVA: 0x0000F868 File Offset: 0x0000DA68
public virtual PropertyDescriptor Find(string name, bool ignoreCase)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
for (int i = 0; i < this.properties.Count; i++)
{
PropertyDescriptor propertyDescriptor = (PropertyDescriptor)this.properties[i];
if (ignoreCase)
{
if (string.Compare(name, propertyDescriptor.Name, StringComparison.OrdinalIgnoreCase) == 0)
{
return propertyDescriptor;
}
}
else if (string.Compare(name, propertyDescriptor.Name, StringComparison.Ordinal) == 0)
{
return propertyDescriptor;
}
}
return null;
}
/// Returns an enumerator for this class.
/// An enumerator of type .
// Token: 0x06000613 RID: 1555 RVA: 0x0000F8E8 File Offset: 0x0000DAE8
public virtual IEnumerator GetEnumerator()
{
return this.properties.GetEnumerator();
}
/// Returns the index of the given .
/// The index of the given .
/// The to return the index of.
// Token: 0x06000614 RID: 1556 RVA: 0x0000F8F8 File Offset: 0x0000DAF8
public int IndexOf(PropertyDescriptor value)
{
return this.properties.IndexOf(value);
}
/// Adds the to the collection at the specified index number.
/// The index at which to add the parameter to the collection.
/// The to add to the collection.
/// The collection is read-only.
// Token: 0x06000615 RID: 1557 RVA: 0x0000F908 File Offset: 0x0000DB08
public void Insert(int index, PropertyDescriptor value)
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.properties.Insert(index, value);
}
/// Removes the specified from the collection.
/// The to remove from the collection.
/// The collection is read-only.
// Token: 0x06000616 RID: 1558 RVA: 0x0000F928 File Offset: 0x0000DB28
public void Remove(PropertyDescriptor value)
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.properties.Remove(value);
}
/// Removes the at the specified index from the collection.
/// The index of the to remove from the collection.
/// The collection is read-only.
// Token: 0x06000617 RID: 1559 RVA: 0x0000F948 File Offset: 0x0000DB48
public void RemoveAt(int index)
{
if (this.readOnly)
{
throw new NotSupportedException();
}
this.properties.RemoveAt(index);
}
// Token: 0x06000618 RID: 1560 RVA: 0x0000F968 File Offset: 0x0000DB68
private PropertyDescriptorCollection CloneCollection()
{
return new PropertyDescriptorCollection
{
properties = (ArrayList)this.properties.Clone()
};
}
/// Sorts the members of this collection, using the default sort for this collection, which is usually alphabetical.
/// A new that contains the sorted objects.
// Token: 0x06000619 RID: 1561 RVA: 0x0000F994 File Offset: 0x0000DB94
public virtual PropertyDescriptorCollection Sort()
{
PropertyDescriptorCollection propertyDescriptorCollection = this.CloneCollection();
propertyDescriptorCollection.InternalSort(null);
return propertyDescriptorCollection;
}
/// Sorts the members of this collection, using the specified .
/// A new that contains the sorted objects.
/// A comparer to use to sort the objects in this collection.
// Token: 0x0600061A RID: 1562 RVA: 0x0000F9B0 File Offset: 0x0000DBB0
public virtual PropertyDescriptorCollection Sort(IComparer comparer)
{
PropertyDescriptorCollection propertyDescriptorCollection = this.CloneCollection();
propertyDescriptorCollection.InternalSort(comparer);
return propertyDescriptorCollection;
}
/// Sorts the members of this collection. The specified order is applied first, followed by the default sort for this collection, which is usually alphabetical.
/// A new that contains the sorted objects.
/// An array of strings describing the order in which to sort the objects in this collection.
// Token: 0x0600061B RID: 1563 RVA: 0x0000F9CC File Offset: 0x0000DBCC
public virtual PropertyDescriptorCollection Sort(string[] order)
{
PropertyDescriptorCollection propertyDescriptorCollection = this.CloneCollection();
propertyDescriptorCollection.InternalSort(order);
return propertyDescriptorCollection;
}
/// Sorts the members of this collection. The specified order is applied first, followed by the sort using the specified .
/// A new that contains the sorted objects.
/// An array of strings describing the order in which to sort the objects in this collection.
/// A comparer to use to sort the objects in this collection.
// Token: 0x0600061C RID: 1564 RVA: 0x0000F9E8 File Offset: 0x0000DBE8
public virtual PropertyDescriptorCollection Sort(string[] order, IComparer comparer)
{
PropertyDescriptorCollection propertyDescriptorCollection = this.CloneCollection();
if (order != null)
{
ArrayList arrayList = propertyDescriptorCollection.ExtractItems(order);
propertyDescriptorCollection.InternalSort(comparer);
arrayList.AddRange(propertyDescriptorCollection.properties);
propertyDescriptorCollection.properties = arrayList;
}
else
{
propertyDescriptorCollection.InternalSort(comparer);
}
return propertyDescriptorCollection;
}
/// Sorts the members of this collection, using the specified .
/// A comparer to use to sort the objects in this collection.
// Token: 0x0600061D RID: 1565 RVA: 0x0000FA34 File Offset: 0x0000DC34
protected void InternalSort(IComparer ic)
{
if (ic == null)
{
ic = MemberDescriptor.DefaultComparer;
}
this.properties.Sort(ic);
}
/// Sorts the members of this collection. The specified order is applied first, followed by the default sort for this collection, which is usually alphabetical.
/// An array of strings describing the order in which to sort the objects in this collection.
// Token: 0x0600061E RID: 1566 RVA: 0x0000FA50 File Offset: 0x0000DC50
protected void InternalSort(string[] order)
{
if (order != null)
{
ArrayList arrayList = this.ExtractItems(order);
this.InternalSort(null);
arrayList.AddRange(this.properties);
this.properties = arrayList;
}
else
{
this.InternalSort(null);
}
}
// Token: 0x0600061F RID: 1567 RVA: 0x0000FA94 File Offset: 0x0000DC94
private ArrayList ExtractItems(string[] names)
{
ArrayList arrayList = new ArrayList(this.properties.Count);
object[] array = new object[names.Length];
for (int i = 0; i < this.properties.Count; i++)
{
PropertyDescriptor propertyDescriptor = (PropertyDescriptor)this.properties[i];
int num = Array.IndexOf(names, propertyDescriptor.Name);
if (num != -1)
{
array[num] = propertyDescriptor;
this.properties.RemoveAt(i);
i--;
}
}
foreach (object obj in array)
{
if (obj != null)
{
arrayList.Add(obj);
}
}
return arrayList;
}
// Token: 0x06000620 RID: 1568 RVA: 0x0000FB48 File Offset: 0x0000DD48
internal PropertyDescriptorCollection Filter(Attribute[] attributes)
{
ArrayList arrayList = new ArrayList();
foreach (object obj in this.properties)
{
PropertyDescriptor propertyDescriptor = (PropertyDescriptor)obj;
if (propertyDescriptor.Attributes.Contains(attributes))
{
arrayList.Add(propertyDescriptor);
}
}
PropertyDescriptor[] array = new PropertyDescriptor[arrayList.Count];
arrayList.CopyTo(array);
return new PropertyDescriptorCollection(array, true);
}
/// Gets the number of property descriptors in the collection.
/// The number of property descriptors in the collection.
// Token: 0x17000198 RID: 408
// (get) Token: 0x06000621 RID: 1569 RVA: 0x0000FBEC File Offset: 0x0000DDEC
public int Count
{
get
{
return this.properties.Count;
}
}
/// Gets or sets the with the specified name.
/// The with the specified name, or null if the property does not exist.
/// The name of the to get from the collection.
// Token: 0x17000199 RID: 409
public virtual PropertyDescriptor this[string s]
{
get
{
return this.Find(s, false);
}
}
/// Gets or sets the at the specified index number.
/// The with the specified index number.
/// The zero-based index of the to get or set.
/// The parameter is not a valid index for .
// Token: 0x1700019A RID: 410
public virtual PropertyDescriptor this[int index]
{
get
{
return (PropertyDescriptor)this.properties[index];
}
}
/// Specifies an empty collection that you can use instead of creating a new one with no items. This static field is read-only.
// Token: 0x040001C0 RID: 448
public static readonly PropertyDescriptorCollection Empty = new PropertyDescriptorCollection(null, true);
// Token: 0x040001C1 RID: 449
private ArrayList properties;
// Token: 0x040001C2 RID: 450
private bool readOnly;
}
}