using System; using System.Collections; using System.Runtime.InteropServices; namespace System.ComponentModel { /// Represents a collection of objects. // Token: 0x0200007F RID: 127 [ComVisible(true)] public class EventDescriptorCollection : ICollection, IEnumerable, IList { // Token: 0x06000476 RID: 1142 RVA: 0x0000D09C File Offset: 0x0000B29C private EventDescriptorCollection() { } // Token: 0x06000477 RID: 1143 RVA: 0x0000D0B0 File Offset: 0x0000B2B0 internal EventDescriptorCollection(ArrayList list) { this.eventList = list; } /// Initializes a new instance of the class with the given array of objects. /// An array of type that provides the events for this collection. // Token: 0x06000478 RID: 1144 RVA: 0x0000D0CC File Offset: 0x0000B2CC public EventDescriptorCollection(EventDescriptor[] events) : this(events, false) { } /// Initializes a new instance of the class with the given array of objects. The collection is optionally read-only. /// An array of type that provides the events for this collection. /// true to specify a read-only collection; otherwise, false. // Token: 0x06000479 RID: 1145 RVA: 0x0000D0D8 File Offset: 0x0000B2D8 public EventDescriptorCollection(EventDescriptor[] events, bool readOnly) { this.isReadOnly = readOnly; if (events == null) { return; } for (int i = 0; i < events.Length; i++) { this.Add(events[i]); } } /// Removes all the items from the collection. /// The collection is read-only. // Token: 0x0600047B RID: 1147 RVA: 0x0000D134 File Offset: 0x0000B334 void IList.Clear() { this.Clear(); } /// Returns an enumerator that iterates through a collection. /// An that can be used to iterate through the collection. // Token: 0x0600047C RID: 1148 RVA: 0x0000D13C File Offset: 0x0000B33C IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } /// Removes the item at the specified index. /// The zero-based index of the item to remove. /// The collection is read-only. // Token: 0x0600047D RID: 1149 RVA: 0x0000D144 File Offset: 0x0000B344 void IList.RemoveAt(int index) { this.RemoveAt(index); } /// Gets the number of elements contained in the collection. /// The number of elements contained in the collection. // Token: 0x1700012E RID: 302 // (get) Token: 0x0600047E RID: 1150 RVA: 0x0000D150 File Offset: 0x0000B350 int ICollection.Count { get { return this.Count; } } /// Adds an item to the collection. /// The position into which the new element was inserted. /// The to add to the collection. /// The collection is read-only. // Token: 0x0600047F RID: 1151 RVA: 0x0000D158 File Offset: 0x0000B358 int IList.Add(object value) { return this.Add((EventDescriptor)value); } /// Determines whether the collection contains a specific value. /// true if the is found in the collection; otherwise, false. /// The to locate in the collection. // Token: 0x06000480 RID: 1152 RVA: 0x0000D168 File Offset: 0x0000B368 bool IList.Contains(object value) { return this.Contains((EventDescriptor)value); } /// Determines the index of a specific item in the collection. /// The index of if found in the list; otherwise, -1. /// The to locate in the collection. // Token: 0x06000481 RID: 1153 RVA: 0x0000D178 File Offset: 0x0000B378 int IList.IndexOf(object value) { return this.IndexOf((EventDescriptor)value); } /// Inserts an item to the collection at the specified index. /// The zero-based index at which should be inserted. /// The to insert into the collection. /// The collection is read-only. // Token: 0x06000482 RID: 1154 RVA: 0x0000D188 File Offset: 0x0000B388 void IList.Insert(int index, object value) { this.Insert(index, (EventDescriptor)value); } /// Removes the first occurrence of a specific object from the collection. /// The to remove from the collection. /// The collection is read-only. // Token: 0x06000483 RID: 1155 RVA: 0x0000D198 File Offset: 0x0000B398 void IList.Remove(object value) { this.Remove((EventDescriptor)value); } /// Gets a value indicating whether the collection has a fixed size. /// true if the collection has a fixed size; otherwise, false. // Token: 0x1700012F RID: 303 // (get) Token: 0x06000484 RID: 1156 RVA: 0x0000D1A8 File Offset: 0x0000B3A8 bool IList.IsFixedSize { get { return this.isReadOnly; } } /// Gets a value indicating whether the collection is read-only. /// true if the collection is read-only; otherwise, false. // Token: 0x17000130 RID: 304 // (get) Token: 0x06000485 RID: 1157 RVA: 0x0000D1B0 File Offset: 0x0000B3B0 bool IList.IsReadOnly { get { return this.isReadOnly; } } /// Gets or sets the element at the specified index. /// The element at the specified index. /// The zero-based index of the element to get or set. /// The collection is read-only. /// /// is less than 0. -or- is equal to or greater than . // Token: 0x17000131 RID: 305 object IList.this[int index] { get { return this.eventList[index]; } set { if (this.isReadOnly) { throw new NotSupportedException("The collection is read-only"); } this.eventList[index] = value; } } /// Copies the elements of the collection to an , starting at a particular index. /// The one-dimensional that is the destination of the elements copied from collection. The must have zero-based indexing. /// The zero-based index in at which copying begins. // Token: 0x06000488 RID: 1160 RVA: 0x0000D1F0 File Offset: 0x0000B3F0 void ICollection.CopyTo(Array array, int index) { this.eventList.CopyTo(array, index); } /// Gets a value indicating whether access to the collection is synchronized. /// true if access to the collection is synchronized; otherwise, false. // Token: 0x17000132 RID: 306 // (get) Token: 0x06000489 RID: 1161 RVA: 0x0000D200 File Offset: 0x0000B400 bool ICollection.IsSynchronized { get { return false; } } /// 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: 0x17000133 RID: 307 // (get) Token: 0x0600048A RID: 1162 RVA: 0x0000D204 File Offset: 0x0000B404 object ICollection.SyncRoot { get { return null; } } /// Adds an to the end of the collection. /// The position of the within the collection. /// An to add to the collection. /// The collection is read-only. // Token: 0x0600048B RID: 1163 RVA: 0x0000D208 File Offset: 0x0000B408 public int Add(EventDescriptor value) { if (this.isReadOnly) { throw new NotSupportedException("The collection is read-only"); } return this.eventList.Add(value); } /// Removes all objects from the collection. /// The collection is read-only. // Token: 0x0600048C RID: 1164 RVA: 0x0000D238 File Offset: 0x0000B438 public void Clear() { if (this.isReadOnly) { throw new NotSupportedException("The collection is read-only"); } this.eventList.Clear(); } /// Returns whether the collection contains the given . /// true if the collection contains the parameter given; otherwise, false. /// The to find within the collection. // Token: 0x0600048D RID: 1165 RVA: 0x0000D25C File Offset: 0x0000B45C public bool Contains(EventDescriptor value) { return this.eventList.Contains(value); } /// Gets the description of the event with the specified name in the collection. /// The with the specified name, or null if the event does not exist. /// The name of the event to get from the collection. /// true if you want to ignore the case of the event; otherwise, false. // Token: 0x0600048E RID: 1166 RVA: 0x0000D26C File Offset: 0x0000B46C public virtual EventDescriptor Find(string name, bool ignoreCase) { foreach (object obj in this.eventList) { EventDescriptor eventDescriptor = (EventDescriptor)obj; if (ignoreCase) { if (string.Compare(name, eventDescriptor.Name, StringComparison.OrdinalIgnoreCase) == 0) { return eventDescriptor; } } else if (string.Compare(name, eventDescriptor.Name, StringComparison.Ordinal) == 0) { return eventDescriptor; } } return null; } /// Gets an enumerator for this . /// An enumerator that implements . // Token: 0x0600048F RID: 1167 RVA: 0x0000D314 File Offset: 0x0000B514 public IEnumerator GetEnumerator() { return this.eventList.GetEnumerator(); } /// Returns the index of the given . /// The index of the given within the collection. /// The to find within the collection. // Token: 0x06000490 RID: 1168 RVA: 0x0000D324 File Offset: 0x0000B524 public int IndexOf(EventDescriptor value) { return this.eventList.IndexOf(value); } /// Inserts an to the collection at a specified index. /// The index within the collection in which to insert the parameter. /// An to insert into the collection. /// The collection is read-only. // Token: 0x06000491 RID: 1169 RVA: 0x0000D334 File Offset: 0x0000B534 public void Insert(int index, EventDescriptor value) { if (this.isReadOnly) { throw new NotSupportedException("The collection is read-only"); } this.eventList.Insert(index, value); } /// Removes the specified from the collection. /// The to remove from the collection. /// The collection is read-only. // Token: 0x06000492 RID: 1170 RVA: 0x0000D35C File Offset: 0x0000B55C public void Remove(EventDescriptor value) { if (this.isReadOnly) { throw new NotSupportedException("The collection is read-only"); } this.eventList.Remove(value); } /// Removes the at the specified index from the collection. /// The index of the to remove. /// The collection is read-only. // Token: 0x06000493 RID: 1171 RVA: 0x0000D38C File Offset: 0x0000B58C public void RemoveAt(int index) { if (this.isReadOnly) { throw new NotSupportedException("The collection is read-only"); } this.eventList.RemoveAt(index); } /// Sorts the members of this , using the default sort for this collection, which is usually alphabetical. /// The new . // Token: 0x06000494 RID: 1172 RVA: 0x0000D3BC File Offset: 0x0000B5BC public virtual EventDescriptorCollection Sort() { EventDescriptorCollection eventDescriptorCollection = this.CloneCollection(); eventDescriptorCollection.InternalSort(null); return eventDescriptorCollection; } /// Sorts the members of this , using the specified . /// The new . /// An to use to sort the objects in this collection. // Token: 0x06000495 RID: 1173 RVA: 0x0000D3D8 File Offset: 0x0000B5D8 public virtual EventDescriptorCollection Sort(IComparer comparer) { EventDescriptorCollection eventDescriptorCollection = this.CloneCollection(); eventDescriptorCollection.InternalSort(comparer); return eventDescriptorCollection; } /// Sorts the members of this , given a specified sort order. /// The new . /// An array of strings describing the order in which to sort the objects in the collection. // Token: 0x06000496 RID: 1174 RVA: 0x0000D3F4 File Offset: 0x0000B5F4 public virtual EventDescriptorCollection Sort(string[] order) { EventDescriptorCollection eventDescriptorCollection = this.CloneCollection(); eventDescriptorCollection.InternalSort(order); return eventDescriptorCollection; } /// Sorts the members of this , given a specified sort order and an . /// The new . /// An array of strings describing the order in which to sort the objects in the collection. /// An to use to sort the objects in this collection. // Token: 0x06000497 RID: 1175 RVA: 0x0000D410 File Offset: 0x0000B610 public virtual EventDescriptorCollection Sort(string[] order, IComparer comparer) { EventDescriptorCollection eventDescriptorCollection = this.CloneCollection(); if (order != null) { ArrayList arrayList = eventDescriptorCollection.ExtractItems(order); eventDescriptorCollection.InternalSort(comparer); arrayList.AddRange(eventDescriptorCollection.eventList); eventDescriptorCollection.eventList = arrayList; } else { eventDescriptorCollection.InternalSort(comparer); } return eventDescriptorCollection; } /// Sorts the members of this , using the specified . /// A comparer to use to sort the objects in this collection. // Token: 0x06000498 RID: 1176 RVA: 0x0000D45C File Offset: 0x0000B65C protected void InternalSort(IComparer comparer) { if (comparer == null) { comparer = MemberDescriptor.DefaultComparer; } this.eventList.Sort(comparer); } /// Sorts the members of this . 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: 0x06000499 RID: 1177 RVA: 0x0000D478 File Offset: 0x0000B678 protected void InternalSort(string[] order) { if (order != null) { ArrayList arrayList = this.ExtractItems(order); this.InternalSort(null); arrayList.AddRange(this.eventList); this.eventList = arrayList; } else { this.InternalSort(null); } } // Token: 0x0600049A RID: 1178 RVA: 0x0000D4BC File Offset: 0x0000B6BC private ArrayList ExtractItems(string[] names) { ArrayList arrayList = new ArrayList(this.eventList.Count); object[] array = new object[names.Length]; for (int i = 0; i < this.eventList.Count; i++) { EventDescriptor eventDescriptor = (EventDescriptor)this.eventList[i]; int num = Array.IndexOf(names, eventDescriptor.Name); if (num != -1) { array[num] = eventDescriptor; this.eventList.RemoveAt(i); i--; } } foreach (object obj in array) { if (obj != null) { arrayList.Add(obj); } } return arrayList; } // Token: 0x0600049B RID: 1179 RVA: 0x0000D570 File Offset: 0x0000B770 private EventDescriptorCollection CloneCollection() { return new EventDescriptorCollection { eventList = (ArrayList)this.eventList.Clone() }; } // Token: 0x0600049C RID: 1180 RVA: 0x0000D59C File Offset: 0x0000B79C internal EventDescriptorCollection Filter(Attribute[] attributes) { EventDescriptorCollection eventDescriptorCollection = new EventDescriptorCollection(); foreach (object obj in this.eventList) { EventDescriptor eventDescriptor = (EventDescriptor)obj; if (eventDescriptor.Attributes.Contains(attributes)) { eventDescriptorCollection.eventList.Add(eventDescriptor); } } return eventDescriptorCollection; } /// Gets the number of event descriptors in the collection. /// The number of event descriptors in the collection. // Token: 0x17000134 RID: 308 // (get) Token: 0x0600049D RID: 1181 RVA: 0x0000D62C File Offset: 0x0000B82C public int Count { get { return this.eventList.Count; } } /// Gets or sets the event with the specified name. /// The with the specified name, or null if the event does not exist. /// The name of the to get or set. // Token: 0x17000135 RID: 309 public virtual EventDescriptor this[string name] { get { return this.Find(name, false); } } /// Gets or sets the event with the specified index number. /// The with the specified index number. /// The zero-based index number of the to get or set. /// /// is not a valid index for . // Token: 0x17000136 RID: 310 public virtual EventDescriptor this[int index] { get { return (EventDescriptor)this.eventList[index]; } } // Token: 0x04000174 RID: 372 private ArrayList eventList = new ArrayList(); // Token: 0x04000175 RID: 373 private bool isReadOnly; /// Specifies an empty collection to use, rather than creating a new one with no items. This static field is read-only. // Token: 0x04000176 RID: 374 public static readonly EventDescriptorCollection Empty = new EventDescriptorCollection(null, true); } }