using System; using System.Runtime.Serialization; namespace System.Collections.Specialized { /// Provides the abstract base class for a collection of associated keys and values that can be accessed either with the key or with the index. // Token: 0x0200002F RID: 47 [Serializable] public abstract class NameObjectCollectionBase : ICollection, IDeserializationCallback, IEnumerable, ISerializable { /// Initializes a new instance of the class that is empty. // Token: 0x060001D7 RID: 471 RVA: 0x00007624 File Offset: 0x00005824 protected NameObjectCollectionBase() { this.m_readonly = false; this.m_hashprovider = CaseInsensitiveHashCodeProvider.DefaultInvariant; this.m_comparer = CaseInsensitiveComparer.DefaultInvariant; this.m_defCapacity = 0; this.Init(); } /// Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default hash code provider and the default comparer. /// The approximate number of entries that the instance can initially contain. /// /// is less than zero. // Token: 0x060001D8 RID: 472 RVA: 0x00007664 File Offset: 0x00005864 protected NameObjectCollectionBase(int capacity) { this.m_readonly = false; this.m_hashprovider = CaseInsensitiveHashCodeProvider.DefaultInvariant; this.m_comparer = CaseInsensitiveComparer.DefaultInvariant; this.m_defCapacity = capacity; this.Init(); } // Token: 0x060001D9 RID: 473 RVA: 0x000076A4 File Offset: 0x000058A4 internal NameObjectCollectionBase(IEqualityComparer equalityComparer, IComparer comparer, IHashCodeProvider hcp) { this.equality_comparer = equalityComparer; this.m_comparer = comparer; this.m_hashprovider = hcp; this.m_readonly = false; this.m_defCapacity = 0; this.Init(); } /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified object. /// The object to use to determine whether two keys are equal and to generate hash codes for the keys in the collection. // Token: 0x060001DA RID: 474 RVA: 0x000076D8 File Offset: 0x000058D8 protected NameObjectCollectionBase(IEqualityComparer equalityComparer) { IEqualityComparer equalityComparer2; if (equalityComparer == null) { IEqualityComparer invariantCultureIgnoreCase = StringComparer.InvariantCultureIgnoreCase; equalityComparer2 = invariantCultureIgnoreCase; } else { equalityComparer2 = equalityComparer; } this..ctor(equalityComparer2, null, null); } /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified hash code provider and the specified comparer. /// The that will supply the hash codes for all keys in the instance. /// The to use to determine whether two keys are equal. // Token: 0x060001DB RID: 475 RVA: 0x00007700 File Offset: 0x00005900 [Obsolete("Use NameObjectCollectionBase(IEqualityComparer)")] protected NameObjectCollectionBase(IHashCodeProvider hashProvider, IComparer comparer) { this.m_comparer = comparer; this.m_hashprovider = hashProvider; this.m_readonly = false; this.m_defCapacity = 0; this.Init(); } /// Initializes a new instance of the class that is serializable and uses the specified and . /// A object that contains the information required to serialize the new instance. /// A object that contains the source and destination of the serialized stream associated with the new instance. // Token: 0x060001DC RID: 476 RVA: 0x00007738 File Offset: 0x00005938 protected NameObjectCollectionBase(SerializationInfo info, StreamingContext context) { this.infoCopy = info; } /// Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified object. /// The approximate number of entries that the object can initially contain. /// The object to use to determine whether two keys are equal and to generate hash codes for the keys in the collection. /// /// is less than zero. // Token: 0x060001DD RID: 477 RVA: 0x00007748 File Offset: 0x00005948 protected NameObjectCollectionBase(int capacity, IEqualityComparer equalityComparer) { this.m_readonly = false; IEqualityComparer equalityComparer2; if (equalityComparer == null) { IEqualityComparer invariantCultureIgnoreCase = StringComparer.InvariantCultureIgnoreCase; equalityComparer2 = invariantCultureIgnoreCase; } else { equalityComparer2 = equalityComparer; } this.equality_comparer = equalityComparer2; this.m_defCapacity = capacity; this.Init(); } /// Initializes a new instance of the class that is empty, has the specified initial capacity and uses the specified hash code provider and the specified comparer. /// The approximate number of entries that the instance can initially contain. /// The that will supply the hash codes for all keys in the instance. /// The to use to determine whether two keys are equal. /// /// is less than zero. // Token: 0x060001DE RID: 478 RVA: 0x00007788 File Offset: 0x00005988 [Obsolete("Use NameObjectCollectionBase(int,IEqualityComparer)")] protected NameObjectCollectionBase(int capacity, IHashCodeProvider hashProvider, IComparer comparer) { this.m_readonly = false; this.m_hashprovider = hashProvider; this.m_comparer = comparer; this.m_defCapacity = capacity; this.Init(); } /// Gets a value indicating whether access to the object is synchronized (thread safe). /// true if access to the object is synchronized (thread safe); otherwise, false. The default is false. // Token: 0x17000083 RID: 131 // (get) Token: 0x060001DF RID: 479 RVA: 0x000077C0 File Offset: 0x000059C0 bool ICollection.IsSynchronized { get { return false; } } /// Gets an object that can be used to synchronize access to the object. /// An object that can be used to synchronize access to the object. // Token: 0x17000084 RID: 132 // (get) Token: 0x060001E0 RID: 480 RVA: 0x000077C4 File Offset: 0x000059C4 object ICollection.SyncRoot { get { return this; } } /// Copies the entire to a compatible one-dimensional , starting at the specified index of the target array. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// /// is multidimensional.-or-The number of elements in the source is greater than the available space from to the end of the destination . /// The type of the source cannot be cast automatically to the type of the destination . // Token: 0x060001E1 RID: 481 RVA: 0x000077C8 File Offset: 0x000059C8 void ICollection.CopyTo(Array array, int index) { ((ICollection)this.Keys).CopyTo(array, index); } // Token: 0x17000085 RID: 133 // (get) Token: 0x060001E2 RID: 482 RVA: 0x000077D8 File Offset: 0x000059D8 internal IEqualityComparer EqualityComparer { get { return this.equality_comparer; } } // Token: 0x17000086 RID: 134 // (get) Token: 0x060001E3 RID: 483 RVA: 0x000077E0 File Offset: 0x000059E0 internal IComparer Comparer { get { return this.m_comparer; } } // Token: 0x17000087 RID: 135 // (get) Token: 0x060001E4 RID: 484 RVA: 0x000077E8 File Offset: 0x000059E8 internal IHashCodeProvider HashCodeProvider { get { return this.m_hashprovider; } } // Token: 0x060001E5 RID: 485 RVA: 0x000077F0 File Offset: 0x000059F0 private void Init() { if (this.equality_comparer != null) { this.m_ItemsContainer = new Hashtable(this.m_defCapacity, this.equality_comparer); } else { this.m_ItemsContainer = new Hashtable(this.m_defCapacity, this.m_hashprovider, this.m_comparer); } this.m_ItemsArray = new ArrayList(); this.m_NullKeyItem = null; } /// Gets a instance that contains all the keys in the instance. /// A instance that contains all the keys in the instance. // Token: 0x17000088 RID: 136 // (get) Token: 0x060001E6 RID: 486 RVA: 0x00007854 File Offset: 0x00005A54 public virtual NameObjectCollectionBase.KeysCollection Keys { get { if (this.keyscoll == null) { this.keyscoll = new NameObjectCollectionBase.KeysCollection(this); } return this.keyscoll; } } /// Returns an enumerator that iterates through the . /// An for the instance. // Token: 0x060001E7 RID: 487 RVA: 0x00007874 File Offset: 0x00005A74 public virtual IEnumerator GetEnumerator() { return new NameObjectCollectionBase._KeysEnumerator(this); } /// Implements the interface and returns the data needed to serialize the instance. /// A object that contains the information required to serialize the instance. /// A object that contains the source and destination of the serialized stream associated with the instance. /// /// is null. // Token: 0x060001E8 RID: 488 RVA: 0x0000787C File Offset: 0x00005A7C public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } int count = this.Count; string[] array = new string[count]; object[] array2 = new object[count]; int num = 0; foreach (object obj in this.m_ItemsArray) { NameObjectCollectionBase._Item item = (NameObjectCollectionBase._Item)obj; array[num] = item.key; array2[num] = item.value; num++; } if (this.equality_comparer != null) { info.AddValue("KeyComparer", this.equality_comparer, typeof(IEqualityComparer)); info.AddValue("Version", 4, typeof(int)); } else { info.AddValue("HashProvider", this.m_hashprovider, typeof(IHashCodeProvider)); info.AddValue("Comparer", this.m_comparer, typeof(IComparer)); info.AddValue("Version", 2, typeof(int)); } info.AddValue("ReadOnly", this.m_readonly); info.AddValue("Count", count); info.AddValue("Keys", array, typeof(string[])); info.AddValue("Values", array2, typeof(object[])); } /// Gets the number of key/value pairs contained in the instance. /// The number of key/value pairs contained in the instance. // Token: 0x17000089 RID: 137 // (get) Token: 0x060001E9 RID: 489 RVA: 0x00007A0C File Offset: 0x00005C0C public virtual int Count { get { return this.m_ItemsArray.Count; } } /// Implements the interface and raises the deserialization event when the deserialization is complete. /// The source of the deserialization event. /// The object associated with the current instance is invalid. // Token: 0x060001EA RID: 490 RVA: 0x00007A1C File Offset: 0x00005C1C public virtual void OnDeserialization(object sender) { SerializationInfo serializationInfo = this.infoCopy; if (serializationInfo == null) { return; } this.infoCopy = null; this.m_hashprovider = (IHashCodeProvider)serializationInfo.GetValue("HashProvider", typeof(IHashCodeProvider)); if (this.m_hashprovider == null) { this.equality_comparer = (IEqualityComparer)serializationInfo.GetValue("KeyComparer", typeof(IEqualityComparer)); } else { this.m_comparer = (IComparer)serializationInfo.GetValue("Comparer", typeof(IComparer)); if (this.m_comparer == null) { throw new SerializationException("The comparer is null"); } } this.m_readonly = serializationInfo.GetBoolean("ReadOnly"); string[] array = (string[])serializationInfo.GetValue("Keys", typeof(string[])); if (array == null) { throw new SerializationException("keys is null"); } object[] array2 = (object[])serializationInfo.GetValue("Values", typeof(object[])); if (array2 == null) { throw new SerializationException("values is null"); } this.Init(); int num = array.Length; for (int i = 0; i < num; i++) { this.BaseAdd(array[i], array2[i]); } } /// Gets or sets a value indicating whether the instance is read-only. /// true if the instance is read-only; otherwise, false. // Token: 0x1700008A RID: 138 // (get) Token: 0x060001EB RID: 491 RVA: 0x00007B5C File Offset: 0x00005D5C // (set) Token: 0x060001EC RID: 492 RVA: 0x00007B64 File Offset: 0x00005D64 protected bool IsReadOnly { get { return this.m_readonly; } set { this.m_readonly = value; } } /// Adds an entry with the specified key and value into the instance. /// The key of the entry to add. The key can be null. /// The value of the entry to add. The value can be null. /// The collection is read-only. // Token: 0x060001ED RID: 493 RVA: 0x00007B70 File Offset: 0x00005D70 protected void BaseAdd(string name, object value) { if (this.IsReadOnly) { throw new NotSupportedException("Collection is read-only"); } NameObjectCollectionBase._Item item = new NameObjectCollectionBase._Item(name, value); if (name == null) { if (this.m_NullKeyItem == null) { this.m_NullKeyItem = item; } } else if (this.m_ItemsContainer[name] == null) { this.m_ItemsContainer.Add(name, item); } this.m_ItemsArray.Add(item); } /// Removes all entries from the instance. /// The collection is read-only. // Token: 0x060001EE RID: 494 RVA: 0x00007BE4 File Offset: 0x00005DE4 protected void BaseClear() { if (this.IsReadOnly) { throw new NotSupportedException("Collection is read-only"); } this.Init(); } /// Gets the value of the entry at the specified index of the instance. /// An that represents the value of the entry at the specified index. /// The zero-based index of the value to get. /// /// is outside the valid range of indexes for the collection. // Token: 0x060001EF RID: 495 RVA: 0x00007C04 File Offset: 0x00005E04 protected object BaseGet(int index) { return ((NameObjectCollectionBase._Item)this.m_ItemsArray[index]).value; } /// Gets the value of the first entry with the specified key from the instance. /// An that represents the value of the first entry with the specified key, if found; otherwise, null. /// The key of the entry to get. The key can be null. // Token: 0x060001F0 RID: 496 RVA: 0x00007C1C File Offset: 0x00005E1C protected object BaseGet(string name) { NameObjectCollectionBase._Item item = this.FindFirstMatchedItem(name); if (item == null) { return null; } return item.value; } /// Returns a array that contains all the keys in the instance. /// A array that contains all the keys in the instance. // Token: 0x060001F1 RID: 497 RVA: 0x00007C40 File Offset: 0x00005E40 protected string[] BaseGetAllKeys() { int count = this.m_ItemsArray.Count; string[] array = new string[count]; for (int i = 0; i < count; i++) { array[i] = this.BaseGetKey(i); } return array; } /// Returns an array that contains all the values in the instance. /// An array that contains all the values in the instance. // Token: 0x060001F2 RID: 498 RVA: 0x00007C80 File Offset: 0x00005E80 protected object[] BaseGetAllValues() { int count = this.m_ItemsArray.Count; object[] array = new object[count]; for (int i = 0; i < count; i++) { array[i] = this.BaseGet(i); } return array; } /// Returns an array of the specified type that contains all the values in the instance. /// An array of the specified type that contains all the values in the instance. /// A that represents the type of array to return. /// /// is null. /// /// is not a valid . // Token: 0x060001F3 RID: 499 RVA: 0x00007CC0 File Offset: 0x00005EC0 protected object[] BaseGetAllValues(Type type) { if (type == null) { throw new ArgumentNullException("'type' argument can't be null"); } int count = this.m_ItemsArray.Count; object[] array = (object[])Array.CreateInstance(type, count); for (int i = 0; i < count; i++) { array[i] = this.BaseGet(i); } return array; } /// Gets the key of the entry at the specified index of the instance. /// A that represents the key of the entry at the specified index. /// The zero-based index of the key to get. /// /// is outside the valid range of indexes for the collection. // Token: 0x060001F4 RID: 500 RVA: 0x00007D14 File Offset: 0x00005F14 protected string BaseGetKey(int index) { return ((NameObjectCollectionBase._Item)this.m_ItemsArray[index]).key; } /// Gets a value indicating whether the instance contains entries whose keys are not null. /// true if the instance contains entries whose keys are not null; otherwise, false. // Token: 0x060001F5 RID: 501 RVA: 0x00007D2C File Offset: 0x00005F2C protected bool BaseHasKeys() { return this.m_ItemsContainer.Count > 0; } /// Removes the entries with the specified key from the instance. /// The key of the entries to remove. The key can be null. /// The collection is read-only. // Token: 0x060001F6 RID: 502 RVA: 0x00007D3C File Offset: 0x00005F3C protected void BaseRemove(string name) { if (this.IsReadOnly) { throw new NotSupportedException("Collection is read-only"); } if (name != null) { this.m_ItemsContainer.Remove(name); } else { this.m_NullKeyItem = null; } int num = this.m_ItemsArray.Count; int i = 0; while (i < num) { string text = this.BaseGetKey(i); if (this.Equals(text, name)) { this.m_ItemsArray.RemoveAt(i); num--; } else { i++; } } } /// Removes the entry at the specified index of the instance. /// The zero-based index of the entry to remove. /// /// is outside the valid range of indexes for the collection. /// The collection is read-only. // Token: 0x060001F7 RID: 503 RVA: 0x00007DC8 File Offset: 0x00005FC8 protected void BaseRemoveAt(int index) { if (this.IsReadOnly) { throw new NotSupportedException("Collection is read-only"); } string text = this.BaseGetKey(index); if (text != null) { this.m_ItemsContainer.Remove(text); } else { this.m_NullKeyItem = null; } this.m_ItemsArray.RemoveAt(index); } /// Sets the value of the entry at the specified index of the instance. /// The zero-based index of the entry to set. /// The that represents the new value of the entry to set. The value can be null. /// The collection is read-only. /// /// is outside the valid range of indexes for the collection. // Token: 0x060001F8 RID: 504 RVA: 0x00007E20 File Offset: 0x00006020 protected void BaseSet(int index, object value) { if (this.IsReadOnly) { throw new NotSupportedException("Collection is read-only"); } NameObjectCollectionBase._Item item = (NameObjectCollectionBase._Item)this.m_ItemsArray[index]; item.value = value; } /// Sets the value of the first entry with the specified key in the instance, if found; otherwise, adds an entry with the specified key and value into the instance. /// The key of the entry to set. The key can be null. /// The that represents the new value of the entry to set. The value can be null. /// The collection is read-only. // Token: 0x060001F9 RID: 505 RVA: 0x00007E5C File Offset: 0x0000605C protected void BaseSet(string name, object value) { if (this.IsReadOnly) { throw new NotSupportedException("Collection is read-only"); } NameObjectCollectionBase._Item item = this.FindFirstMatchedItem(name); if (item != null) { item.value = value; } else { this.BaseAdd(name, value); } } // Token: 0x060001FA RID: 506 RVA: 0x00007EA4 File Offset: 0x000060A4 [global::System.MonoTODO] private NameObjectCollectionBase._Item FindFirstMatchedItem(string name) { if (name != null) { return (NameObjectCollectionBase._Item)this.m_ItemsContainer[name]; } return this.m_NullKeyItem; } // Token: 0x060001FB RID: 507 RVA: 0x00007EC4 File Offset: 0x000060C4 internal bool Equals(string s1, string s2) { if (this.m_comparer != null) { return this.m_comparer.Compare(s1, s2) == 0; } return this.equality_comparer.Equals(s1, s2); } // Token: 0x04000095 RID: 149 private Hashtable m_ItemsContainer; // Token: 0x04000096 RID: 150 private NameObjectCollectionBase._Item m_NullKeyItem; // Token: 0x04000097 RID: 151 private ArrayList m_ItemsArray; // Token: 0x04000098 RID: 152 private IHashCodeProvider m_hashprovider; // Token: 0x04000099 RID: 153 private IComparer m_comparer; // Token: 0x0400009A RID: 154 private int m_defCapacity; // Token: 0x0400009B RID: 155 private bool m_readonly; // Token: 0x0400009C RID: 156 private SerializationInfo infoCopy; // Token: 0x0400009D RID: 157 private NameObjectCollectionBase.KeysCollection keyscoll; // Token: 0x0400009E RID: 158 private IEqualityComparer equality_comparer; // Token: 0x02000030 RID: 48 internal class _Item { // Token: 0x060001FC RID: 508 RVA: 0x00007EF0 File Offset: 0x000060F0 public _Item(string key, object value) { this.key = key; this.value = value; } // Token: 0x0400009F RID: 159 public string key; // Token: 0x040000A0 RID: 160 public object value; } // Token: 0x02000031 RID: 49 [Serializable] internal class _KeysEnumerator : IEnumerator { // Token: 0x060001FD RID: 509 RVA: 0x00007F08 File Offset: 0x00006108 internal _KeysEnumerator(NameObjectCollectionBase collection) { this.m_collection = collection; this.Reset(); } // Token: 0x1700008B RID: 139 // (get) Token: 0x060001FE RID: 510 RVA: 0x00007F20 File Offset: 0x00006120 public object Current { get { if (this.m_position < this.m_collection.Count || this.m_position < 0) { return this.m_collection.BaseGetKey(this.m_position); } throw new InvalidOperationException(); } } // Token: 0x060001FF RID: 511 RVA: 0x00007F5C File Offset: 0x0000615C public bool MoveNext() { return ++this.m_position < this.m_collection.Count; } // Token: 0x06000200 RID: 512 RVA: 0x00007F88 File Offset: 0x00006188 public void Reset() { this.m_position = -1; } // Token: 0x040000A1 RID: 161 private NameObjectCollectionBase m_collection; // Token: 0x040000A2 RID: 162 private int m_position; } /// Represents a collection of the keys of a collection. // Token: 0x02000032 RID: 50 [Serializable] public class KeysCollection : ICollection, IEnumerable { // Token: 0x06000201 RID: 513 RVA: 0x00007F94 File Offset: 0x00006194 internal KeysCollection(NameObjectCollectionBase collection) { this.m_collection = collection; } /// Copies the entire to a compatible one-dimensional , starting at the specified index of the target array. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// /// is multidimensional.-or- The number of elements in the source is greater than the available space from to the end of the destination . /// The type of the source cannot be cast automatically to the type of the destination . // Token: 0x06000202 RID: 514 RVA: 0x00007FA4 File Offset: 0x000061A4 void ICollection.CopyTo(Array array, int arrayIndex) { ArrayList itemsArray = this.m_collection.m_ItemsArray; if (array == null) { throw new ArgumentNullException("array"); } if (arrayIndex < 0) { throw new ArgumentOutOfRangeException("arrayIndex"); } if (array.Length > 0 && arrayIndex >= array.Length) { throw new ArgumentException("arrayIndex is equal to or greater than array.Length"); } if (arrayIndex + itemsArray.Count > array.Length) { throw new ArgumentException("Not enough room from arrayIndex to end of array for this KeysCollection"); } if (array != null && array.Rank > 1) { throw new ArgumentException("array is multidimensional"); } object[] array2 = (object[])array; int i = 0; while (i < itemsArray.Count) { array2[arrayIndex] = ((NameObjectCollectionBase._Item)itemsArray[i]).key; i++; arrayIndex++; } } /// Gets a value indicating whether access to the is synchronized (thread safe). /// true if access to the is synchronized (thread safe); otherwise, false. The default is false. // Token: 0x1700008C RID: 140 // (get) Token: 0x06000203 RID: 515 RVA: 0x00008078 File Offset: 0x00006278 bool ICollection.IsSynchronized { get { return false; } } /// Gets an object that can be used to synchronize access to the . /// An object that can be used to synchronize access to the . // Token: 0x1700008D RID: 141 // (get) Token: 0x06000204 RID: 516 RVA: 0x0000807C File Offset: 0x0000627C object ICollection.SyncRoot { get { return this.m_collection; } } /// Gets the key at the specified index of the collection. /// A that contains the key at the specified index of the collection. /// The zero-based index of the key to get from the collection. /// /// is outside the valid range of indexes for the collection. // Token: 0x06000205 RID: 517 RVA: 0x00008084 File Offset: 0x00006284 public virtual string Get(int index) { return this.m_collection.BaseGetKey(index); } /// Gets the number of keys in the . /// The number of keys in the . // Token: 0x1700008E RID: 142 // (get) Token: 0x06000206 RID: 518 RVA: 0x00008094 File Offset: 0x00006294 public int Count { get { return this.m_collection.Count; } } /// Gets the entry at the specified index of the collection. /// The key of the entry at the specified index of the collection. /// The zero-based index of the entry to locate in the collection. /// /// is outside the valid range of indexes for the collection. // Token: 0x1700008F RID: 143 public string this[int index] { get { return this.Get(index); } } /// Returns an enumerator that iterates through the . /// An for the . // Token: 0x06000208 RID: 520 RVA: 0x000080B0 File Offset: 0x000062B0 public IEnumerator GetEnumerator() { return new NameObjectCollectionBase._KeysEnumerator(this.m_collection); } // Token: 0x040000A3 RID: 163 private NameObjectCollectionBase m_collection; } } }