using System; using System.Runtime.InteropServices; namespace System.Collections.Generic { /// Represents a collection of key/value pairs that are sorted by key based on the associated implementation. /// The type of keys in the collection. /// The type of values in the collection. // Token: 0x0200001C RID: 28 [ComVisible(false)] [Serializable] public class SortedList : ICollection, IDictionary, ICollection>, IEnumerable>, IEnumerable, IDictionary { /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default . // Token: 0x060000E8 RID: 232 RVA: 0x00004E14 File Offset: 0x00003014 public SortedList() : this(SortedList.INITIAL_SIZE, null) { } /// Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default . /// The initial number of elements that the can contain. /// /// is less than zero. // Token: 0x060000E9 RID: 233 RVA: 0x00004E24 File Offset: 0x00003024 public SortedList(int capacity) : this(capacity, null) { } /// Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified . /// The initial number of elements that the can contain. /// The implementation to use when comparing keys.-or-null to use the default for the type of the key. /// /// is less than zero. // Token: 0x060000EA RID: 234 RVA: 0x00004E30 File Offset: 0x00003030 public SortedList(int capacity, IComparer comparer) { if (capacity < 0) { throw new ArgumentOutOfRangeException("initialCapacity"); } if (capacity == 0) { this.defaultCapacity = 0; } else { this.defaultCapacity = SortedList.INITIAL_SIZE; } this.Init(comparer, capacity, true); } /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . /// The implementation to use when comparing keys.-or-null to use the default for the type of the key. // Token: 0x060000EB RID: 235 RVA: 0x00004E7C File Offset: 0x0000307C public SortedList(IComparer comparer) : this(SortedList.INITIAL_SIZE, comparer) { } /// Initializes a new instance of the class that contains elements copied from the specified , has sufficient capacity to accommodate the number of elements copied, and uses the default . /// The whose elements are copied to the new . /// /// is null. /// /// contains one or more duplicate keys. // Token: 0x060000EC RID: 236 RVA: 0x00004E8C File Offset: 0x0000308C public SortedList(IDictionary dictionary) : this(dictionary, null) { } /// Initializes a new instance of the class that contains elements copied from the specified , has sufficient capacity to accommodate the number of elements copied, and uses the specified . /// The whose elements are copied to the new . /// The implementation to use when comparing keys.-or-null to use the default for the type of the key. /// /// is null. /// /// contains one or more duplicate keys. // Token: 0x060000ED RID: 237 RVA: 0x00004E98 File Offset: 0x00003098 public SortedList(IDictionary dictionary, IComparer comparer) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } this.Init(comparer, dictionary.Count, true); foreach (KeyValuePair keyValuePair in dictionary) { this.Add(keyValuePair.Key, keyValuePair.Value); } } /// Gets a value indicating whether access to the is synchronized (thread safe). /// true if access to the is synchronized (thread safe); otherwise, false. In the default implementation of , this property always returns false. // Token: 0x1700003C RID: 60 // (get) Token: 0x060000EF RID: 239 RVA: 0x00004F34 File Offset: 0x00003134 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 . In the default implementation of , this property always returns the current instance. // Token: 0x1700003D RID: 61 // (get) Token: 0x060000F0 RID: 240 RVA: 0x00004F38 File Offset: 0x00003138 object ICollection.SyncRoot { get { return this; } } /// Gets a value indicating whether the has a fixed size. /// true if the has a fixed size; otherwise, false. In the default implementation of , this property always returns false. // Token: 0x1700003E RID: 62 // (get) Token: 0x060000F1 RID: 241 RVA: 0x00004F3C File Offset: 0x0000313C bool IDictionary.IsFixedSize { get { return false; } } /// Gets a value indicating whether the is read-only. /// true if the is read-only; otherwise, false. In the default implementation of , this property always returns false. // Token: 0x1700003F RID: 63 // (get) Token: 0x060000F2 RID: 242 RVA: 0x00004F40 File Offset: 0x00003140 bool IDictionary.IsReadOnly { get { return false; } } /// Gets or sets the element with the specified key. /// The element with the specified key, or null if is not in the dictionary or is of a type that is not assignable to the key type of the . /// The key of the element to get or set. /// /// is null. /// A value is being assigned, and is of a type that is not assignable to the key type of the .-or-A value is being assigned, and is of a type that is not assignable to the value type of the . // Token: 0x17000040 RID: 64 object IDictionary.this[object key] { get { if (!(key is TKey)) { return null; } return this[(TKey)((object)key)]; } set { this[this.ToKey(key)] = this.ToValue(value); } } /// Gets an containing the keys of the . /// An containing the keys of the . // Token: 0x17000041 RID: 65 // (get) Token: 0x060000F5 RID: 245 RVA: 0x00004F7C File Offset: 0x0000317C ICollection IDictionary.Keys { get { return new SortedList.ListKeys(this); } } /// Gets an containing the values in the . /// An containing the values in the . // Token: 0x17000042 RID: 66 // (get) Token: 0x060000F6 RID: 246 RVA: 0x00004F84 File Offset: 0x00003184 ICollection IDictionary.Values { get { return new SortedList.ListValues(this); } } // Token: 0x17000043 RID: 67 // (get) Token: 0x060000F7 RID: 247 RVA: 0x00004F8C File Offset: 0x0000318C ICollection IDictionary.Keys { get { return this.Keys; } } // Token: 0x17000044 RID: 68 // (get) Token: 0x060000F8 RID: 248 RVA: 0x00004F94 File Offset: 0x00003194 ICollection IDictionary.Values { get { return this.Values; } } // Token: 0x17000045 RID: 69 // (get) Token: 0x060000F9 RID: 249 RVA: 0x00004F9C File Offset: 0x0000319C bool ICollection>.IsReadOnly { get { return false; } } // Token: 0x060000FA RID: 250 RVA: 0x00004FA0 File Offset: 0x000031A0 void ICollection>.Clear() { this.defaultCapacity = SortedList.INITIAL_SIZE; this.table = new KeyValuePair[this.defaultCapacity]; this.inUse = 0; this.modificationCount++; } // Token: 0x060000FB RID: 251 RVA: 0x00004FD4 File Offset: 0x000031D4 void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) { if (this.Count == 0) { return; } if (array == null) { throw new ArgumentNullException(); } if (arrayIndex < 0) { throw new ArgumentOutOfRangeException(); } if (arrayIndex >= array.Length) { throw new ArgumentNullException("arrayIndex is greater than or equal to array.Length"); } if (this.Count > array.Length - arrayIndex) { throw new ArgumentNullException("Not enough space in array from arrayIndex to end of array"); } int num = arrayIndex; foreach (KeyValuePair keyValuePair in this) { array[num++] = keyValuePair; } } // Token: 0x060000FC RID: 252 RVA: 0x00005094 File Offset: 0x00003294 void ICollection>.Add(KeyValuePair keyValuePair) { this.Add(keyValuePair.Key, keyValuePair.Value); } // Token: 0x060000FD RID: 253 RVA: 0x000050AC File Offset: 0x000032AC bool ICollection>.Contains(KeyValuePair keyValuePair) { int num = this.Find(keyValuePair.Key); return num >= 0 && Comparer>.Default.Compare(this.table[num], keyValuePair) == 0; } // Token: 0x060000FE RID: 254 RVA: 0x000050F0 File Offset: 0x000032F0 bool ICollection>.Remove(KeyValuePair keyValuePair) { int num = this.Find(keyValuePair.Key); if (num >= 0 && Comparer>.Default.Compare(this.table[num], keyValuePair) == 0) { this.RemoveAt(num); return true; } return false; } // Token: 0x060000FF RID: 255 RVA: 0x00005140 File Offset: 0x00003340 IEnumerator> IEnumerable>.GetEnumerator() { for (int i = 0; i < this.inUse; i++) { KeyValuePair current = this.table[i]; yield return new KeyValuePair(current.Key, current.Value); } yield break; } /// Returns an enumerator that iterates through a collection. /// An that can be used to iterate through the collection. // Token: 0x06000100 RID: 256 RVA: 0x0000515C File Offset: 0x0000335C IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } /// 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. /// /// is null. /// /// is of a type that is not assignable to the key type of the .-or- is of a type that is not assignable to the value type of the .-or-An element with the same key already exists in the . // Token: 0x06000101 RID: 257 RVA: 0x00005164 File Offset: 0x00003364 void IDictionary.Add(object key, object value) { this.PutImpl(this.ToKey(key), this.ToValue(value), false); } /// 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 . /// /// is null. // Token: 0x06000102 RID: 258 RVA: 0x00005188 File Offset: 0x00003388 bool IDictionary.Contains(object key) { if (key == null) { throw new ArgumentNullException(); } return key is TKey && this.Find((TKey)((object)key)) >= 0; } /// Returns an for the . /// An for the . // Token: 0x06000103 RID: 259 RVA: 0x000051B8 File Offset: 0x000033B8 IDictionaryEnumerator IDictionary.GetEnumerator() { return new SortedList.Enumerator(this, SortedList.EnumeratorMode.ENTRY_MODE); } /// Removes the element with the specified key from the . /// The key of the element to remove. /// /// is null. // Token: 0x06000104 RID: 260 RVA: 0x000051C4 File Offset: 0x000033C4 void IDictionary.Remove(object key) { if (key == null) { throw new ArgumentNullException("key"); } if (!(key is TKey)) { return; } int num = this.IndexOfKey((TKey)((object)key)); if (num >= 0) { this.RemoveAt(num); } } /// Copies the elements of the to an , starting at a particular index. /// 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- does not have zero-based indexing.-or-The number of elements in the source is greater than the available space from to the end of the destination .-or-The type of the source cannot be cast automatically to the type of the destination . // Token: 0x06000105 RID: 261 RVA: 0x0000520C File Offset: 0x0000340C void ICollection.CopyTo(Array array, int arrayIndex) { if (this.Count == 0) { return; } if (array == null) { throw new ArgumentNullException(); } if (arrayIndex < 0) { throw new ArgumentOutOfRangeException(); } if (array.Rank > 1) { throw new ArgumentException("array is multi-dimensional"); } if (arrayIndex >= array.Length) { throw new ArgumentNullException("arrayIndex is greater than or equal to array.Length"); } if (this.Count > array.Length - arrayIndex) { throw new ArgumentNullException("Not enough space in array from arrayIndex to end of array"); } IEnumerator> enumerator = this.GetEnumerator(); int num = arrayIndex; while (enumerator.MoveNext()) { KeyValuePair keyValuePair = enumerator.Current; array.SetValue(keyValuePair, num++); } } /// Gets the number of key/value pairs contained in the . /// The number of key/value pairs contained in the . // Token: 0x17000046 RID: 70 // (get) Token: 0x06000106 RID: 262 RVA: 0x000052BC File Offset: 0x000034BC public int Count { get { return this.inUse; } } /// Gets or sets the value associated with the specified key. /// The value associated with the specified key. If the specified key is not found, a get operation throws a and a set operation creates a new element using the specified key. /// The key whose value to get or set. /// /// is null. /// The property is retrieved and does not exist in the collection. // Token: 0x17000047 RID: 71 public TValue this[TKey key] { get { if (key == null) { throw new ArgumentNullException("key"); } int num = this.Find(key); if (num >= 0) { return this.table[num].Value; } throw new KeyNotFoundException(); } set { if (key == null) { throw new ArgumentNullException("key"); } this.PutImpl(key, value, true); } } /// Gets or sets the number of elements that the can contain. /// The number of elements that the can contain. /// /// is set to a value that is less than . /// There is not enough memory available on the system. // Token: 0x17000048 RID: 72 // (get) Token: 0x06000109 RID: 265 RVA: 0x00005334 File Offset: 0x00003534 // (set) Token: 0x0600010A RID: 266 RVA: 0x00005340 File Offset: 0x00003540 public int Capacity { get { return this.table.Length; } set { int num = this.table.Length; if (this.inUse > value) { throw new ArgumentOutOfRangeException("capacity too small"); } if (value == 0) { KeyValuePair[] array = new KeyValuePair[this.defaultCapacity]; Array.Copy(this.table, array, this.inUse); this.table = array; } else if (value > this.inUse) { KeyValuePair[] array2 = new KeyValuePair[value]; Array.Copy(this.table, array2, this.inUse); this.table = array2; } else if (value > num) { KeyValuePair[] array3 = new KeyValuePair[value]; Array.Copy(this.table, array3, num); this.table = array3; } } } /// Gets a collection containing the keys in the . /// A containing the keys in the . // Token: 0x17000049 RID: 73 // (get) Token: 0x0600010B RID: 267 RVA: 0x000053F0 File Offset: 0x000035F0 public IList Keys { get { return new SortedList.ListKeys(this); } } /// Gets a collection containing the values in the . /// A containing the values in the . // Token: 0x1700004A RID: 74 // (get) Token: 0x0600010C RID: 268 RVA: 0x000053F8 File Offset: 0x000035F8 public IList Values { get { return new SortedList.ListValues(this); } } /// Gets the for the sorted list. /// The for the current . // Token: 0x1700004B RID: 75 // (get) Token: 0x0600010D RID: 269 RVA: 0x00005400 File Offset: 0x00003600 public IComparer Comparer { get { return this.comparer; } } /// Adds an element with the specified key and value into the . /// The key of the element to add. /// The value of the element to add. The value can be null for reference types. /// /// is null. /// An element with the same key already exists in the . // Token: 0x0600010E RID: 270 RVA: 0x00005408 File Offset: 0x00003608 public void Add(TKey key, TValue value) { if (key == null) { throw new ArgumentNullException("key"); } this.PutImpl(key, value, false); } /// Determines whether the contains a specific key. /// true if the contains an element with the specified key; otherwise, false. /// The key to locate in the . /// /// is null. // Token: 0x0600010F RID: 271 RVA: 0x0000542C File Offset: 0x0000362C public bool ContainsKey(TKey key) { if (key == null) { throw new ArgumentNullException("key"); } return this.Find(key) >= 0; } /// Returns an enumerator that iterates through the . /// An of type for the . // Token: 0x06000110 RID: 272 RVA: 0x00005454 File Offset: 0x00003654 public IEnumerator> GetEnumerator() { for (int i = 0; i < this.inUse; i++) { KeyValuePair current = this.table[i]; yield return new KeyValuePair(current.Key, current.Value); } yield break; } /// Removes the element with the specified key from the . /// true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the original . /// The key of the element to remove. /// /// is null. // Token: 0x06000111 RID: 273 RVA: 0x00005470 File Offset: 0x00003670 public bool Remove(TKey key) { if (key == null) { throw new ArgumentNullException("key"); } int num = this.IndexOfKey(key); if (num >= 0) { this.RemoveAt(num); return true; } return false; } /// Removes all elements from the . // Token: 0x06000112 RID: 274 RVA: 0x000054AC File Offset: 0x000036AC public void Clear() { this.defaultCapacity = SortedList.INITIAL_SIZE; this.table = new KeyValuePair[this.defaultCapacity]; this.inUse = 0; this.modificationCount++; } /// Removes the element at the specified index of the . /// The zero-based index of the element to remove. /// /// is less than zero.-or- is equal to or greater than . // Token: 0x06000113 RID: 275 RVA: 0x000054E0 File Offset: 0x000036E0 public void RemoveAt(int index) { KeyValuePair[] array = this.table; int count = this.Count; if (index >= 0 && index < count) { if (index != count - 1) { Array.Copy(array, index + 1, array, index, count - 1 - index); } else { array[index] = default(KeyValuePair); } this.inUse--; this.modificationCount++; return; } throw new ArgumentOutOfRangeException("index out of range"); } /// Searches for the specified key and returns the zero-based index within the entire . /// The zero-based index of within the entire , if found; otherwise, -1. /// The key to locate in the . /// /// is null. // Token: 0x06000114 RID: 276 RVA: 0x00005568 File Offset: 0x00003768 public int IndexOfKey(TKey key) { if (key == null) { throw new ArgumentNullException("key"); } int num = 0; try { num = this.Find(key); } catch (Exception) { throw new InvalidOperationException(); } return num | (num >> 31); } /// Searches for the specified value and returns the zero-based index of the first occurrence within the entire . /// The zero-based index of the first occurrence of within the entire , if found; otherwise, -1. /// The value to locate in the . The value can be null for reference types. // Token: 0x06000115 RID: 277 RVA: 0x000055C8 File Offset: 0x000037C8 public int IndexOfValue(TValue value) { if (this.inUse == 0) { return -1; } for (int i = 0; i < this.inUse; i++) { KeyValuePair keyValuePair = this.table[i]; if (object.Equals(value, keyValuePair.Value)) { return i; } } return -1; } /// Determines whether the contains a specific value. /// true if the contains an element with the specified value; otherwise, false. /// The value to locate in the . The value can be null for reference types. // Token: 0x06000116 RID: 278 RVA: 0x0000562C File Offset: 0x0000382C public bool ContainsValue(TValue value) { return this.IndexOfValue(value) >= 0; } /// Sets the capacity to the actual number of elements in the , if that number is less than 90 percent of current capacity. // Token: 0x06000117 RID: 279 RVA: 0x0000563C File Offset: 0x0000383C public void TrimExcess() { if ((double)this.inUse < (double)this.table.Length * 0.9) { this.Capacity = this.inUse; } } /// Gets the value associated with the specified key. /// true if the contains an element with the specified key; otherwise, false. /// The key whose value to get. /// When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. /// /// is null. // Token: 0x06000118 RID: 280 RVA: 0x0000566C File Offset: 0x0000386C public bool TryGetValue(TKey key, out TValue value) { if (key == null) { throw new ArgumentNullException("key"); } int num = this.Find(key); if (num >= 0) { value = this.table[num].Value; return true; } value = default(TValue); return false; } // Token: 0x06000119 RID: 281 RVA: 0x000056C8 File Offset: 0x000038C8 private void EnsureCapacity(int n, int free) { KeyValuePair[] array = this.table; KeyValuePair[] array2 = null; int capacity = this.Capacity; bool flag = free >= 0 && free < this.Count; if (n > capacity) { array2 = new KeyValuePair[n << 1]; } if (array2 != null) { if (flag) { if (free > 0) { Array.Copy(array, 0, array2, 0, free); } int num = this.Count - free; if (num > 0) { Array.Copy(array, free, array2, free + 1, num); } } else { Array.Copy(array, array2, this.Count); } this.table = array2; } else if (flag) { Array.Copy(array, free, array, free + 1, this.Count - free); } } // Token: 0x0600011A RID: 282 RVA: 0x00005784 File Offset: 0x00003984 private void PutImpl(TKey key, TValue value, bool overwrite) { if (key == null) { throw new ArgumentNullException("null key"); } KeyValuePair[] array = this.table; int num = -1; try { num = this.Find(key); } catch (Exception) { throw new InvalidOperationException(); } if (num >= 0) { if (!overwrite) { throw new ArgumentException("element already exists"); } array[num] = new KeyValuePair(key, value); this.modificationCount++; return; } else { num = ~num; if (num > this.Capacity + 1) { throw new Exception(string.Concat(new object[] { "SortedList::internal error (", key, ", ", value, ") at [", num, "]" })); } this.EnsureCapacity(this.Count + 1, num); array = this.table; array[num] = new KeyValuePair(key, value); this.inUse++; this.modificationCount++; return; } } // Token: 0x0600011B RID: 283 RVA: 0x000058C4 File Offset: 0x00003AC4 private void Init(IComparer comparer, int capacity, bool forceSize) { if (comparer == null) { comparer = Comparer.Default; } this.comparer = comparer; if (!forceSize && capacity < this.defaultCapacity) { capacity = this.defaultCapacity; } this.table = new KeyValuePair[capacity]; this.inUse = 0; this.modificationCount = 0; } // Token: 0x0600011C RID: 284 RVA: 0x0000591C File Offset: 0x00003B1C private void CopyToArray(Array arr, int i, SortedList.EnumeratorMode mode) { if (arr == null) { throw new ArgumentNullException("arr"); } if (i < 0 || i + this.Count > arr.Length) { throw new ArgumentOutOfRangeException("i"); } IEnumerator enumerator = new SortedList.Enumerator(this, mode); while (enumerator.MoveNext()) { object obj = enumerator.Current; arr.SetValue(obj, i++); } } // Token: 0x0600011D RID: 285 RVA: 0x0000598C File Offset: 0x00003B8C private int Find(TKey key) { KeyValuePair[] array = this.table; int count = this.Count; if (count == 0) { return -1; } int i = 0; int num = count - 1; while (i <= num) { int num2 = i + num >> 1; int num3 = this.comparer.Compare(array[num2].Key, key); if (num3 == 0) { return num2; } if (num3 < 0) { i = num2 + 1; } else { num = num2 - 1; } } return ~i; } // Token: 0x0600011E RID: 286 RVA: 0x00005A08 File Offset: 0x00003C08 private TKey ToKey(object key) { if (key == null) { throw new ArgumentNullException("key"); } if (!(key is TKey)) { throw new ArgumentException(string.Concat(new object[] { "The value \"", key, "\" isn't of type \"", typeof(TKey), "\" and can't be used in this generic collection." }), "key"); } return (TKey)((object)key); } // Token: 0x0600011F RID: 287 RVA: 0x00005A78 File Offset: 0x00003C78 private TValue ToValue(object value) { if (!(value is TValue)) { throw new ArgumentException(string.Concat(new object[] { "The value \"", value, "\" isn't of type \"", typeof(TValue), "\" and can't be used in this generic collection." }), "value"); } return (TValue)((object)value); } // Token: 0x06000120 RID: 288 RVA: 0x00005AD8 File Offset: 0x00003CD8 internal TKey KeyAt(int index) { if (index >= 0 && index < this.Count) { return this.table[index].Key; } throw new ArgumentOutOfRangeException("Index out of range"); } // Token: 0x06000121 RID: 289 RVA: 0x00005B0C File Offset: 0x00003D0C internal TValue ValueAt(int index) { if (index >= 0 && index < this.Count) { return this.table[index].Value; } throw new ArgumentOutOfRangeException("Index out of range"); } // Token: 0x04000057 RID: 87 private static readonly int INITIAL_SIZE = 16; // Token: 0x04000058 RID: 88 private int inUse; // Token: 0x04000059 RID: 89 private int modificationCount; // Token: 0x0400005A RID: 90 private KeyValuePair[] table; // Token: 0x0400005B RID: 91 private IComparer comparer; // Token: 0x0400005C RID: 92 private int defaultCapacity; // Token: 0x0200001D RID: 29 private enum EnumeratorMode { // Token: 0x0400005E RID: 94 KEY_MODE, // Token: 0x0400005F RID: 95 VALUE_MODE, // Token: 0x04000060 RID: 96 ENTRY_MODE } // Token: 0x0200001E RID: 30 private sealed class Enumerator : IEnumerator, IDictionaryEnumerator, ICloneable { // Token: 0x06000122 RID: 290 RVA: 0x00005B40 File Offset: 0x00003D40 public Enumerator(SortedList host, SortedList.EnumeratorMode mode) { this.host = host; this.stamp = host.modificationCount; this.size = host.Count; this.mode = mode; this.Reset(); } // Token: 0x06000123 RID: 291 RVA: 0x00005B80 File Offset: 0x00003D80 public Enumerator(SortedList host) : this(host, SortedList.EnumeratorMode.ENTRY_MODE) { } // Token: 0x06000125 RID: 293 RVA: 0x00005B98 File Offset: 0x00003D98 public void Reset() { if (this.host.modificationCount != this.stamp || this.invalid) { throw new InvalidOperationException(SortedList.Enumerator.xstr); } this.pos = -1; this.currentKey = null; this.currentValue = null; } // Token: 0x06000126 RID: 294 RVA: 0x00005BE8 File Offset: 0x00003DE8 public bool MoveNext() { if (this.host.modificationCount != this.stamp || this.invalid) { throw new InvalidOperationException(SortedList.Enumerator.xstr); } KeyValuePair[] table = this.host.table; if (++this.pos < this.size) { KeyValuePair keyValuePair = table[this.pos]; this.currentKey = keyValuePair.Key; this.currentValue = keyValuePair.Value; return true; } this.currentKey = null; this.currentValue = null; return false; } // Token: 0x1700004C RID: 76 // (get) Token: 0x06000127 RID: 295 RVA: 0x00005C90 File Offset: 0x00003E90 public DictionaryEntry Entry { get { if (this.invalid || this.pos >= this.size || this.pos == -1) { throw new InvalidOperationException(SortedList.Enumerator.xstr); } return new DictionaryEntry(this.currentKey, this.currentValue); } } // Token: 0x1700004D RID: 77 // (get) Token: 0x06000128 RID: 296 RVA: 0x00005CE4 File Offset: 0x00003EE4 public object Key { get { if (this.invalid || this.pos >= this.size || this.pos == -1) { throw new InvalidOperationException(SortedList.Enumerator.xstr); } return this.currentKey; } } // Token: 0x1700004E RID: 78 // (get) Token: 0x06000129 RID: 297 RVA: 0x00005D20 File Offset: 0x00003F20 public object Value { get { if (this.invalid || this.pos >= this.size || this.pos == -1) { throw new InvalidOperationException(SortedList.Enumerator.xstr); } return this.currentValue; } } // Token: 0x1700004F RID: 79 // (get) Token: 0x0600012A RID: 298 RVA: 0x00005D5C File Offset: 0x00003F5C public object Current { get { if (this.invalid || this.pos >= this.size || this.pos == -1) { throw new InvalidOperationException(SortedList.Enumerator.xstr); } switch (this.mode) { case SortedList.EnumeratorMode.KEY_MODE: return this.currentKey; case SortedList.EnumeratorMode.VALUE_MODE: return this.currentValue; case SortedList.EnumeratorMode.ENTRY_MODE: return this.Entry; default: throw new NotSupportedException(this.mode + " is not a supported mode."); } } } // Token: 0x0600012B RID: 299 RVA: 0x00005DF0 File Offset: 0x00003FF0 public object Clone() { return new SortedList.Enumerator(this.host, this.mode) { stamp = this.stamp, pos = this.pos, size = this.size, currentKey = this.currentKey, currentValue = this.currentValue, invalid = this.invalid }; } // Token: 0x04000061 RID: 97 private SortedList host; // Token: 0x04000062 RID: 98 private int stamp; // Token: 0x04000063 RID: 99 private int pos; // Token: 0x04000064 RID: 100 private int size; // Token: 0x04000065 RID: 101 private SortedList.EnumeratorMode mode; // Token: 0x04000066 RID: 102 private object currentKey; // Token: 0x04000067 RID: 103 private object currentValue; // Token: 0x04000068 RID: 104 private bool invalid; // Token: 0x04000069 RID: 105 private static readonly string xstr = "SortedList.Enumerator: snapshot out of sync."; } // Token: 0x0200001F RID: 31 [Serializable] public struct KeyEnumerator : IEnumerator, IDisposable, IEnumerator { // Token: 0x0600012C RID: 300 RVA: 0x00005E58 File Offset: 0x00004058 internal KeyEnumerator(SortedList l) { this.l = l; this.idx = -2; this.ver = l.modificationCount; } // Token: 0x0600012D RID: 301 RVA: 0x00005E78 File Offset: 0x00004078 void IEnumerator.Reset() { if (this.ver != this.l.modificationCount) { throw new InvalidOperationException("Collection was modified after the enumerator was instantiated."); } this.idx = -2; } // Token: 0x17000050 RID: 80 // (get) Token: 0x0600012E RID: 302 RVA: 0x00005EA4 File Offset: 0x000040A4 object IEnumerator.Current { get { return this.Current; } } // Token: 0x0600012F RID: 303 RVA: 0x00005EB4 File Offset: 0x000040B4 public void Dispose() { this.idx = -2; } // Token: 0x06000130 RID: 304 RVA: 0x00005EC0 File Offset: 0x000040C0 public bool MoveNext() { if (this.ver != this.l.modificationCount) { throw new InvalidOperationException("Collection was modified after the enumerator was instantiated."); } if (this.idx == -2) { this.idx = this.l.Count; } return this.idx != -1 && --this.idx != -1; } // Token: 0x17000051 RID: 81 // (get) Token: 0x06000131 RID: 305 RVA: 0x00005F34 File Offset: 0x00004134 public TKey Current { get { if (this.idx < 0) { throw new InvalidOperationException(); } return this.l.KeyAt(this.l.Count - 1 - this.idx); } } // Token: 0x0400006A RID: 106 private const int NOT_STARTED = -2; // Token: 0x0400006B RID: 107 private const int FINISHED = -1; // Token: 0x0400006C RID: 108 private SortedList l; // Token: 0x0400006D RID: 109 private int idx; // Token: 0x0400006E RID: 110 private int ver; } // Token: 0x02000020 RID: 32 [Serializable] public struct ValueEnumerator : IEnumerator, IDisposable, IEnumerator { // Token: 0x06000132 RID: 306 RVA: 0x00005F68 File Offset: 0x00004168 internal ValueEnumerator(SortedList l) { this.l = l; this.idx = -2; this.ver = l.modificationCount; } // Token: 0x06000133 RID: 307 RVA: 0x00005F88 File Offset: 0x00004188 void IEnumerator.Reset() { if (this.ver != this.l.modificationCount) { throw new InvalidOperationException("Collection was modified after the enumerator was instantiated."); } this.idx = -2; } // Token: 0x17000052 RID: 82 // (get) Token: 0x06000134 RID: 308 RVA: 0x00005FB4 File Offset: 0x000041B4 object IEnumerator.Current { get { return this.Current; } } // Token: 0x06000135 RID: 309 RVA: 0x00005FC4 File Offset: 0x000041C4 public void Dispose() { this.idx = -2; } // Token: 0x06000136 RID: 310 RVA: 0x00005FD0 File Offset: 0x000041D0 public bool MoveNext() { if (this.ver != this.l.modificationCount) { throw new InvalidOperationException("Collection was modified after the enumerator was instantiated."); } if (this.idx == -2) { this.idx = this.l.Count; } return this.idx != -1 && --this.idx != -1; } // Token: 0x17000053 RID: 83 // (get) Token: 0x06000137 RID: 311 RVA: 0x00006044 File Offset: 0x00004244 public TValue Current { get { if (this.idx < 0) { throw new InvalidOperationException(); } return this.l.ValueAt(this.l.Count - 1 - this.idx); } } // Token: 0x0400006F RID: 111 private const int NOT_STARTED = -2; // Token: 0x04000070 RID: 112 private const int FINISHED = -1; // Token: 0x04000071 RID: 113 private SortedList l; // Token: 0x04000072 RID: 114 private int idx; // Token: 0x04000073 RID: 115 private int ver; } // Token: 0x02000021 RID: 33 private class ListKeys : ICollection, IEnumerable, IList, ICollection, IEnumerable { // Token: 0x06000138 RID: 312 RVA: 0x00006078 File Offset: 0x00004278 public ListKeys(SortedList host) { if (host == null) { throw new ArgumentNullException(); } this.host = host; } // Token: 0x06000139 RID: 313 RVA: 0x00006094 File Offset: 0x00004294 IEnumerator IEnumerable.GetEnumerator() { for (int i = 0; i < this.host.Count; i++) { yield return this.host.KeyAt(i); } yield break; } // Token: 0x0600013A RID: 314 RVA: 0x000060B0 File Offset: 0x000042B0 public virtual void Add(TKey item) { throw new NotSupportedException(); } // Token: 0x0600013B RID: 315 RVA: 0x000060B8 File Offset: 0x000042B8 public virtual bool Remove(TKey key) { throw new NotSupportedException(); } // Token: 0x0600013C RID: 316 RVA: 0x000060C0 File Offset: 0x000042C0 public virtual void Clear() { throw new NotSupportedException(); } // Token: 0x0600013D RID: 317 RVA: 0x000060C8 File Offset: 0x000042C8 public virtual void CopyTo(TKey[] array, int arrayIndex) { if (this.host.Count == 0) { return; } if (array == null) { throw new ArgumentNullException("array"); } if (arrayIndex < 0) { throw new ArgumentOutOfRangeException(); } if (arrayIndex >= array.Length) { throw new ArgumentOutOfRangeException("arrayIndex is greater than or equal to array.Length"); } if (this.Count > array.Length - arrayIndex) { throw new ArgumentOutOfRangeException("Not enough space in array from arrayIndex to end of array"); } int num = arrayIndex; for (int i = 0; i < this.Count; i++) { array[num++] = this.host.KeyAt(i); } } // Token: 0x0600013E RID: 318 RVA: 0x00006164 File Offset: 0x00004364 public virtual bool Contains(TKey item) { return this.host.IndexOfKey(item) > -1; } // Token: 0x0600013F RID: 319 RVA: 0x00006178 File Offset: 0x00004378 public virtual int IndexOf(TKey item) { return this.host.IndexOfKey(item); } // Token: 0x06000140 RID: 320 RVA: 0x00006188 File Offset: 0x00004388 public virtual void Insert(int index, TKey item) { throw new NotSupportedException(); } // Token: 0x06000141 RID: 321 RVA: 0x00006190 File Offset: 0x00004390 public virtual void RemoveAt(int index) { throw new NotSupportedException(); } // Token: 0x17000054 RID: 84 public virtual TKey this[int index] { get { return this.host.KeyAt(index); } set { throw new NotSupportedException("attempt to modify a key"); } } // Token: 0x06000144 RID: 324 RVA: 0x000061B4 File Offset: 0x000043B4 public virtual IEnumerator GetEnumerator() { return new SortedList.KeyEnumerator(this.host); } // Token: 0x17000055 RID: 85 // (get) Token: 0x06000145 RID: 325 RVA: 0x000061C8 File Offset: 0x000043C8 public virtual int Count { get { return this.host.Count; } } // Token: 0x17000056 RID: 86 // (get) Token: 0x06000146 RID: 326 RVA: 0x000061D8 File Offset: 0x000043D8 public virtual bool IsSynchronized { get { return ((ICollection)this.host).IsSynchronized; } } // Token: 0x17000057 RID: 87 // (get) Token: 0x06000147 RID: 327 RVA: 0x000061E8 File Offset: 0x000043E8 public virtual bool IsReadOnly { get { return true; } } // Token: 0x17000058 RID: 88 // (get) Token: 0x06000148 RID: 328 RVA: 0x000061EC File Offset: 0x000043EC public virtual object SyncRoot { get { return ((ICollection)this.host).SyncRoot; } } // Token: 0x06000149 RID: 329 RVA: 0x000061FC File Offset: 0x000043FC public virtual void CopyTo(Array array, int arrayIndex) { this.host.CopyToArray(array, arrayIndex, SortedList.EnumeratorMode.KEY_MODE); } // Token: 0x04000074 RID: 116 private SortedList host; } // Token: 0x02000022 RID: 34 private class ListValues : ICollection, IEnumerable, IList, ICollection, IEnumerable { // Token: 0x0600014A RID: 330 RVA: 0x0000620C File Offset: 0x0000440C public ListValues(SortedList host) { if (host == null) { throw new ArgumentNullException(); } this.host = host; } // Token: 0x0600014B RID: 331 RVA: 0x00006228 File Offset: 0x00004428 IEnumerator IEnumerable.GetEnumerator() { for (int i = 0; i < this.host.Count; i++) { yield return this.host.ValueAt(i); } yield break; } // Token: 0x0600014C RID: 332 RVA: 0x00006244 File Offset: 0x00004444 public virtual void Add(TValue item) { throw new NotSupportedException(); } // Token: 0x0600014D RID: 333 RVA: 0x0000624C File Offset: 0x0000444C public virtual bool Remove(TValue value) { throw new NotSupportedException(); } // Token: 0x0600014E RID: 334 RVA: 0x00006254 File Offset: 0x00004454 public virtual void Clear() { throw new NotSupportedException(); } // Token: 0x0600014F RID: 335 RVA: 0x0000625C File Offset: 0x0000445C public virtual void CopyTo(TValue[] array, int arrayIndex) { if (this.host.Count == 0) { return; } if (array == null) { throw new ArgumentNullException("array"); } if (arrayIndex < 0) { throw new ArgumentOutOfRangeException(); } if (arrayIndex >= array.Length) { throw new ArgumentOutOfRangeException("arrayIndex is greater than or equal to array.Length"); } if (this.Count > array.Length - arrayIndex) { throw new ArgumentOutOfRangeException("Not enough space in array from arrayIndex to end of array"); } int num = arrayIndex; for (int i = 0; i < this.Count; i++) { array[num++] = this.host.ValueAt(i); } } // Token: 0x06000150 RID: 336 RVA: 0x000062F8 File Offset: 0x000044F8 public virtual bool Contains(TValue item) { return this.host.IndexOfValue(item) > -1; } // Token: 0x06000151 RID: 337 RVA: 0x0000630C File Offset: 0x0000450C public virtual int IndexOf(TValue item) { return this.host.IndexOfValue(item); } // Token: 0x06000152 RID: 338 RVA: 0x0000631C File Offset: 0x0000451C public virtual void Insert(int index, TValue item) { throw new NotSupportedException(); } // Token: 0x06000153 RID: 339 RVA: 0x00006324 File Offset: 0x00004524 public virtual void RemoveAt(int index) { throw new NotSupportedException(); } // Token: 0x17000059 RID: 89 public virtual TValue this[int index] { get { return this.host.ValueAt(index); } set { throw new NotSupportedException("attempt to modify a key"); } } // Token: 0x06000156 RID: 342 RVA: 0x00006348 File Offset: 0x00004548 public virtual IEnumerator GetEnumerator() { return new SortedList.ValueEnumerator(this.host); } // Token: 0x1700005A RID: 90 // (get) Token: 0x06000157 RID: 343 RVA: 0x0000635C File Offset: 0x0000455C public virtual int Count { get { return this.host.Count; } } // Token: 0x1700005B RID: 91 // (get) Token: 0x06000158 RID: 344 RVA: 0x0000636C File Offset: 0x0000456C public virtual bool IsSynchronized { get { return ((ICollection)this.host).IsSynchronized; } } // Token: 0x1700005C RID: 92 // (get) Token: 0x06000159 RID: 345 RVA: 0x0000637C File Offset: 0x0000457C public virtual bool IsReadOnly { get { return true; } } // Token: 0x1700005D RID: 93 // (get) Token: 0x0600015A RID: 346 RVA: 0x00006380 File Offset: 0x00004580 public virtual object SyncRoot { get { return ((ICollection)this.host).SyncRoot; } } // Token: 0x0600015B RID: 347 RVA: 0x00006390 File Offset: 0x00004590 public virtual void CopyTo(Array array, int arrayIndex) { this.host.CopyToArray(array, arrayIndex, SortedList.EnumeratorMode.VALUE_MODE); } // Token: 0x04000075 RID: 117 private SortedList host; } } }