This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+731
View File
@@ -0,0 +1,731 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Collections.Generic
{
/// <summary>Represents a doubly linked list.</summary>
/// <typeparam name="T">Specifies the element type of the linked list.</typeparam>
/// <filterpriority>1</filterpriority>
// Token: 0x0200000B RID: 11
[ComVisible(false)]
[Serializable]
public class LinkedList<T> : IEnumerable<T>, ICollection, IDeserializationCallback, IEnumerable, ICollection<T>, ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.LinkedList`1" /> class that is empty.</summary>
// Token: 0x0600000F RID: 15 RVA: 0x00002188 File Offset: 0x00000388
public LinkedList()
{
this.syncRoot = new object();
this.first = null;
this.count = (this.version = 0U);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.LinkedList`1" /> class that contains elements copied from the specified <see cref="T:System.Collections.IEnumerable" /> and has sufficient capacity to accommodate the number of elements copied. </summary>
/// <param name="collection">The <see cref="T:System.Collections.IEnumerable" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="collection" /> is null.</exception>
// Token: 0x06000010 RID: 16 RVA: 0x000021C0 File Offset: 0x000003C0
public LinkedList(IEnumerable<T> collection)
: this()
{
foreach (T t in collection)
{
this.AddLast(t);
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.LinkedList`1" /> class that is serializable with the specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" />.</summary>
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object containing the information required to serialize the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object containing the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
// Token: 0x06000011 RID: 17 RVA: 0x00002228 File Offset: 0x00000428
protected LinkedList(SerializationInfo info, StreamingContext context)
: this()
{
this.si = info;
this.syncRoot = new object();
}
// Token: 0x06000012 RID: 18 RVA: 0x00002244 File Offset: 0x00000444
void ICollection<T>.Add(T value)
{
this.AddLast(value);
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// Token: 0x06000013 RID: 19 RVA: 0x00002250 File Offset: 0x00000450
void ICollection.CopyTo(Array array, int index)
{
T[] array2 = array as T[];
if (array2 == null)
{
throw new ArgumentException("array");
}
this.CopyTo(array2, index);
}
// Token: 0x06000014 RID: 20 RVA: 0x00002280 File Offset: 0x00000480
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Returns an enumerator that iterates through the linked list as a collection.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the linked list as a collection.</returns>
// Token: 0x06000015 RID: 21 RVA: 0x00002290 File Offset: 0x00000490
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
// Token: 0x17000004 RID: 4
// (get) Token: 0x06000016 RID: 22 RVA: 0x000022A0 File Offset: 0x000004A0
bool ICollection<T>.IsReadOnly
{
get
{
return false;
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.LinkedList`1" />, this property always returns false.</returns>
// Token: 0x17000005 RID: 5
// (get) Token: 0x06000017 RID: 23 RVA: 0x000022A4 File Offset: 0x000004A4
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.LinkedList`1" />, this property always returns the current instance.</returns>
// Token: 0x17000006 RID: 6
// (get) Token: 0x06000018 RID: 24 RVA: 0x000022A8 File Offset: 0x000004A8
object ICollection.SyncRoot
{
get
{
return this.syncRoot;
}
}
// Token: 0x06000019 RID: 25 RVA: 0x000022B0 File Offset: 0x000004B0
private void VerifyReferencedNode(LinkedListNode<T> node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
if (node.List != this)
{
throw new InvalidOperationException();
}
}
// Token: 0x0600001A RID: 26 RVA: 0x000022D8 File Offset: 0x000004D8
private static void VerifyBlankNode(LinkedListNode<T> newNode)
{
if (newNode == null)
{
throw new ArgumentNullException("newNode");
}
if (newNode.List != null)
{
throw new InvalidOperationException();
}
}
/// <summary>Adds a new node containing the specified value after the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" />.</returns>
/// <param name="node">The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> after which to insert a new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" />.</param>
/// <param name="value">The value to add to the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> is not in the current <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x0600001B RID: 27 RVA: 0x00002308 File Offset: 0x00000508
public LinkedListNode<T> AddAfter(LinkedListNode<T> node, T value)
{
this.VerifyReferencedNode(node);
LinkedListNode<T> linkedListNode = new LinkedListNode<T>(this, value, node, node.forward);
this.count += 1U;
this.version += 1U;
return linkedListNode;
}
/// <summary>Adds the specified new node after the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <param name="node">The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> after which to insert <paramref name="newNode" />.</param>
/// <param name="newNode">The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add to the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.-or-<paramref name="newNode" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> is not in the current <see cref="T:System.Collections.Generic.LinkedList`1" />.-or-<paramref name="newNode" /> belongs to another <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x0600001C RID: 28 RVA: 0x00002348 File Offset: 0x00000548
public void AddAfter(LinkedListNode<T> node, LinkedListNode<T> newNode)
{
this.VerifyReferencedNode(node);
LinkedList<T>.VerifyBlankNode(newNode);
newNode.InsertBetween(node, node.forward, this);
this.count += 1U;
this.version += 1U;
}
/// <summary>Adds a new node containing the specified value before the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" />.</returns>
/// <param name="node">The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> before which to insert a new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" />.</param>
/// <param name="value">The value to add to the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> is not in the current <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x0600001D RID: 29 RVA: 0x0000238C File Offset: 0x0000058C
public LinkedListNode<T> AddBefore(LinkedListNode<T> node, T value)
{
this.VerifyReferencedNode(node);
LinkedListNode<T> linkedListNode = new LinkedListNode<T>(this, value, node.back, node);
this.count += 1U;
this.version += 1U;
if (node == this.first)
{
this.first = linkedListNode;
}
return linkedListNode;
}
/// <summary>Adds the specified new node before the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <param name="node">The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> before which to insert <paramref name="newNode" />.</param>
/// <param name="newNode">The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add to the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.-or-<paramref name="newNode" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> is not in the current <see cref="T:System.Collections.Generic.LinkedList`1" />.-or-<paramref name="newNode" /> belongs to another <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x0600001E RID: 30 RVA: 0x000023E0 File Offset: 0x000005E0
public void AddBefore(LinkedListNode<T> node, LinkedListNode<T> newNode)
{
this.VerifyReferencedNode(node);
LinkedList<T>.VerifyBlankNode(newNode);
newNode.InsertBetween(node.back, node, this);
this.count += 1U;
this.version += 1U;
if (node == this.first)
{
this.first = newNode;
}
}
/// <summary>Adds the specified new node at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <param name="node">The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> belongs to another <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x0600001F RID: 31 RVA: 0x00002438 File Offset: 0x00000638
public void AddFirst(LinkedListNode<T> node)
{
LinkedList<T>.VerifyBlankNode(node);
if (this.first == null)
{
node.SelfReference(this);
}
else
{
node.InsertBetween(this.first.back, this.first, this);
}
this.count += 1U;
this.version += 1U;
this.first = node;
}
/// <summary>Adds a new node containing the specified value at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" />.</returns>
/// <param name="value">The value to add at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
// Token: 0x06000020 RID: 32 RVA: 0x000024A0 File Offset: 0x000006A0
public LinkedListNode<T> AddFirst(T value)
{
LinkedListNode<T> linkedListNode;
if (this.first == null)
{
linkedListNode = new LinkedListNode<T>(this, value);
}
else
{
linkedListNode = new LinkedListNode<T>(this, value, this.first.back, this.first);
}
this.count += 1U;
this.version += 1U;
this.first = linkedListNode;
return linkedListNode;
}
/// <summary>Adds a new node containing the specified value at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" />.</returns>
/// <param name="value">The value to add at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
// Token: 0x06000021 RID: 33 RVA: 0x00002504 File Offset: 0x00000704
public LinkedListNode<T> AddLast(T value)
{
LinkedListNode<T> linkedListNode;
if (this.first == null)
{
linkedListNode = new LinkedListNode<T>(this, value);
this.first = linkedListNode;
}
else
{
linkedListNode = new LinkedListNode<T>(this, value, this.first.back, this.first);
}
this.count += 1U;
this.version += 1U;
return linkedListNode;
}
/// <summary>Adds the specified new node at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <param name="node">The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> belongs to another <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x06000022 RID: 34 RVA: 0x00002568 File Offset: 0x00000768
public void AddLast(LinkedListNode<T> node)
{
LinkedList<T>.VerifyBlankNode(node);
if (this.first == null)
{
node.SelfReference(this);
this.first = node;
}
else
{
node.InsertBetween(this.first.back, this.first, this);
}
this.count += 1U;
this.version += 1U;
}
/// <summary>Removes all nodes from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
// Token: 0x06000023 RID: 35 RVA: 0x000025D0 File Offset: 0x000007D0
public void Clear()
{
while (this.first != null)
{
this.RemoveLast();
}
}
/// <summary>Determines whether a value is in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>true if <paramref name="value" /> is found in the <see cref="T:System.Collections.Generic.LinkedList`1" />; otherwise, false.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.LinkedList`1" />. The value can be null for reference types.</param>
// Token: 0x06000024 RID: 36 RVA: 0x000025E8 File Offset: 0x000007E8
public bool Contains(T value)
{
LinkedListNode<T> forward = this.first;
if (forward == null)
{
return false;
}
while (!value.Equals(forward.Value))
{
forward = forward.forward;
if (forward == this.first)
{
return false;
}
}
return true;
}
/// <summary>Copies the entire <see cref="T:System.Collections.Generic.LinkedList`1" /> to a compatible one-dimensional <see cref="T:System.Array" />, starting at the specified index of the target array.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.LinkedList`1" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.LinkedList`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x06000025 RID: 37 RVA: 0x00002638 File Offset: 0x00000838
public void CopyTo(T[] array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
if (index < array.GetLowerBound(0))
{
throw new ArgumentOutOfRangeException("index");
}
if (array.Rank != 1)
{
throw new ArgumentException("array", "Array is multidimensional");
}
if ((long)(array.Length - index + array.GetLowerBound(0)) < (long)((ulong)this.count))
{
throw new ArgumentException("number of items exceeds capacity");
}
LinkedListNode<T> forward = this.first;
if (this.first == null)
{
return;
}
do
{
array[index] = forward.Value;
index++;
forward = forward.forward;
}
while (forward != this.first);
}
/// <summary>Finds the first node that contains the specified value.</summary>
/// <returns>The first <see cref="T:System.Collections.Generic.LinkedListNode`1" /> that contains the specified value, if found; otherwise, null.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
// Token: 0x06000026 RID: 38 RVA: 0x000026E8 File Offset: 0x000008E8
public LinkedListNode<T> Find(T value)
{
LinkedListNode<T> forward = this.first;
if (forward == null)
{
return null;
}
while ((value != null || forward.Value != null) && (value == null || !value.Equals(forward.Value)))
{
forward = forward.forward;
if (forward == this.first)
{
return null;
}
}
return forward;
}
/// <summary>Finds the last node that contains the specified value.</summary>
/// <returns>The last <see cref="T:System.Collections.Generic.LinkedListNode`1" /> that contains the specified value, if found; otherwise, null.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
// Token: 0x06000027 RID: 39 RVA: 0x00002760 File Offset: 0x00000960
public LinkedListNode<T> FindLast(T value)
{
LinkedListNode<T> back = this.first;
if (back == null)
{
return null;
}
for (;;)
{
back = back.back;
if (value.Equals(back.Value))
{
break;
}
if (back == this.first)
{
goto Block_3;
}
}
return back;
Block_3:
return null;
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.LinkedList`1.Enumerator" /> for the <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
// Token: 0x06000028 RID: 40 RVA: 0x000027B0 File Offset: 0x000009B0
public LinkedList<T>.Enumerator GetEnumerator()
{
return new LinkedList<T>.Enumerator(this);
}
/// <summary>Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and returns the data needed to serialize the <see cref="T:System.Collections.Generic.LinkedList`1" /> instance.</summary>
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information required to serialize the <see cref="T:System.Collections.Generic.LinkedList`1" /> instance.</param>
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Generic.LinkedList`1" /> instance.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null.</exception>
// Token: 0x06000029 RID: 41 RVA: 0x000027B8 File Offset: 0x000009B8
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
T[] array = new T[this.count];
this.CopyTo(array, 0);
info.AddValue("DataArray", array, typeof(T[]));
info.AddValue("version", this.version);
}
/// <summary>Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and raises the deserialization event when the deserialization is complete.</summary>
/// <param name="sender">The source of the deserialization event.</param>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object associated with the current <see cref="T:System.Collections.Generic.LinkedList`1" /> instance is invalid.</exception>
// Token: 0x0600002A RID: 42 RVA: 0x00002804 File Offset: 0x00000A04
public virtual void OnDeserialization(object sender)
{
if (this.si != null)
{
T[] array = (T[])this.si.GetValue("DataArray", typeof(T[]));
if (array != null)
{
foreach (T t in array)
{
this.AddLast(t);
}
}
this.version = this.si.GetUInt32("version");
this.si = null;
}
}
/// <summary>Removes the first occurrence of the specified value from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>true if the element containing <paramref name="value" /> is successfully removed; otherwise, false. This method also returns false if <paramref name="value" /> was not found in the original <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
/// <param name="value">The value to remove from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
// Token: 0x0600002B RID: 43 RVA: 0x00002888 File Offset: 0x00000A88
public bool Remove(T value)
{
LinkedListNode<T> linkedListNode = this.Find(value);
if (linkedListNode == null)
{
return false;
}
this.Remove(linkedListNode);
return true;
}
/// <summary>Removes the specified node from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <param name="node">The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to remove from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="node" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="node" /> is not in the current <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
// Token: 0x0600002C RID: 44 RVA: 0x000028B0 File Offset: 0x00000AB0
public void Remove(LinkedListNode<T> node)
{
this.VerifyReferencedNode(node);
this.count -= 1U;
if (this.count == 0U)
{
this.first = null;
}
if (node == this.first)
{
this.first = this.first.forward;
}
this.version += 1U;
node.Detach();
}
/// <summary>Removes the node at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Collections.Generic.LinkedList`1" /> is empty.</exception>
// Token: 0x0600002D RID: 45 RVA: 0x00002918 File Offset: 0x00000B18
public void RemoveFirst()
{
if (this.first != null)
{
this.Remove(this.first);
}
}
/// <summary>Removes the node at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Collections.Generic.LinkedList`1" /> is empty.</exception>
// Token: 0x0600002E RID: 46 RVA: 0x00002934 File Offset: 0x00000B34
public void RemoveLast()
{
if (this.first != null)
{
this.Remove(this.first.back);
}
}
/// <summary>Gets the number of nodes actually contained in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The number of nodes actually contained in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
// Token: 0x17000007 RID: 7
// (get) Token: 0x0600002F RID: 47 RVA: 0x00002954 File Offset: 0x00000B54
public int Count
{
get
{
return (int)this.count;
}
}
/// <summary>Gets the first node of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The first <see cref="T:System.Collections.Generic.LinkedListNode`1" /> of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
// Token: 0x17000008 RID: 8
// (get) Token: 0x06000030 RID: 48 RVA: 0x0000295C File Offset: 0x00000B5C
public LinkedListNode<T> First
{
get
{
return this.first;
}
}
/// <summary>Gets the last node of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>The last <see cref="T:System.Collections.Generic.LinkedListNode`1" /> of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
// Token: 0x17000009 RID: 9
// (get) Token: 0x06000031 RID: 49 RVA: 0x00002964 File Offset: 0x00000B64
public LinkedListNode<T> Last
{
get
{
return (this.first == null) ? null : this.first.back;
}
}
// Token: 0x04000021 RID: 33
private const string DataArrayKey = "DataArray";
// Token: 0x04000022 RID: 34
private const string VersionKey = "version";
// Token: 0x04000023 RID: 35
private uint count;
// Token: 0x04000024 RID: 36
private uint version;
// Token: 0x04000025 RID: 37
private object syncRoot;
// Token: 0x04000026 RID: 38
internal LinkedListNode<T> first;
// Token: 0x04000027 RID: 39
internal SerializationInfo si;
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
// Token: 0x0200000C RID: 12
[Serializable]
public struct Enumerator : IEnumerator<T>, IEnumerator, IDisposable
{
// Token: 0x06000032 RID: 50 RVA: 0x00002984 File Offset: 0x00000B84
internal Enumerator(LinkedList<T> parent)
{
this.list = parent;
this.current = null;
this.index = -1;
this.version = parent.version;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x1700000A RID: 10
// (get) Token: 0x06000033 RID: 51 RVA: 0x000029A8 File Offset: 0x00000BA8
object IEnumerator.Current
{
get
{
return this.Current;
}
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection. This class cannot be inherited.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x06000034 RID: 52 RVA: 0x000029B8 File Offset: 0x00000BB8
void IEnumerator.Reset()
{
if (this.list == null)
{
throw new ObjectDisposedException(null);
}
if (this.version != this.list.version)
{
throw new InvalidOperationException("list modified");
}
this.current = null;
this.index = -1;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.LinkedList`1" /> at the current position of the enumerator.</returns>
// Token: 0x1700000B RID: 11
// (get) Token: 0x06000035 RID: 53 RVA: 0x00002A08 File Offset: 0x00000C08
public T Current
{
get
{
if (this.list == null)
{
throw new ObjectDisposedException(null);
}
if (this.current == null)
{
throw new InvalidOperationException();
}
return this.current.Value;
}
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x06000036 RID: 54 RVA: 0x00002A44 File Offset: 0x00000C44
public bool MoveNext()
{
if (this.list == null)
{
throw new ObjectDisposedException(null);
}
if (this.version != this.list.version)
{
throw new InvalidOperationException("list modified");
}
if (this.current == null)
{
this.current = this.list.first;
}
else
{
this.current = this.current.forward;
if (this.current == this.list.first)
{
this.current = null;
}
}
if (this.current == null)
{
this.index = -1;
return false;
}
this.index++;
return true;
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.LinkedList`1.Enumerator" />.</summary>
// Token: 0x06000037 RID: 55 RVA: 0x00002AF8 File Offset: 0x00000CF8
public void Dispose()
{
if (this.list == null)
{
throw new ObjectDisposedException(null);
}
this.current = null;
this.list = null;
}
// Token: 0x04000028 RID: 40
private const string VersionKey = "version";
// Token: 0x04000029 RID: 41
private const string IndexKey = "index";
// Token: 0x0400002A RID: 42
private const string ListKey = "list";
// Token: 0x0400002B RID: 43
private LinkedList<T> list;
// Token: 0x0400002C RID: 44
private LinkedListNode<T> current;
// Token: 0x0400002D RID: 45
private int index;
// Token: 0x0400002E RID: 46
private uint version;
}
}
}
@@ -0,0 +1,133 @@
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
/// <summary>Represents a node in a <see cref="T:System.Collections.Generic.LinkedList`1" />. This class cannot be inherited.</summary>
/// <typeparam name="T">Specifies the element type of the linked list.</typeparam>
/// <filterpriority>1</filterpriority>
// Token: 0x0200000D RID: 13
[ComVisible(false)]
public sealed class LinkedListNode<T>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.LinkedListNode`1" /> class, containing the specified value.</summary>
/// <param name="value">The value to contain in the <see cref="T:System.Collections.Generic.LinkedListNode`1" />.</param>
// Token: 0x06000038 RID: 56 RVA: 0x00002B28 File Offset: 0x00000D28
public LinkedListNode(T value)
{
this.item = value;
}
// Token: 0x06000039 RID: 57 RVA: 0x00002B38 File Offset: 0x00000D38
internal LinkedListNode(LinkedList<T> list, T value)
{
this.container = list;
this.item = value;
this.forward = this;
this.back = this;
}
// Token: 0x0600003A RID: 58 RVA: 0x00002B6C File Offset: 0x00000D6C
internal LinkedListNode(LinkedList<T> list, T value, LinkedListNode<T> previousNode, LinkedListNode<T> nextNode)
{
this.container = list;
this.item = value;
this.back = previousNode;
this.forward = nextNode;
previousNode.forward = this;
nextNode.back = this;
}
// Token: 0x0600003B RID: 59 RVA: 0x00002BAC File Offset: 0x00000DAC
internal void Detach()
{
this.back.forward = this.forward;
this.forward.back = this.back;
this.forward = (this.back = null);
this.container = null;
}
// Token: 0x0600003C RID: 60 RVA: 0x00002BF4 File Offset: 0x00000DF4
internal void SelfReference(LinkedList<T> list)
{
this.forward = this;
this.back = this;
this.container = list;
}
// Token: 0x0600003D RID: 61 RVA: 0x00002C0C File Offset: 0x00000E0C
internal void InsertBetween(LinkedListNode<T> previousNode, LinkedListNode<T> nextNode, LinkedList<T> list)
{
previousNode.forward = this;
nextNode.back = this;
this.forward = nextNode;
this.back = previousNode;
this.container = list;
}
/// <summary>Gets the <see cref="T:System.Collections.Generic.LinkedList`1" /> that the <see cref="T:System.Collections.Generic.LinkedListNode`1" /> belongs to.</summary>
/// <returns>A reference to the <see cref="T:System.Collections.Generic.LinkedList`1" /> that the <see cref="T:System.Collections.Generic.LinkedListNode`1" /> belongs to, or null if the <see cref="T:System.Collections.Generic.LinkedListNode`1" /> is not linked.</returns>
// Token: 0x1700000C RID: 12
// (get) Token: 0x0600003E RID: 62 RVA: 0x00002C34 File Offset: 0x00000E34
public LinkedList<T> List
{
get
{
return this.container;
}
}
/// <summary>Gets the next node in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>A reference to the next node in the <see cref="T:System.Collections.Generic.LinkedList`1" />, or null if the current node is the last element (<see cref="P:System.Collections.Generic.LinkedList`1.Last" />) of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
// Token: 0x1700000D RID: 13
// (get) Token: 0x0600003F RID: 63 RVA: 0x00002C3C File Offset: 0x00000E3C
public LinkedListNode<T> Next
{
get
{
return (this.container == null || this.forward == this.container.first) ? null : this.forward;
}
}
/// <summary>Gets the previous node in the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
/// <returns>A reference to the previous node in the <see cref="T:System.Collections.Generic.LinkedList`1" />, or null if the current node is the first element (<see cref="P:System.Collections.Generic.LinkedList`1.First" />) of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</returns>
// Token: 0x1700000E RID: 14
// (get) Token: 0x06000040 RID: 64 RVA: 0x00002C6C File Offset: 0x00000E6C
public LinkedListNode<T> Previous
{
get
{
return (this.container == null || this == this.container.first) ? null : this.back;
}
}
/// <summary>Gets the value contained in the node.</summary>
/// <returns>The value contained in the node.</returns>
// Token: 0x1700000F RID: 15
// (get) Token: 0x06000041 RID: 65 RVA: 0x00002CA4 File Offset: 0x00000EA4
// (set) Token: 0x06000042 RID: 66 RVA: 0x00002CAC File Offset: 0x00000EAC
public T Value
{
get
{
return this.item;
}
set
{
this.item = value;
}
}
// Token: 0x0400002F RID: 47
private T item;
// Token: 0x04000030 RID: 48
private LinkedList<T> container;
// Token: 0x04000031 RID: 49
internal LinkedListNode<T> forward;
// Token: 0x04000032 RID: 50
internal LinkedListNode<T> back;
}
}
+414
View File
@@ -0,0 +1,414 @@
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
/// <summary>Represents a first-in, first-out collection of objects.</summary>
/// <typeparam name="T">Specifies the type of elements in the queue.</typeparam>
/// <filterpriority>1</filterpriority>
// Token: 0x0200000E RID: 14
[ComVisible(false)]
[Serializable]
public class Queue<T> : IEnumerable<T>, ICollection, IEnumerable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Queue`1" /> class that is empty and has the default initial capacity.</summary>
// Token: 0x06000043 RID: 67 RVA: 0x00002CB8 File Offset: 0x00000EB8
public Queue()
{
this._array = new T[0];
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Queue`1" /> class that is empty and has the specified initial capacity.</summary>
/// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.Queue`1" /> can contain.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.</exception>
// Token: 0x06000044 RID: 68 RVA: 0x00002CCC File Offset: 0x00000ECC
public Queue(int count)
{
if (count < 0)
{
throw new ArgumentOutOfRangeException("count");
}
this._array = new T[count];
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Queue`1" /> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.</summary>
/// <param name="collection">The collection whose elements are copied to the new <see cref="T:System.Collections.Generic.Queue`1" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="collection" /> is null.</exception>
// Token: 0x06000045 RID: 69 RVA: 0x00002D00 File Offset: 0x00000F00
public Queue(IEnumerable<T> collection)
{
if (collection == null)
{
throw new ArgumentNullException("collection");
}
ICollection<T> collection2 = collection as ICollection<T>;
int num = ((collection2 == null) ? 0 : collection2.Count);
this._array = new T[num];
foreach (T t in collection)
{
this.Enqueue(t);
}
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// Token: 0x06000046 RID: 70 RVA: 0x00002D9C File Offset: 0x00000F9C
void ICollection.CopyTo(Array array, int idx)
{
if (array == null)
{
throw new ArgumentNullException();
}
if (idx > array.Length)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - idx < this._size)
{
throw new ArgumentOutOfRangeException();
}
if (this._size == 0)
{
return;
}
try
{
int num = this._array.Length;
int num2 = num - this._head;
Array.Copy(this._array, this._head, array, idx, Math.Min(this._size, num2));
if (this._size > num2)
{
Array.Copy(this._array, 0, array, idx + num2, this._size - num2);
}
}
catch (ArrayTypeMismatchException)
{
throw new ArgumentException();
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.Queue`1" />, this property always returns false.</returns>
// Token: 0x17000010 RID: 16
// (get) Token: 0x06000047 RID: 71 RVA: 0x00002E70 File Offset: 0x00001070
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.Queue`1" />, this property always returns the current instance.</returns>
// Token: 0x17000011 RID: 17
// (get) Token: 0x06000048 RID: 72 RVA: 0x00002E74 File Offset: 0x00001074
object ICollection.SyncRoot
{
get
{
return this;
}
}
// Token: 0x06000049 RID: 73 RVA: 0x00002E78 File Offset: 0x00001078
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Returns an enumerator that iterates through a collection.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
// Token: 0x0600004A RID: 74 RVA: 0x00002E88 File Offset: 0x00001088
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Removes all objects from the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x0600004B RID: 75 RVA: 0x00002E98 File Offset: 0x00001098
public void Clear()
{
Array.Clear(this._array, 0, this._array.Length);
this._head = (this._tail = (this._size = 0));
this._version++;
}
/// <summary>Determines whether an element is in the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <returns>true if <paramref name="item" /> is found in the <see cref="T:System.Collections.Generic.Queue`1" />; otherwise, false.</returns>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.Queue`1" />. The value can be null for reference types.</param>
// Token: 0x0600004C RID: 76 RVA: 0x00002EE0 File Offset: 0x000010E0
public bool Contains(T item)
{
if (item == null)
{
foreach (T t in this)
{
if (t == null)
{
return true;
}
}
}
else
{
foreach (T t2 in this)
{
if (item.Equals(t2))
{
return true;
}
}
}
return false;
}
/// <summary>Copies the <see cref="T:System.Collections.Generic.Queue`1" /> elements to an existing one-dimensional <see cref="T:System.Array" />, starting at the specified array index.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.Queue`1" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="arrayIndex">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.Queue`1" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x0600004D RID: 77 RVA: 0x00002FCC File Offset: 0x000011CC
public void CopyTo(T[] array, int idx)
{
if (array == null)
{
throw new ArgumentNullException();
}
((ICollection)this).CopyTo(array, idx);
}
/// <summary>Removes and returns the object at the beginning of the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <returns>The object that is removed from the beginning of the <see cref="T:System.Collections.Generic.Queue`1" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Collections.Generic.Queue`1" /> is empty.</exception>
// Token: 0x0600004E RID: 78 RVA: 0x00002FE4 File Offset: 0x000011E4
public T Dequeue()
{
T t = this.Peek();
this._array[this._head] = default(T);
if (++this._head == this._array.Length)
{
this._head = 0;
}
this._size--;
this._version++;
return t;
}
/// <summary>Returns the object at the beginning of the <see cref="T:System.Collections.Generic.Queue`1" /> without removing it.</summary>
/// <returns>The object at the beginning of the <see cref="T:System.Collections.Generic.Queue`1" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Collections.Generic.Queue`1" /> is empty.</exception>
// Token: 0x0600004F RID: 79 RVA: 0x00003054 File Offset: 0x00001254
public T Peek()
{
if (this._size == 0)
{
throw new InvalidOperationException();
}
return this._array[this._head];
}
/// <summary>Adds an object to the end of the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.Queue`1" />. The value can be null for reference types.</param>
// Token: 0x06000050 RID: 80 RVA: 0x00003084 File Offset: 0x00001284
public void Enqueue(T item)
{
if (this._size == this._array.Length || this._tail == this._array.Length)
{
this.SetCapacity(Math.Max(Math.Max(this._size, this._tail) * 2, 4));
}
this._array[this._tail] = item;
if (++this._tail == this._array.Length)
{
this._tail = 0;
}
this._size++;
this._version++;
}
/// <summary>Copies the <see cref="T:System.Collections.Generic.Queue`1" /> elements to a new array.</summary>
/// <returns>A new array containing elements copied from the <see cref="T:System.Collections.Generic.Queue`1" />.</returns>
// Token: 0x06000051 RID: 81 RVA: 0x0000312C File Offset: 0x0000132C
public T[] ToArray()
{
T[] array = new T[this._size];
this.CopyTo(array, 0);
return array;
}
/// <summary>Sets the capacity to the actual number of elements in the <see cref="T:System.Collections.Generic.Queue`1" />, if that number is less than 90 percent of current capacity.</summary>
// Token: 0x06000052 RID: 82 RVA: 0x00003150 File Offset: 0x00001350
public void TrimExcess()
{
if ((double)this._size < (double)this._array.Length * 0.9)
{
this.SetCapacity(this._size);
}
}
// Token: 0x06000053 RID: 83 RVA: 0x00003180 File Offset: 0x00001380
private void SetCapacity(int new_size)
{
if (new_size == this._array.Length)
{
return;
}
if (new_size < this._size)
{
throw new InvalidOperationException("shouldnt happen");
}
T[] array = new T[new_size];
if (this._size > 0)
{
this.CopyTo(array, 0);
}
this._array = array;
this._tail = this._size;
this._head = 0;
this._version++;
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.Queue`1" />.</returns>
// Token: 0x17000012 RID: 18
// (get) Token: 0x06000054 RID: 84 RVA: 0x000031F8 File Offset: 0x000013F8
public int Count
{
get
{
return this._size;
}
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.Queue`1.Enumerator" /> for the <see cref="T:System.Collections.Generic.Queue`1" />.</returns>
// Token: 0x06000055 RID: 85 RVA: 0x00003200 File Offset: 0x00001400
public Queue<T>.Enumerator GetEnumerator()
{
return new Queue<T>.Enumerator(this);
}
// Token: 0x04000033 RID: 51
private T[] _array;
// Token: 0x04000034 RID: 52
private int _head;
// Token: 0x04000035 RID: 53
private int _tail;
// Token: 0x04000036 RID: 54
private int _size;
// Token: 0x04000037 RID: 55
private int _version;
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
// Token: 0x0200000F RID: 15
[Serializable]
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<T>
{
// Token: 0x06000056 RID: 86 RVA: 0x00003208 File Offset: 0x00001408
internal Enumerator(Queue<T> q)
{
this.q = q;
this.idx = -2;
this.ver = q._version;
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x06000057 RID: 87 RVA: 0x00003228 File Offset: 0x00001428
void IEnumerator.Reset()
{
if (this.ver != this.q._version)
{
throw new InvalidOperationException();
}
this.idx = -2;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000013 RID: 19
// (get) Token: 0x06000058 RID: 88 RVA: 0x0000325C File Offset: 0x0000145C
object IEnumerator.Current
{
get
{
return this.Current;
}
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.Queue`1.Enumerator" />.</summary>
// Token: 0x06000059 RID: 89 RVA: 0x0000326C File Offset: 0x0000146C
public void Dispose()
{
this.idx = -2;
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.Queue`1" />.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x0600005A RID: 90 RVA: 0x00003278 File Offset: 0x00001478
public bool MoveNext()
{
if (this.ver != this.q._version)
{
throw new InvalidOperationException();
}
if (this.idx == -2)
{
this.idx = this.q._size;
}
return this.idx != -1 && --this.idx != -1;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.Queue`1" /> at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000014 RID: 20
// (get) Token: 0x0600005B RID: 91 RVA: 0x000032E8 File Offset: 0x000014E8
public T Current
{
get
{
if (this.idx < 0)
{
throw new InvalidOperationException();
}
return this.q._array[(this.q._size - 1 - this.idx + this.q._head) % this.q._array.Length];
}
}
// Token: 0x04000038 RID: 56
private const int NOT_STARTED = -2;
// Token: 0x04000039 RID: 57
private const int FINISHED = -1;
// Token: 0x0400003A RID: 58
private Queue<T> q;
// Token: 0x0400003B RID: 59
private int idx;
// Token: 0x0400003C RID: 60
private int ver;
}
}
}
+723
View File
@@ -0,0 +1,723 @@
using System;
namespace System.Collections.Generic
{
// Token: 0x02000010 RID: 16
internal class RBTree : IEnumerable, IEnumerable<RBTree.Node>
{
// Token: 0x0600005C RID: 92 RVA: 0x00003348 File Offset: 0x00001548
public RBTree(object hlp)
{
this.hlp = hlp;
}
// Token: 0x0600005D RID: 93 RVA: 0x00003358 File Offset: 0x00001558
IEnumerator<RBTree.Node> IEnumerable<RBTree.Node>.GetEnumerator()
{
return this.GetEnumerator();
}
// Token: 0x0600005E RID: 94 RVA: 0x00003368 File Offset: 0x00001568
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
// Token: 0x0600005F RID: 95 RVA: 0x00003378 File Offset: 0x00001578
private static List<RBTree.Node> alloc_path()
{
if (RBTree.cached_path == null)
{
return new List<RBTree.Node>();
}
List<RBTree.Node> list = RBTree.cached_path;
RBTree.cached_path = null;
return list;
}
// Token: 0x06000060 RID: 96 RVA: 0x000033A4 File Offset: 0x000015A4
private static void release_path(List<RBTree.Node> path)
{
if (RBTree.cached_path == null || RBTree.cached_path.Capacity < path.Capacity)
{
path.Clear();
RBTree.cached_path = path;
}
}
// Token: 0x06000061 RID: 97 RVA: 0x000033D4 File Offset: 0x000015D4
public void Clear()
{
this.root = null;
this.version += 1U;
}
// Token: 0x06000062 RID: 98 RVA: 0x000033EC File Offset: 0x000015EC
public RBTree.Node Intern<T>(T key, RBTree.Node new_node)
{
if (this.root == null)
{
if (new_node == null)
{
new_node = ((RBTree.INodeHelper<T>)this.hlp).CreateNode(key);
}
this.root = new_node;
this.root.IsBlack = true;
this.version += 1U;
return this.root;
}
List<RBTree.Node> list = RBTree.alloc_path();
int num = this.find_key<T>(key, list);
RBTree.Node node = list[list.Count - 1];
if (node == null)
{
if (new_node == null)
{
new_node = ((RBTree.INodeHelper<T>)this.hlp).CreateNode(key);
}
node = this.do_insert(num, new_node, list);
}
RBTree.release_path(list);
return node;
}
// Token: 0x06000063 RID: 99 RVA: 0x00003494 File Offset: 0x00001694
public RBTree.Node Remove<T>(T key)
{
if (this.root == null)
{
return null;
}
List<RBTree.Node> list = RBTree.alloc_path();
int num = this.find_key<T>(key, list);
RBTree.Node node = null;
if (num == 0)
{
node = this.do_remove(list);
}
RBTree.release_path(list);
return node;
}
// Token: 0x06000064 RID: 100 RVA: 0x000034D4 File Offset: 0x000016D4
public RBTree.Node Lookup<T>(T key)
{
RBTree.INodeHelper<T> nodeHelper = (RBTree.INodeHelper<T>)this.hlp;
RBTree.Node node;
int num;
for (node = this.root; node != null; node = ((num >= 0) ? node.right : node.left))
{
num = nodeHelper.Compare(key, node);
if (num == 0)
{
break;
}
}
return node;
}
// Token: 0x17000015 RID: 21
// (get) Token: 0x06000065 RID: 101 RVA: 0x00003530 File Offset: 0x00001730
public int Count
{
get
{
return (int)((this.root != null) ? this.root.Size : 0U);
}
}
// Token: 0x17000016 RID: 22
public RBTree.Node this[int index]
{
get
{
if (index < 0 || index >= this.Count)
{
throw new IndexOutOfRangeException("index");
}
RBTree.Node node = this.root;
while (node != null)
{
int num = (int)((node.left != null) ? node.left.Size : 0U);
if (index == num)
{
return node;
}
if (index < num)
{
node = node.left;
}
else
{
index -= num + 1;
node = node.right;
}
}
throw new SystemException("Internal Error: index calculation");
}
}
// Token: 0x06000067 RID: 103 RVA: 0x000035E0 File Offset: 0x000017E0
public RBTree.NodeEnumerator GetEnumerator()
{
return new RBTree.NodeEnumerator(this);
}
// Token: 0x06000068 RID: 104 RVA: 0x000035E8 File Offset: 0x000017E8
private int find_key<T>(T key, List<RBTree.Node> path)
{
RBTree.INodeHelper<T> nodeHelper = (RBTree.INodeHelper<T>)this.hlp;
int num = 0;
RBTree.Node node = this.root;
if (path != null)
{
path.Add(this.root);
}
while (node != null)
{
num = nodeHelper.Compare(key, node);
if (num == 0)
{
return num;
}
RBTree.Node node2;
if (num < 0)
{
node2 = node.right;
node = node.left;
}
else
{
node2 = node.left;
node = node.right;
}
if (path != null)
{
path.Add(node2);
path.Add(node);
}
}
return num;
}
// Token: 0x06000069 RID: 105 RVA: 0x00003678 File Offset: 0x00001878
private RBTree.Node do_insert(int in_tree_cmp, RBTree.Node current, List<RBTree.Node> path)
{
path[path.Count - 1] = current;
RBTree.Node node = path[path.Count - 3];
if (in_tree_cmp < 0)
{
node.left = current;
}
else
{
node.right = current;
}
for (int i = 0; i < path.Count - 2; i += 2)
{
path[i].Size += 1U;
}
if (!node.IsBlack)
{
this.rebalance_insert(path);
}
if (!this.root.IsBlack)
{
throw new SystemException("Internal error: root is not black");
}
this.version += 1U;
return current;
}
// Token: 0x0600006A RID: 106 RVA: 0x00003728 File Offset: 0x00001928
private RBTree.Node do_remove(List<RBTree.Node> path)
{
int num = path.Count - 1;
RBTree.Node node = path[num];
if (node.left != null)
{
RBTree.Node node2 = RBTree.right_most(node.left, node.right, path);
node.SwapValue(node2);
if (node2.left != null)
{
RBTree.Node left = node2.left;
path.Add(null);
path.Add(left);
node2.SwapValue(left);
}
}
else if (node.right != null)
{
RBTree.Node right = node.right;
path.Add(null);
path.Add(right);
node.SwapValue(right);
}
num = path.Count - 1;
node = path[num];
if (node.Size != 1U)
{
throw new SystemException("Internal Error: red-black violation somewhere");
}
path[num] = null;
this.node_reparent((num != 0) ? path[num - 2] : null, node, 0U, null);
for (int i = 0; i < path.Count - 2; i += 2)
{
path[i].Size -= 1U;
}
if (num != 0 && node.IsBlack)
{
this.rebalance_delete(path);
}
if (this.root != null && !this.root.IsBlack)
{
throw new SystemException("Internal Error: root is not black");
}
this.version += 1U;
return node;
}
// Token: 0x0600006B RID: 107 RVA: 0x00003890 File Offset: 0x00001A90
private void rebalance_insert(List<RBTree.Node> path)
{
int num = path.Count - 1;
while (path[num - 3] != null && !path[num - 3].IsBlack)
{
RBTree.Node node = path[num - 2];
bool flag = true;
path[num - 3].IsBlack = flag;
node.IsBlack = flag;
num -= 4;
if (num == 0)
{
return;
}
path[num].IsBlack = false;
if (path[num - 2].IsBlack)
{
return;
}
}
this.rebalance_insert__rotate_final(num, path);
}
// Token: 0x0600006C RID: 108 RVA: 0x0000391C File Offset: 0x00001B1C
private void rebalance_delete(List<RBTree.Node> path)
{
int num = path.Count - 1;
for (;;)
{
RBTree.Node node = path[num - 1];
if (!node.IsBlack)
{
num = this.ensure_sibling_black(num, path);
node = path[num - 1];
}
if ((node.left != null && !node.left.IsBlack) || (node.right != null && !node.right.IsBlack))
{
break;
}
node.IsBlack = false;
num -= 2;
if (num == 0)
{
return;
}
if (!path[num].IsBlack)
{
goto Block_5;
}
}
this.rebalance_delete__rotate_final(num, path);
return;
Block_5:
path[num].IsBlack = true;
}
// Token: 0x0600006D RID: 109 RVA: 0x000039CC File Offset: 0x00001BCC
private void rebalance_insert__rotate_final(int curpos, List<RBTree.Node> path)
{
RBTree.Node node = path[curpos];
RBTree.Node node2 = path[curpos - 2];
RBTree.Node node3 = path[curpos - 4];
uint size = node3.Size;
bool flag = node2 == node3.left;
bool flag2 = node == node2.left;
RBTree.Node node4;
if (flag && flag2)
{
node3.left = node2.right;
node2.right = node3;
node4 = node2;
}
else if (flag && !flag2)
{
node3.left = node.right;
node.right = node3;
node2.right = node.left;
node.left = node2;
node4 = node;
}
else if (!flag && flag2)
{
node3.right = node.left;
node.left = node3;
node2.left = node.right;
node.right = node2;
node4 = node;
}
else
{
node3.right = node2.left;
node2.left = node3;
node4 = node2;
}
node3.FixSize();
node3.IsBlack = false;
if (node4 != node2)
{
node2.FixSize();
}
node4.IsBlack = true;
this.node_reparent((curpos != 4) ? path[curpos - 6] : null, node3, size, node4);
}
// Token: 0x0600006E RID: 110 RVA: 0x00003B10 File Offset: 0x00001D10
private void rebalance_delete__rotate_final(int curpos, List<RBTree.Node> path)
{
RBTree.Node node = path[curpos - 1];
RBTree.Node node2 = path[curpos - 2];
uint size = node2.Size;
bool isBlack = node2.IsBlack;
RBTree.Node node3;
if (node2.right == node)
{
if (node.right == null || node.right.IsBlack)
{
RBTree.Node left = node.left;
node2.right = left.left;
left.left = node2;
node.left = left.right;
left.right = node;
node3 = left;
}
else
{
node2.right = node.left;
node.left = node2;
node.right.IsBlack = true;
node3 = node;
}
}
else if (node.left == null || node.left.IsBlack)
{
RBTree.Node right = node.right;
node2.left = right.right;
right.right = node2;
node.right = right.left;
right.left = node;
node3 = right;
}
else
{
node2.left = node.right;
node.right = node2;
node.left.IsBlack = true;
node3 = node;
}
node2.FixSize();
node2.IsBlack = true;
if (node3 != node)
{
node.FixSize();
}
node3.IsBlack = isBlack;
this.node_reparent((curpos != 2) ? path[curpos - 4] : null, node2, size, node3);
}
// Token: 0x0600006F RID: 111 RVA: 0x00003C88 File Offset: 0x00001E88
private int ensure_sibling_black(int curpos, List<RBTree.Node> path)
{
RBTree.Node node = path[curpos];
RBTree.Node node2 = path[curpos - 1];
RBTree.Node node3 = path[curpos - 2];
uint size = node3.Size;
bool flag;
if (node3.right == node2)
{
node3.right = node2.left;
node2.left = node3;
flag = true;
}
else
{
node3.left = node2.right;
node2.right = node3;
flag = false;
}
node3.FixSize();
node3.IsBlack = false;
node2.IsBlack = true;
this.node_reparent((curpos != 2) ? path[curpos - 4] : null, node3, size, node2);
if (curpos + 1 == path.Count)
{
path.Add(null);
path.Add(null);
}
path[curpos - 2] = node2;
path[curpos - 1] = ((!flag) ? node2.left : node2.right);
path[curpos] = node3;
path[curpos + 1] = ((!flag) ? node3.left : node3.right);
path[curpos + 2] = node;
return curpos + 2;
}
// Token: 0x06000070 RID: 112 RVA: 0x00003DA4 File Offset: 0x00001FA4
private void node_reparent(RBTree.Node orig_parent, RBTree.Node orig, uint orig_size, RBTree.Node updated)
{
if (updated != null && updated.FixSize() != orig_size)
{
throw new SystemException("Internal error: rotation");
}
if (orig == this.root)
{
this.root = updated;
}
else if (orig == orig_parent.left)
{
orig_parent.left = updated;
}
else
{
if (orig != orig_parent.right)
{
throw new SystemException("Internal error: path error");
}
orig_parent.right = updated;
}
}
// Token: 0x06000071 RID: 113 RVA: 0x00003E28 File Offset: 0x00002028
private static RBTree.Node right_most(RBTree.Node current, RBTree.Node sibling, List<RBTree.Node> path)
{
for (;;)
{
path.Add(sibling);
path.Add(current);
if (current.right == null)
{
break;
}
sibling = current.left;
current = current.right;
}
return current;
}
// Token: 0x0400003D RID: 61
private RBTree.Node root;
// Token: 0x0400003E RID: 62
private object hlp;
// Token: 0x0400003F RID: 63
private uint version;
// Token: 0x04000040 RID: 64
[ThreadStatic]
private static List<RBTree.Node> cached_path;
// Token: 0x02000011 RID: 17
public interface INodeHelper<T>
{
// Token: 0x06000072 RID: 114
int Compare(T key, RBTree.Node node);
// Token: 0x06000073 RID: 115
RBTree.Node CreateNode(T key);
}
// Token: 0x02000012 RID: 18
public abstract class Node
{
// Token: 0x06000074 RID: 116 RVA: 0x00003E6C File Offset: 0x0000206C
public Node()
{
this.size_black = 2U;
}
// Token: 0x17000017 RID: 23
// (get) Token: 0x06000075 RID: 117 RVA: 0x00003E7C File Offset: 0x0000207C
// (set) Token: 0x06000076 RID: 118 RVA: 0x00003E8C File Offset: 0x0000208C
public bool IsBlack
{
get
{
return (this.size_black & 1U) == 1U;
}
set
{
this.size_black = ((!value) ? (this.size_black & 4294967294U) : (this.size_black | 1U));
}
}
// Token: 0x17000018 RID: 24
// (get) Token: 0x06000077 RID: 119 RVA: 0x00003EBC File Offset: 0x000020BC
// (set) Token: 0x06000078 RID: 120 RVA: 0x00003EC8 File Offset: 0x000020C8
public uint Size
{
get
{
return this.size_black >> 1;
}
set
{
this.size_black = (value << 1) | (this.size_black & 1U);
}
}
// Token: 0x06000079 RID: 121 RVA: 0x00003EDC File Offset: 0x000020DC
public uint FixSize()
{
this.Size = 1U;
if (this.left != null)
{
this.Size += this.left.Size;
}
if (this.right != null)
{
this.Size += this.right.Size;
}
return this.Size;
}
// Token: 0x0600007A RID: 122
public abstract void SwapValue(RBTree.Node other);
// Token: 0x04000041 RID: 65
private const uint black_mask = 1U;
// Token: 0x04000042 RID: 66
private const int black_shift = 1;
// Token: 0x04000043 RID: 67
public RBTree.Node left;
// Token: 0x04000044 RID: 68
public RBTree.Node right;
// Token: 0x04000045 RID: 69
private uint size_black;
}
// Token: 0x02000013 RID: 19
public struct NodeEnumerator : IEnumerator, IDisposable, IEnumerator<RBTree.Node>
{
// Token: 0x0600007B RID: 123 RVA: 0x00003F3C File Offset: 0x0000213C
internal NodeEnumerator(RBTree tree)
{
this.tree = tree;
this.version = tree.version;
this.pennants = null;
}
// Token: 0x17000019 RID: 25
// (get) Token: 0x0600007C RID: 124 RVA: 0x00003F58 File Offset: 0x00002158
object IEnumerator.Current
{
get
{
this.check_current();
return this.Current;
}
}
// Token: 0x0600007D RID: 125 RVA: 0x00003F68 File Offset: 0x00002168
public void Reset()
{
this.check_version();
this.pennants = null;
}
// Token: 0x1700001A RID: 26
// (get) Token: 0x0600007E RID: 126 RVA: 0x00003F78 File Offset: 0x00002178
public RBTree.Node Current
{
get
{
return this.pennants.Peek();
}
}
// Token: 0x0600007F RID: 127 RVA: 0x00003F88 File Offset: 0x00002188
public bool MoveNext()
{
this.check_version();
RBTree.Node node;
if (this.pennants == null)
{
if (this.tree.root == null)
{
return false;
}
this.pennants = new Stack<RBTree.Node>();
node = this.tree.root;
}
else
{
if (this.pennants.Count == 0)
{
return false;
}
RBTree.Node node2 = this.pennants.Pop();
node = node2.right;
}
while (node != null)
{
this.pennants.Push(node);
node = node.left;
}
return this.pennants.Count != 0;
}
// Token: 0x06000080 RID: 128 RVA: 0x00004028 File Offset: 0x00002228
public void Dispose()
{
this.tree = null;
this.pennants = null;
}
// Token: 0x06000081 RID: 129 RVA: 0x00004038 File Offset: 0x00002238
private void check_version()
{
if (this.tree == null)
{
throw new ObjectDisposedException("enumerator");
}
if (this.version != this.tree.version)
{
throw new InvalidOperationException("tree modified");
}
}
// Token: 0x06000082 RID: 130 RVA: 0x00004074 File Offset: 0x00002274
internal void check_current()
{
this.check_version();
if (this.pennants == null)
{
throw new InvalidOperationException("state invalid before the first MoveNext()");
}
}
// Token: 0x04000046 RID: 70
private RBTree tree;
// Token: 0x04000047 RID: 71
private uint version;
// Token: 0x04000048 RID: 72
private Stack<RBTree.Node> pennants;
}
}
}
@@ -0,0 +1,1234 @@
using System;
namespace System.Collections.Generic
{
/// <summary>Represents a collection of key/value pairs that are sorted on the key.</summary>
/// <typeparam name="TKey">The type of the keys in the dictionary.</typeparam>
/// <typeparam name="TValue">The type of the values in the dictionary.</typeparam>
/// <filterpriority>1</filterpriority>
// Token: 0x02000014 RID: 20
[Serializable]
public class SortedDictionary<TKey, TValue> : ICollection, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, IEnumerable, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that is empty and uses the default <see cref="T:System.Collections.Generic.IComparer`1" /> implementation for the key type.</summary>
// Token: 0x06000083 RID: 131 RVA: 0x00004094 File Offset: 0x00002294
public SortedDictionary()
: this(null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that is empty and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to compare keys.</summary>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys, or null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
// Token: 0x06000084 RID: 132 RVA: 0x000040A0 File Offset: 0x000022A0
public SortedDictionary(IComparer<TKey> comparer)
{
this.hlp = SortedDictionary<TKey, TValue>.NodeHelper.GetHelper(comparer);
this.tree = new RBTree(this.hlp);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" /> and uses the default <see cref="T:System.Collections.Generic.IComparer`1" /> implementation for the key type.</summary>
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
// Token: 0x06000085 RID: 133 RVA: 0x000040C8 File Offset: 0x000022C8
public SortedDictionary(IDictionary<TKey, TValue> dic)
: this(dic, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" /> and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to compare keys.</summary>
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys, or null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
// Token: 0x06000086 RID: 134 RVA: 0x000040D4 File Offset: 0x000022D4
public SortedDictionary(IDictionary<TKey, TValue> dic, IComparer<TKey> comparer)
: this(comparer)
{
if (dic == null)
{
throw new ArgumentNullException();
}
foreach (KeyValuePair<TKey, TValue> keyValuePair in dic)
{
this.Add(keyValuePair.Key, keyValuePair.Value);
}
}
// Token: 0x1700001B RID: 27
// (get) Token: 0x06000087 RID: 135 RVA: 0x00004154 File Offset: 0x00002354
ICollection<TKey> IDictionary<TKey, TValue>.Keys
{
get
{
return new SortedDictionary<TKey, TValue>.KeyCollection(this);
}
}
// Token: 0x1700001C RID: 28
// (get) Token: 0x06000088 RID: 136 RVA: 0x0000415C File Offset: 0x0000235C
ICollection<TValue> IDictionary<TKey, TValue>.Values
{
get
{
return new SortedDictionary<TKey, TValue>.ValueCollection(this);
}
}
// Token: 0x06000089 RID: 137 RVA: 0x00004164 File Offset: 0x00002364
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
{
this.Add(item.Key, item.Value);
}
// Token: 0x0600008A RID: 138 RVA: 0x0000417C File Offset: 0x0000237C
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
{
TValue tvalue;
return this.TryGetValue(item.Key, out tvalue) && EqualityComparer<TValue>.Default.Equals(item.Value, tvalue);
}
// Token: 0x1700001D RID: 29
// (get) Token: 0x0600008B RID: 139 RVA: 0x000041B4 File Offset: 0x000023B4
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
{
get
{
return false;
}
}
// Token: 0x0600008C RID: 140 RVA: 0x000041B8 File Offset: 0x000023B8
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
{
TValue tvalue;
return this.TryGetValue(item.Key, out tvalue) && EqualityComparer<TValue>.Default.Equals(item.Value, tvalue) && this.Remove(item.Key);
}
/// <summary>Adds an element with the provided key and value to the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <param name="key">The object to use as the key of the element to add.</param>
/// <param name="value">The object to use as the value of the element to add.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.IDictionary" />.-or-<paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.IDictionary" />.-or-An element with the same key already exists in the <see cref="T:System.Collections.IDictionary" />.</exception>
// Token: 0x0600008D RID: 141 RVA: 0x00004200 File Offset: 0x00002400
void IDictionary.Add(object key, object value)
{
this.Add(this.ToKey(key), this.ToValue(value));
}
/// <summary>Determines whether the <see cref="T:System.Collections.IDictionary" /> contains an element with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> contains an element with the key; otherwise, false.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x0600008E RID: 142 RVA: 0x00004218 File Offset: 0x00002418
bool IDictionary.Contains(object key)
{
return this.ContainsKey(this.ToKey(key));
}
/// <summary>Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</returns>
// Token: 0x0600008F RID: 143 RVA: 0x00004228 File Offset: 0x00002428
IDictionaryEnumerator IDictionary.GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.Enumerator(this);
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> has a fixed size.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> has a fixed size; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2" />, this property always returns false.</returns>
// Token: 0x1700001E RID: 30
// (get) Token: 0x06000090 RID: 144 RVA: 0x00004238 File Offset: 0x00002438
bool IDictionary.IsFixedSize
{
get
{
return false;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> is read-only.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> is read-only; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2" />, this property always returns false.</returns>
// Token: 0x1700001F RID: 31
// (get) Token: 0x06000091 RID: 145 RVA: 0x0000423C File Offset: 0x0000243C
bool IDictionary.IsReadOnly
{
get
{
return false;
}
}
/// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <returns>An <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</returns>
// Token: 0x17000020 RID: 32
// (get) Token: 0x06000092 RID: 146 RVA: 0x00004240 File Offset: 0x00002440
ICollection IDictionary.Keys
{
get
{
return new SortedDictionary<TKey, TValue>.KeyCollection(this);
}
}
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <param name="key">The key of the element to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x06000093 RID: 147 RVA: 0x00004248 File Offset: 0x00002448
void IDictionary.Remove(object key)
{
this.Remove(this.ToKey(key));
}
/// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <returns>An <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</returns>
// Token: 0x17000021 RID: 33
// (get) Token: 0x06000094 RID: 148 RVA: 0x00004258 File Offset: 0x00002458
ICollection IDictionary.Values
{
get
{
return new SortedDictionary<TKey, TValue>.ValueCollection(this);
}
}
/// <summary>Gets or sets the element with the specified key.</summary>
/// <returns>The element with the specified key, or null if <paramref name="key" /> is not in the dictionary or <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
/// <param name="key">The key of the element to get.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">A value is being assigned, and <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.-or-A value is being assigned, and <paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</exception>
// Token: 0x17000022 RID: 34
object IDictionary.this[object key]
{
get
{
return this[this.ToKey(key)];
}
set
{
this[this.ToKey(key)] = this.ToValue(value);
}
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1" /> to an array, starting at the specified array index.</summary>
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.ICollection`1" />. The array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.Generic.ICollection`1" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// Token: 0x06000097 RID: 151 RVA: 0x0000428C File Offset: 0x0000248C
void ICollection.CopyTo(Array array, int index)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (index < 0 || array.Length <= index)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - index < this.Count)
{
throw new ArgumentException();
}
foreach (RBTree.Node node in this.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
array.SetValue(node2.AsDE(), index++);
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2" />, this property always returns false.</returns>
// Token: 0x17000023 RID: 35
// (get) Token: 0x06000098 RID: 152 RVA: 0x00004354 File Offset: 0x00002554
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. </returns>
// Token: 0x17000024 RID: 36
// (get) Token: 0x06000099 RID: 153 RVA: 0x00004358 File Offset: 0x00002558
object ICollection.SyncRoot
{
get
{
return this;
}
}
/// <summary>Returns an enumerator that iterates through the collection.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.</returns>
// Token: 0x0600009A RID: 154 RVA: 0x0000435C File Offset: 0x0000255C
IEnumerator IEnumerable.GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.Enumerator(this);
}
// Token: 0x0600009B RID: 155 RVA: 0x0000436C File Offset: 0x0000256C
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.Enumerator(this);
}
/// <summary>Gets the <see cref="T:System.Collections.Generic.IComparer`1" /> used to order the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>The <see cref="T:System.Collections.Generic.IComparer`1" /> used to order the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /></returns>
// Token: 0x17000025 RID: 37
// (get) Token: 0x0600009C RID: 156 RVA: 0x0000437C File Offset: 0x0000257C
public IComparer<TKey> Comparer
{
get
{
return this.hlp.cmp;
}
}
/// <summary>Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>The number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
// Token: 0x17000026 RID: 38
// (get) Token: 0x0600009D RID: 157 RVA: 0x0000438C File Offset: 0x0000258C
public int Count
{
get
{
return this.tree.Count;
}
}
/// <summary>Gets or sets the value associated with the specified key.</summary>
/// <returns>The value associated with the specified key. If the specified key is not found, a get operation throws a <see cref="T:System.Collections.Generic.KeyNotFoundException" />, and a set operation creates a new element with the specified key.</returns>
/// <param name="key">The key of the value to get or set.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key" /> does not exist in the collection.</exception>
// Token: 0x17000027 RID: 39
public TValue this[TKey key]
{
get
{
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)this.tree.Lookup<TKey>(key);
if (node == null)
{
throw new KeyNotFoundException();
}
return node.value;
}
set
{
if (key == null)
{
throw new ArgumentNullException("key");
}
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)this.tree.Intern<TKey>(key, null);
node.value = value;
}
}
/// <summary>Gets a collection containing the keys in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> containing the keys in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
// Token: 0x17000028 RID: 40
// (get) Token: 0x060000A0 RID: 160 RVA: 0x00004410 File Offset: 0x00002610
public SortedDictionary<TKey, TValue>.KeyCollection Keys
{
get
{
return new SortedDictionary<TKey, TValue>.KeyCollection(this);
}
}
/// <summary>Gets a collection containing the values in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> containing the values in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
// Token: 0x17000029 RID: 41
// (get) Token: 0x060000A1 RID: 161 RVA: 0x00004418 File Offset: 0x00002618
public SortedDictionary<TKey, TValue>.ValueCollection Values
{
get
{
return new SortedDictionary<TKey, TValue>.ValueCollection(this);
}
}
/// <summary>Adds an element with the specified key and value into the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <param name="key">The key of the element to add.</param>
/// <param name="value">The value of the element to add. The value can be null for reference types.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</exception>
// Token: 0x060000A2 RID: 162 RVA: 0x00004420 File Offset: 0x00002620
public void Add(TKey key, TValue value)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
RBTree.Node node = new SortedDictionary<TKey, TValue>.Node(key, value);
if (this.tree.Intern<TKey>(key, node) != node)
{
throw new ArgumentException("key already present in dictionary", "key");
}
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
// Token: 0x060000A3 RID: 163 RVA: 0x00004470 File Offset: 0x00002670
public void Clear()
{
this.tree.Clear();
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key; otherwise, false.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x060000A4 RID: 164 RVA: 0x00004480 File Offset: 0x00002680
public bool ContainsKey(TKey key)
{
return this.tree.Lookup<TKey>(key) != null;
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified value.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified value; otherwise, false.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />. The value can be null for reference types.</param>
// Token: 0x060000A5 RID: 165 RVA: 0x00004494 File Offset: 0x00002694
public bool ContainsValue(TValue value)
{
IEqualityComparer<TValue> @default = EqualityComparer<TValue>.Default;
foreach (RBTree.Node node in this.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
if (@default.Equals(value, node2.value))
{
return true;
}
}
return false;
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> to the specified array of <see cref="T:System.Collections.Generic.KeyValuePair`2" /> structures, starting at the specified index.</summary>
/// <param name="array">The one-dimensional array of <see cref="T:System.Collections.Generic.KeyValuePair`2" /> structures that is the destination of the elements copied from the current <see cref="T:System.Collections.Generic.SortedDictionary`2" /> The array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.SortedDictionary`2" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x060000A6 RID: 166 RVA: 0x0000451C File Offset: 0x0000271C
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (arrayIndex < 0 || array.Length <= arrayIndex)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - arrayIndex < this.Count)
{
throw new ArgumentException();
}
foreach (RBTree.Node node in this.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
array[arrayIndex++] = node2.AsKV();
}
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.Enumerator" /> for the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
// Token: 0x060000A7 RID: 167 RVA: 0x000045DC File Offset: 0x000027DC
public SortedDictionary<TKey, TValue>.Enumerator GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.Enumerator(this);
}
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key" /> is not found in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
/// <param name="key">The key of the element to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x060000A8 RID: 168 RVA: 0x000045E4 File Offset: 0x000027E4
public bool Remove(TKey key)
{
return this.tree.Remove<TKey>(key) != null;
}
/// <summary>Gets the value associated with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key; otherwise, false.</returns>
/// <param name="key">The key of the value to get.</param>
/// <param name="value">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 <paramref name="value" /> parameter. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// Token: 0x060000A9 RID: 169 RVA: 0x000045F8 File Offset: 0x000027F8
public bool TryGetValue(TKey key, out TValue value)
{
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)this.tree.Lookup<TKey>(key);
value = ((node != null) ? node.value : default(TValue));
return node != null;
}
// Token: 0x060000AA RID: 170 RVA: 0x00004640 File Offset: 0x00002840
private TKey ToKey(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
if (!(key is TKey))
{
throw new ArgumentException(string.Format("Key \"{0}\" cannot be converted to the key type {1}.", key, typeof(TKey)));
}
return (TKey)((object)key);
}
// Token: 0x060000AB RID: 171 RVA: 0x00004680 File Offset: 0x00002880
private TValue ToValue(object value)
{
if (!(value is TValue) && (value != null || typeof(TValue).IsValueType))
{
throw new ArgumentException(string.Format("Value \"{0}\" cannot be converted to the value type {1}.", value, typeof(TValue)));
}
return (TValue)((object)value);
}
// Token: 0x04000049 RID: 73
private RBTree tree;
// Token: 0x0400004A RID: 74
private SortedDictionary<TKey, TValue>.NodeHelper hlp;
// Token: 0x02000015 RID: 21
private class Node : RBTree.Node
{
// Token: 0x060000AC RID: 172 RVA: 0x000046D4 File Offset: 0x000028D4
public Node(TKey key)
{
this.key = key;
}
// Token: 0x060000AD RID: 173 RVA: 0x000046E4 File Offset: 0x000028E4
public Node(TKey key, TValue value)
{
this.key = key;
this.value = value;
}
// Token: 0x060000AE RID: 174 RVA: 0x000046FC File Offset: 0x000028FC
public override void SwapValue(RBTree.Node other)
{
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)other;
TKey tkey = this.key;
this.key = node.key;
node.key = tkey;
TValue tvalue = this.value;
this.value = node.value;
node.value = tvalue;
}
// Token: 0x060000AF RID: 175 RVA: 0x00004744 File Offset: 0x00002944
public KeyValuePair<TKey, TValue> AsKV()
{
return new KeyValuePair<TKey, TValue>(this.key, this.value);
}
// Token: 0x060000B0 RID: 176 RVA: 0x00004758 File Offset: 0x00002958
public DictionaryEntry AsDE()
{
return new DictionaryEntry(this.key, this.value);
}
// Token: 0x0400004B RID: 75
public TKey key;
// Token: 0x0400004C RID: 76
public TValue value;
}
// Token: 0x02000016 RID: 22
private class NodeHelper : RBTree.INodeHelper<TKey>
{
// Token: 0x060000B1 RID: 177 RVA: 0x00004778 File Offset: 0x00002978
private NodeHelper(IComparer<TKey> cmp)
{
this.cmp = cmp;
}
// Token: 0x060000B3 RID: 179 RVA: 0x0000479C File Offset: 0x0000299C
public int Compare(TKey key, RBTree.Node node)
{
return this.cmp.Compare(key, ((SortedDictionary<TKey, TValue>.Node)node).key);
}
// Token: 0x060000B4 RID: 180 RVA: 0x000047B8 File Offset: 0x000029B8
public RBTree.Node CreateNode(TKey key)
{
return new SortedDictionary<TKey, TValue>.Node(key);
}
// Token: 0x060000B5 RID: 181 RVA: 0x000047C0 File Offset: 0x000029C0
public static SortedDictionary<TKey, TValue>.NodeHelper GetHelper(IComparer<TKey> cmp)
{
if (cmp == null || cmp == Comparer<TKey>.Default)
{
return SortedDictionary<TKey, TValue>.NodeHelper.Default;
}
return new SortedDictionary<TKey, TValue>.NodeHelper(cmp);
}
// Token: 0x0400004D RID: 77
public IComparer<TKey> cmp;
// Token: 0x0400004E RID: 78
private static SortedDictionary<TKey, TValue>.NodeHelper Default = new SortedDictionary<TKey, TValue>.NodeHelper(Comparer<TKey>.Default);
}
/// <summary>Represents the collection of values in a <see cref="T:System.Collections.Generic.SortedDictionary`2" />. This class cannot be inherited.</summary>
// Token: 0x02000017 RID: 23
[Serializable]
public sealed class ValueCollection : ICollection, IEnumerable, ICollection<TValue>, IEnumerable<TValue>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> class that reflects the values in the specified <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.SortedDictionary`2" /> whose values are reflected in the new <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
// Token: 0x060000B6 RID: 182 RVA: 0x000047E0 File Offset: 0x000029E0
public ValueCollection(SortedDictionary<TKey, TValue> dic)
{
this._dic = dic;
}
// Token: 0x060000B7 RID: 183 RVA: 0x000047F0 File Offset: 0x000029F0
void ICollection<TValue>.Add(TValue item)
{
throw new NotSupportedException();
}
// Token: 0x060000B8 RID: 184 RVA: 0x000047F8 File Offset: 0x000029F8
void ICollection<TValue>.Clear()
{
throw new NotSupportedException();
}
// Token: 0x060000B9 RID: 185 RVA: 0x00004800 File Offset: 0x00002A00
bool ICollection<TValue>.Contains(TValue item)
{
return this._dic.ContainsValue(item);
}
// Token: 0x1700002A RID: 42
// (get) Token: 0x060000BA RID: 186 RVA: 0x00004810 File Offset: 0x00002A10
bool ICollection<TValue>.IsReadOnly
{
get
{
return true;
}
}
// Token: 0x060000BB RID: 187 RVA: 0x00004814 File Offset: 0x00002A14
bool ICollection<TValue>.Remove(TValue item)
{
throw new NotSupportedException();
}
// Token: 0x060000BC RID: 188 RVA: 0x0000481C File Offset: 0x00002A1C
IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an array, starting at a particular array index.</summary>
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.ICollection" />. The array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// Token: 0x060000BD RID: 189 RVA: 0x0000482C File Offset: 0x00002A2C
void ICollection.CopyTo(Array array, int index)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (index < 0 || array.Length <= index)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - index < this.Count)
{
throw new ArgumentException();
}
foreach (RBTree.Node node in this._dic.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
array.SetValue(node2.value, index++);
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />, this property always returns false.</returns>
// Token: 0x1700002B RID: 43
// (get) Token: 0x060000BE RID: 190 RVA: 0x000048F8 File Offset: 0x00002AF8
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />, this property always returns the current instance.</returns>
// Token: 0x1700002C RID: 44
// (get) Token: 0x060000BF RID: 191 RVA: 0x000048FC File Offset: 0x00002AFC
object ICollection.SyncRoot
{
get
{
return this._dic;
}
}
/// <summary>Returns an enumerator that iterates through the collection.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
// Token: 0x060000C0 RID: 192 RVA: 0x00004904 File Offset: 0x00002B04
IEnumerator IEnumerable.GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.ValueCollection.Enumerator(this._dic);
}
/// <summary>Copies the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> elements to an existing one-dimensional array, starting at the specified array index.</summary>
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />. The array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x060000C1 RID: 193 RVA: 0x00004918 File Offset: 0x00002B18
public void CopyTo(TValue[] array, int arrayIndex)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (arrayIndex < 0 || array.Length <= arrayIndex)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - arrayIndex < this.Count)
{
throw new ArgumentException();
}
foreach (RBTree.Node node in this._dic.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
array[arrayIndex++] = node2.value;
}
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</returns>
// Token: 0x1700002D RID: 45
// (get) Token: 0x060000C2 RID: 194 RVA: 0x000049D8 File Offset: 0x00002BD8
public int Count
{
get
{
return this._dic.Count;
}
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection.Enumerator" /> structure for the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</returns>
// Token: 0x060000C3 RID: 195 RVA: 0x000049E8 File Offset: 0x00002BE8
public SortedDictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.ValueCollection.Enumerator(this._dic);
}
// Token: 0x0400004F RID: 79
private SortedDictionary<TKey, TValue> _dic;
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
// Token: 0x02000018 RID: 24
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<TValue>
{
// Token: 0x060000C4 RID: 196 RVA: 0x000049F8 File Offset: 0x00002BF8
internal Enumerator(SortedDictionary<TKey, TValue> dic)
{
this.host = dic.tree.GetEnumerator();
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x1700002E RID: 46
// (get) Token: 0x060000C5 RID: 197 RVA: 0x00004A0C File Offset: 0x00002C0C
object IEnumerator.Current
{
get
{
this.host.check_current();
return this.current;
}
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x060000C6 RID: 198 RVA: 0x00004A24 File Offset: 0x00002C24
void IEnumerator.Reset()
{
this.host.Reset();
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> at the current position of the enumerator.</returns>
// Token: 0x1700002F RID: 47
// (get) Token: 0x060000C7 RID: 199 RVA: 0x00004A34 File Offset: 0x00002C34
public TValue Current
{
get
{
return this.current;
}
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x060000C8 RID: 200 RVA: 0x00004A3C File Offset: 0x00002C3C
public bool MoveNext()
{
if (!this.host.MoveNext())
{
return false;
}
this.current = ((SortedDictionary<TKey, TValue>.Node)this.host.Current).value;
return true;
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection.Enumerator" />.</summary>
// Token: 0x060000C9 RID: 201 RVA: 0x00004A78 File Offset: 0x00002C78
public void Dispose()
{
this.host.Dispose();
}
// Token: 0x04000050 RID: 80
private RBTree.NodeEnumerator host;
// Token: 0x04000051 RID: 81
private TValue current;
}
}
/// <summary>Represents the collection of keys in a <see cref="T:System.Collections.Generic.SortedDictionary`2" />. This class cannot be inherited. </summary>
// Token: 0x02000019 RID: 25
[Serializable]
public sealed class KeyCollection : ICollection, IEnumerable, ICollection<TKey>, IEnumerable<TKey>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> class that reflects the keys in the specified <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.SortedDictionary`2" /> whose keys are reflected in the new <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
// Token: 0x060000CA RID: 202 RVA: 0x00004A88 File Offset: 0x00002C88
public KeyCollection(SortedDictionary<TKey, TValue> dic)
{
this._dic = dic;
}
// Token: 0x060000CB RID: 203 RVA: 0x00004A98 File Offset: 0x00002C98
void ICollection<TKey>.Add(TKey item)
{
throw new NotSupportedException();
}
// Token: 0x060000CC RID: 204 RVA: 0x00004AA0 File Offset: 0x00002CA0
void ICollection<TKey>.Clear()
{
throw new NotSupportedException();
}
// Token: 0x060000CD RID: 205 RVA: 0x00004AA8 File Offset: 0x00002CA8
bool ICollection<TKey>.Contains(TKey item)
{
return this._dic.ContainsKey(item);
}
// Token: 0x060000CE RID: 206 RVA: 0x00004AB8 File Offset: 0x00002CB8
IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator()
{
return this.GetEnumerator();
}
// Token: 0x17000030 RID: 48
// (get) Token: 0x060000CF RID: 207 RVA: 0x00004AC8 File Offset: 0x00002CC8
bool ICollection<TKey>.IsReadOnly
{
get
{
return true;
}
}
// Token: 0x060000D0 RID: 208 RVA: 0x00004ACC File Offset: 0x00002CCC
bool ICollection<TKey>.Remove(TKey item)
{
throw new NotSupportedException();
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an array, starting at a particular array index.</summary>
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.ICollection" />. The array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// Token: 0x060000D1 RID: 209 RVA: 0x00004AD4 File Offset: 0x00002CD4
void ICollection.CopyTo(Array array, int index)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (index < 0 || array.Length <= index)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - index < this.Count)
{
throw new ArgumentException();
}
foreach (RBTree.Node node in this._dic.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
array.SetValue(node2.key, index++);
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />, this property always returns false.</returns>
// Token: 0x17000031 RID: 49
// (get) Token: 0x060000D2 RID: 210 RVA: 0x00004BA0 File Offset: 0x00002DA0
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />, this property always returns the current instance.</returns>
// Token: 0x17000032 RID: 50
// (get) Token: 0x060000D3 RID: 211 RVA: 0x00004BA4 File Offset: 0x00002DA4
object ICollection.SyncRoot
{
get
{
return this._dic;
}
}
/// <summary>Returns an enumerator that iterates through the collection.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
// Token: 0x060000D4 RID: 212 RVA: 0x00004BAC File Offset: 0x00002DAC
IEnumerator IEnumerable.GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.KeyCollection.Enumerator(this._dic);
}
/// <summary>Copies the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> elements to an existing one-dimensional array, starting at the specified array index.</summary>
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />. The array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x060000D5 RID: 213 RVA: 0x00004BC0 File Offset: 0x00002DC0
public void CopyTo(TKey[] array, int arrayIndex)
{
if (this.Count == 0)
{
return;
}
if (array == null)
{
throw new ArgumentNullException();
}
if (arrayIndex < 0 || array.Length <= arrayIndex)
{
throw new ArgumentOutOfRangeException();
}
if (array.Length - arrayIndex < this.Count)
{
throw new ArgumentException();
}
foreach (RBTree.Node node in this._dic.tree)
{
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
array[arrayIndex++] = node2.key;
}
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</returns>
// Token: 0x17000033 RID: 51
// (get) Token: 0x060000D6 RID: 214 RVA: 0x00004C80 File Offset: 0x00002E80
public int Count
{
get
{
return this._dic.Count;
}
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection.Enumerator" /> structure for the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</returns>
// Token: 0x060000D7 RID: 215 RVA: 0x00004C90 File Offset: 0x00002E90
public SortedDictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator()
{
return new SortedDictionary<TKey, TValue>.KeyCollection.Enumerator(this._dic);
}
// Token: 0x04000052 RID: 82
private SortedDictionary<TKey, TValue> _dic;
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
// Token: 0x0200001A RID: 26
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<TKey>
{
// Token: 0x060000D8 RID: 216 RVA: 0x00004CA0 File Offset: 0x00002EA0
internal Enumerator(SortedDictionary<TKey, TValue> dic)
{
this.host = dic.tree.GetEnumerator();
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000034 RID: 52
// (get) Token: 0x060000D9 RID: 217 RVA: 0x00004CB4 File Offset: 0x00002EB4
object IEnumerator.Current
{
get
{
this.host.check_current();
return this.current;
}
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x060000DA RID: 218 RVA: 0x00004CCC File Offset: 0x00002ECC
void IEnumerator.Reset()
{
this.host.Reset();
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> at the current position of the enumerator.</returns>
// Token: 0x17000035 RID: 53
// (get) Token: 0x060000DB RID: 219 RVA: 0x00004CDC File Offset: 0x00002EDC
public TKey Current
{
get
{
return this.current;
}
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x060000DC RID: 220 RVA: 0x00004CE4 File Offset: 0x00002EE4
public bool MoveNext()
{
if (!this.host.MoveNext())
{
return false;
}
this.current = ((SortedDictionary<TKey, TValue>.Node)this.host.Current).key;
return true;
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection.Enumerator" />.</summary>
// Token: 0x060000DD RID: 221 RVA: 0x00004D20 File Offset: 0x00002F20
public void Dispose()
{
this.host.Dispose();
}
// Token: 0x04000053 RID: 83
private RBTree.NodeEnumerator host;
// Token: 0x04000054 RID: 84
private TKey current;
}
}
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
// Token: 0x0200001B RID: 27
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<KeyValuePair<TKey, TValue>>, IDictionaryEnumerator
{
// Token: 0x060000DE RID: 222 RVA: 0x00004D30 File Offset: 0x00002F30
internal Enumerator(SortedDictionary<TKey, TValue> dic)
{
this.host = dic.tree.GetEnumerator();
}
/// <summary>Gets the element at the current position of the enumerator as a <see cref="T:System.Collections.DictionaryEntry" /> structure.</summary>
/// <returns>The element in the collection at the current position of the dictionary, as a <see cref="T:System.Collections.DictionaryEntry" /> structure.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000036 RID: 54
// (get) Token: 0x060000DF RID: 223 RVA: 0x00004D44 File Offset: 0x00002F44
DictionaryEntry IDictionaryEnumerator.Entry
{
get
{
return this.CurrentNode.AsDE();
}
}
/// <summary>Gets the key of the element at the current position of the enumerator.</summary>
/// <returns>The key of the element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000037 RID: 55
// (get) Token: 0x060000E0 RID: 224 RVA: 0x00004D54 File Offset: 0x00002F54
object IDictionaryEnumerator.Key
{
get
{
return this.CurrentNode.key;
}
}
/// <summary>Gets the value of the element at the current position of the enumerator.</summary>
/// <returns>The value of the element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000038 RID: 56
// (get) Token: 0x060000E1 RID: 225 RVA: 0x00004D68 File Offset: 0x00002F68
object IDictionaryEnumerator.Value
{
get
{
return this.CurrentNode.value;
}
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000039 RID: 57
// (get) Token: 0x060000E2 RID: 226 RVA: 0x00004D7C File Offset: 0x00002F7C
object IEnumerator.Current
{
get
{
return this.CurrentNode.AsDE();
}
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x060000E3 RID: 227 RVA: 0x00004D90 File Offset: 0x00002F90
void IEnumerator.Reset()
{
this.host.Reset();
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> at the current position of the enumerator.</returns>
// Token: 0x1700003A RID: 58
// (get) Token: 0x060000E4 RID: 228 RVA: 0x00004DA0 File Offset: 0x00002FA0
public KeyValuePair<TKey, TValue> Current
{
get
{
return this.current;
}
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x060000E5 RID: 229 RVA: 0x00004DA8 File Offset: 0x00002FA8
public bool MoveNext()
{
if (!this.host.MoveNext())
{
return false;
}
this.current = ((SortedDictionary<TKey, TValue>.Node)this.host.Current).AsKV();
return true;
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.SortedDictionary`2.Enumerator" />.</summary>
// Token: 0x060000E6 RID: 230 RVA: 0x00004DE4 File Offset: 0x00002FE4
public void Dispose()
{
this.host.Dispose();
}
// Token: 0x1700003B RID: 59
// (get) Token: 0x060000E7 RID: 231 RVA: 0x00004DF4 File Offset: 0x00002FF4
private SortedDictionary<TKey, TValue>.Node CurrentNode
{
get
{
this.host.check_current();
return (SortedDictionary<TKey, TValue>.Node)this.host.Current;
}
}
// Token: 0x04000055 RID: 85
private RBTree.NodeEnumerator host;
// Token: 0x04000056 RID: 86
private KeyValuePair<TKey, TValue> current;
}
}
}
+1601
View File
@@ -0,0 +1,1601 @@
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
/// <summary>Represents a collection of key/value pairs that are sorted by key based on the associated <see cref="T:System.Collections.Generic.IComparer`1" /> implementation.</summary>
/// <typeparam name="TKey">The type of keys in the collection.</typeparam>
/// <typeparam name="TValue">The type of values in the collection.</typeparam>
// Token: 0x0200001C RID: 28
[ComVisible(false)]
[Serializable]
public class SortedList<TKey, TValue> : ICollection, IDictionary, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary<TKey, TValue>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the default initial capacity, and uses the default <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
// Token: 0x060000E8 RID: 232 RVA: 0x00004E14 File Offset: 0x00003014
public SortedList()
: this(SortedList<TKey, TValue>.INITIAL_SIZE, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the specified initial capacity, and uses the default <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.</exception>
// Token: 0x060000E9 RID: 233 RVA: 0x00004E24 File Offset: 0x00003024
public SortedList(int capacity)
: this(capacity, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the specified initial capacity, and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys.-or-null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.</exception>
// Token: 0x060000EA RID: 234 RVA: 0x00004E30 File Offset: 0x00003030
public SortedList(int capacity, IComparer<TKey> comparer)
{
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("initialCapacity");
}
if (capacity == 0)
{
this.defaultCapacity = 0;
}
else
{
this.defaultCapacity = SortedList<TKey, TValue>.INITIAL_SIZE;
}
this.Init(comparer, capacity, true);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that is empty, has the default initial capacity, and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys.-or-null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
// Token: 0x060000EB RID: 235 RVA: 0x00004E7C File Offset: 0x0000307C
public SortedList(IComparer<TKey> comparer)
: this(SortedList<TKey, TValue>.INITIAL_SIZE, comparer)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" />, has sufficient capacity to accommodate the number of elements copied, and uses the default <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.SortedList`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
// Token: 0x060000EC RID: 236 RVA: 0x00004E8C File Offset: 0x0000308C
public SortedList(IDictionary<TKey, TValue> dictionary)
: this(dictionary, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedList`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" />, has sufficient capacity to accommodate the number of elements copied, and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" />.</summary>
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.SortedList`2" />.</param>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys.-or-null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="dictionary" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
// Token: 0x060000ED RID: 237 RVA: 0x00004E98 File Offset: 0x00003098
public SortedList(IDictionary<TKey, TValue> dictionary, IComparer<TKey> comparer)
{
if (dictionary == null)
{
throw new ArgumentNullException("dictionary");
}
this.Init(comparer, dictionary.Count, true);
foreach (KeyValuePair<TKey, TValue> keyValuePair in dictionary)
{
this.Add(keyValuePair.Key, keyValuePair.Value);
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns false.</returns>
// Token: 0x1700003C RID: 60
// (get) Token: 0x060000EF RID: 239 RVA: 0x00004F34 File Offset: 0x00003134
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns the current instance.</returns>
// Token: 0x1700003D RID: 61
// (get) Token: 0x060000F0 RID: 240 RVA: 0x00004F38 File Offset: 0x00003138
object ICollection.SyncRoot
{
get
{
return this;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> has a fixed size.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> has a fixed size; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns false.</returns>
// Token: 0x1700003E RID: 62
// (get) Token: 0x060000F1 RID: 241 RVA: 0x00004F3C File Offset: 0x0000313C
bool IDictionary.IsFixedSize
{
get
{
return false;
}
}
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> is read-only.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> is read-only; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedList`2" />, this property always returns false.</returns>
// Token: 0x1700003F RID: 63
// (get) Token: 0x060000F2 RID: 242 RVA: 0x00004F40 File Offset: 0x00003140
bool IDictionary.IsReadOnly
{
get
{
return false;
}
}
/// <summary>Gets or sets the element with the specified key.</summary>
/// <returns>The element with the specified key, or null if <paramref name="key" /> is not in the dictionary or <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
/// <param name="key">The key of the element to get or set.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">A value is being assigned, and <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.SortedList`2" />.-or-A value is being assigned, and <paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.Generic.SortedList`2" />.</exception>
// 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);
}
}
/// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <returns>An <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</returns>
// Token: 0x17000041 RID: 65
// (get) Token: 0x060000F5 RID: 245 RVA: 0x00004F7C File Offset: 0x0000317C
ICollection IDictionary.Keys
{
get
{
return new SortedList<TKey, TValue>.ListKeys(this);
}
}
/// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <returns>An <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</returns>
// Token: 0x17000042 RID: 66
// (get) Token: 0x060000F6 RID: 246 RVA: 0x00004F84 File Offset: 0x00003184
ICollection IDictionary.Values
{
get
{
return new SortedList<TKey, TValue>.ListValues(this);
}
}
// Token: 0x17000043 RID: 67
// (get) Token: 0x060000F7 RID: 247 RVA: 0x00004F8C File Offset: 0x0000318C
ICollection<TKey> IDictionary<TKey, TValue>.Keys
{
get
{
return this.Keys;
}
}
// Token: 0x17000044 RID: 68
// (get) Token: 0x060000F8 RID: 248 RVA: 0x00004F94 File Offset: 0x00003194
ICollection<TValue> IDictionary<TKey, TValue>.Values
{
get
{
return this.Values;
}
}
// Token: 0x17000045 RID: 69
// (get) Token: 0x060000F9 RID: 249 RVA: 0x00004F9C File Offset: 0x0000319C
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
{
get
{
return false;
}
}
// Token: 0x060000FA RID: 250 RVA: 0x00004FA0 File Offset: 0x000031A0
void ICollection<KeyValuePair<TKey, TValue>>.Clear()
{
this.defaultCapacity = SortedList<TKey, TValue>.INITIAL_SIZE;
this.table = new KeyValuePair<TKey, TValue>[this.defaultCapacity];
this.inUse = 0;
this.modificationCount++;
}
// Token: 0x060000FB RID: 251 RVA: 0x00004FD4 File Offset: 0x000031D4
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] 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<TKey, TValue> keyValuePair in this)
{
array[num++] = keyValuePair;
}
}
// Token: 0x060000FC RID: 252 RVA: 0x00005094 File Offset: 0x00003294
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> keyValuePair)
{
this.Add(keyValuePair.Key, keyValuePair.Value);
}
// Token: 0x060000FD RID: 253 RVA: 0x000050AC File Offset: 0x000032AC
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
int num = this.Find(keyValuePair.Key);
return num >= 0 && Comparer<KeyValuePair<TKey, TValue>>.Default.Compare(this.table[num], keyValuePair) == 0;
}
// Token: 0x060000FE RID: 254 RVA: 0x000050F0 File Offset: 0x000032F0
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> keyValuePair)
{
int num = this.Find(keyValuePair.Key);
if (num >= 0 && Comparer<KeyValuePair<TKey, TValue>>.Default.Compare(this.table[num], keyValuePair) == 0)
{
this.RemoveAt(num);
return true;
}
return false;
}
// Token: 0x060000FF RID: 255 RVA: 0x00005140 File Offset: 0x00003340
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
{
for (int i = 0; i < this.inUse; i++)
{
KeyValuePair<TKey, TValue> current = this.table[i];
yield return new KeyValuePair<TKey, TValue>(current.Key, current.Value);
}
yield break;
}
/// <summary>Returns an enumerator that iterates through a collection.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
// Token: 0x06000100 RID: 256 RVA: 0x0000515C File Offset: 0x0000335C
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Adds an element with the provided key and value to the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <param name="key">The <see cref="T:System.Object" /> to use as the key of the element to add.</param>
/// <param name="value">The <see cref="T:System.Object" /> to use as the value of the element to add.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.IDictionary" />.-or-<paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.IDictionary" />.-or-An element with the same key already exists in the <see cref="T:System.Collections.IDictionary" />.</exception>
// 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);
}
/// <summary>Determines whether the <see cref="T:System.Collections.IDictionary" /> contains an element with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> contains an element with the key; otherwise, false.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// 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;
}
/// <summary>Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</returns>
// Token: 0x06000103 RID: 259 RVA: 0x000051B8 File Offset: 0x000033B8
IDictionaryEnumerator IDictionary.GetEnumerator()
{
return new SortedList<TKey, TValue>.Enumerator(this, SortedList<TKey, TValue>.EnumeratorMode.ENTRY_MODE);
}
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary" />.</summary>
/// <param name="key">The key of the element to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// 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);
}
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="arrayIndex">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// 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<KeyValuePair<TKey, TValue>> enumerator = this.GetEnumerator();
int num = arrayIndex;
while (enumerator.MoveNext())
{
KeyValuePair<TKey, TValue> keyValuePair = enumerator.Current;
array.SetValue(keyValuePair, num++);
}
}
/// <summary>Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>The number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x17000046 RID: 70
// (get) Token: 0x06000106 RID: 262 RVA: 0x000052BC File Offset: 0x000034BC
public int Count
{
get
{
return this.inUse;
}
}
/// <summary>Gets or sets the value associated with the specified key.</summary>
/// <returns>The value associated with the specified key. If the specified key is not found, a get operation throws a <see cref="T:System.Collections.Generic.KeyNotFoundException" /> and a set operation creates a new element using the specified key.</returns>
/// <param name="key">The key whose value to get or set.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key" /> does not exist in the collection.</exception>
// 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);
}
}
/// <summary>Gets or sets the number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</summary>
/// <returns>The number of elements that the <see cref="T:System.Collections.Generic.SortedList`2" /> can contain.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <see cref="P:System.Collections.Generic.SortedList`2.Capacity" /> is set to a value that is less than <see cref="P:System.Collections.Generic.SortedList`2.Count" />.</exception>
/// <exception cref="T:System.OutOfMemoryException">There is not enough memory available on the system.</exception>
// 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<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[this.defaultCapacity];
Array.Copy(this.table, array, this.inUse);
this.table = array;
}
else if (value > this.inUse)
{
KeyValuePair<TKey, TValue>[] array2 = new KeyValuePair<TKey, TValue>[value];
Array.Copy(this.table, array2, this.inUse);
this.table = array2;
}
else if (value > num)
{
KeyValuePair<TKey, TValue>[] array3 = new KeyValuePair<TKey, TValue>[value];
Array.Copy(this.table, array3, num);
this.table = array3;
}
}
}
/// <summary>Gets a collection containing the keys in the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.IList`1" /> containing the keys in the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x17000049 RID: 73
// (get) Token: 0x0600010B RID: 267 RVA: 0x000053F0 File Offset: 0x000035F0
public IList<TKey> Keys
{
get
{
return new SortedList<TKey, TValue>.ListKeys(this);
}
}
/// <summary>Gets a collection containing the values in the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>A <see cref="T:System.Collections.Generic.IList`1" /> containing the values in the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x1700004A RID: 74
// (get) Token: 0x0600010C RID: 268 RVA: 0x000053F8 File Offset: 0x000035F8
public IList<TValue> Values
{
get
{
return new SortedList<TKey, TValue>.ListValues(this);
}
}
/// <summary>Gets the <see cref="T:System.Collections.Generic.IComparer`1" /> for the sorted list. </summary>
/// <returns>The <see cref="T:System.IComparable`1" /> for the current <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x1700004B RID: 75
// (get) Token: 0x0600010D RID: 269 RVA: 0x00005400 File Offset: 0x00003600
public IComparer<TKey> Comparer
{
get
{
return this.comparer;
}
}
/// <summary>Adds an element with the specified key and value into the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <param name="key">The key of the element to add.</param>
/// <param name="value">The value of the element to add. The value can be null for reference types.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.SortedList`2" />.</exception>
// 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);
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedList`2" /> contains a specific key.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedList`2" /> contains an element with the specified key; otherwise, false.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// 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;
}
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> of type <see cref="T:System.Collections.Generic.KeyValuePair`2" /> for the <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
// Token: 0x06000110 RID: 272 RVA: 0x00005454 File Offset: 0x00003654
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{
for (int i = 0; i < this.inUse; i++)
{
KeyValuePair<TKey, TValue> current = this.table[i];
yield return new KeyValuePair<TKey, TValue>(current.Key, current.Value);
}
yield break;
}
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key" /> was not found in the original <see cref="T:System.Collections.Generic.SortedList`2" />.</returns>
/// <param name="key">The key of the element to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// 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;
}
/// <summary>Removes all elements from the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
// Token: 0x06000112 RID: 274 RVA: 0x000054AC File Offset: 0x000036AC
public void Clear()
{
this.defaultCapacity = SortedList<TKey, TValue>.INITIAL_SIZE;
this.table = new KeyValuePair<TKey, TValue>[this.defaultCapacity];
this.inUse = 0;
this.modificationCount++;
}
/// <summary>Removes the element at the specified index of the <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <param name="index">The zero-based index of the element to remove.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero.-or-<paramref name="index" /> is equal to or greater than <see cref="P:System.Collections.Generic.SortedList`2.Count" />.</exception>
// Token: 0x06000113 RID: 275 RVA: 0x000054E0 File Offset: 0x000036E0
public void RemoveAt(int index)
{
KeyValuePair<TKey, TValue>[] 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<TKey, TValue>);
}
this.inUse--;
this.modificationCount++;
return;
}
throw new ArgumentOutOfRangeException("index out of range");
}
/// <summary>Searches for the specified key and returns the zero-based index within the entire <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>The zero-based index of <paramref name="key" /> within the entire <see cref="T:System.Collections.Generic.SortedList`2" />, if found; otherwise, -1.</returns>
/// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// 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);
}
/// <summary>Searches for the specified value and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.Generic.SortedList`2" />.</summary>
/// <returns>The zero-based index of the first occurrence of <paramref name="value" /> within the entire <see cref="T:System.Collections.Generic.SortedList`2" />, if found; otherwise, -1.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />. The value can be null for reference types.</param>
// 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<TKey, TValue> keyValuePair = this.table[i];
if (object.Equals(value, keyValuePair.Value))
{
return i;
}
}
return -1;
}
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedList`2" /> contains a specific value.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedList`2" /> contains an element with the specified value; otherwise, false.</returns>
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.SortedList`2" />. The value can be null for reference types.</param>
// Token: 0x06000116 RID: 278 RVA: 0x0000562C File Offset: 0x0000382C
public bool ContainsValue(TValue value)
{
return this.IndexOfValue(value) >= 0;
}
/// <summary>Sets the capacity to the actual number of elements in the <see cref="T:System.Collections.Generic.SortedList`2" />, if that number is less than 90 percent of current capacity.</summary>
// 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;
}
}
/// <summary>Gets the value associated with the specified key.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedList`2" /> contains an element with the specified key; otherwise, false.</returns>
/// <param name="key">The key whose value to get.</param>
/// <param name="value">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 <paramref name="value" /> parameter. This parameter is passed uninitialized.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="key" /> is null.</exception>
// 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<TKey, TValue>[] array = this.table;
KeyValuePair<TKey, TValue>[] array2 = null;
int capacity = this.Capacity;
bool flag = free >= 0 && free < this.Count;
if (n > capacity)
{
array2 = new KeyValuePair<TKey, TValue>[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<TKey, TValue>[] 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<TKey, TValue>(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<TKey, TValue>(key, value);
this.inUse++;
this.modificationCount++;
return;
}
}
// Token: 0x0600011B RID: 283 RVA: 0x000058C4 File Offset: 0x00003AC4
private void Init(IComparer<TKey> comparer, int capacity, bool forceSize)
{
if (comparer == null)
{
comparer = Comparer<TKey>.Default;
}
this.comparer = comparer;
if (!forceSize && capacity < this.defaultCapacity)
{
capacity = this.defaultCapacity;
}
this.table = new KeyValuePair<TKey, TValue>[capacity];
this.inUse = 0;
this.modificationCount = 0;
}
// Token: 0x0600011C RID: 284 RVA: 0x0000591C File Offset: 0x00003B1C
private void CopyToArray(Array arr, int i, SortedList<TKey, TValue>.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<TKey, TValue>.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<TKey, TValue>[] 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<TKey, TValue>[] table;
// Token: 0x0400005B RID: 91
private IComparer<TKey> 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<TKey, TValue> host, SortedList<TKey, TValue>.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<TKey, TValue> host)
: this(host, SortedList<TKey, TValue>.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<TKey, TValue>.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<TKey, TValue>.Enumerator.xstr);
}
KeyValuePair<TKey, TValue>[] table = this.host.table;
if (++this.pos < this.size)
{
KeyValuePair<TKey, TValue> 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<TKey, TValue>.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<TKey, TValue>.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<TKey, TValue>.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<TKey, TValue>.Enumerator.xstr);
}
switch (this.mode)
{
case SortedList<TKey, TValue>.EnumeratorMode.KEY_MODE:
return this.currentKey;
case SortedList<TKey, TValue>.EnumeratorMode.VALUE_MODE:
return this.currentValue;
case SortedList<TKey, TValue>.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<TKey, TValue>.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<TKey, TValue> 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<TKey, TValue>.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<TKey>
{
// Token: 0x0600012C RID: 300 RVA: 0x00005E58 File Offset: 0x00004058
internal KeyEnumerator(SortedList<TKey, TValue> 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<TKey, TValue> 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<TValue>
{
// Token: 0x06000132 RID: 306 RVA: 0x00005F68 File Offset: 0x00004168
internal ValueEnumerator(SortedList<TKey, TValue> 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<TKey, TValue> 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<TKey>, ICollection<TKey>, IEnumerable<TKey>
{
// Token: 0x06000138 RID: 312 RVA: 0x00006078 File Offset: 0x00004278
public ListKeys(SortedList<TKey, TValue> 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<TKey> GetEnumerator()
{
return new SortedList<TKey, TValue>.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<TKey, TValue>.EnumeratorMode.KEY_MODE);
}
// Token: 0x04000074 RID: 116
private SortedList<TKey, TValue> host;
}
// Token: 0x02000022 RID: 34
private class ListValues : ICollection, IEnumerable, IList<TValue>, ICollection<TValue>, IEnumerable<TValue>
{
// Token: 0x0600014A RID: 330 RVA: 0x0000620C File Offset: 0x0000440C
public ListValues(SortedList<TKey, TValue> 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<TValue> GetEnumerator()
{
return new SortedList<TKey, TValue>.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<TKey, TValue>.EnumeratorMode.VALUE_MODE);
}
// Token: 0x04000075 RID: 117
private SortedList<TKey, TValue> host;
}
}
}
+363
View File
@@ -0,0 +1,363 @@
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
/// <summary>Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type.</summary>
/// <typeparam name="T">Specifies the type of elements in the stack.</typeparam>
/// <filterpriority>1</filterpriority>
// Token: 0x02000023 RID: 35
[ComVisible(false)]
[Serializable]
public class Stack<T> : ICollection, IEnumerable, IEnumerable<T>
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Stack`1" /> class that is empty and has the default initial capacity.</summary>
// Token: 0x0600015C RID: 348 RVA: 0x000063A0 File Offset: 0x000045A0
public Stack()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Stack`1" /> class that is empty and has the specified initial capacity or the default initial capacity, whichever is greater.</summary>
/// <param name="capacity">The initial number of elements that the <see cref="T:System.Collections.Generic.Stack`1" /> can contain.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.</exception>
// Token: 0x0600015D RID: 349 RVA: 0x000063A8 File Offset: 0x000045A8
public Stack(int count)
{
if (count < 0)
{
throw new ArgumentOutOfRangeException("count");
}
this._array = new T[count];
}
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Stack`1" /> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.</summary>
/// <param name="collection">The collection to copy elements from.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="collection" /> is null.</exception>
// Token: 0x0600015E RID: 350 RVA: 0x000063DC File Offset: 0x000045DC
public Stack(IEnumerable<T> collection)
{
if (collection == null)
{
throw new ArgumentNullException("collection");
}
ICollection<T> collection2 = collection as ICollection<T>;
if (collection2 != null)
{
this._size = collection2.Count;
this._array = new T[this._size];
collection2.CopyTo(this._array, 0);
}
else
{
foreach (T t in collection)
{
this.Push(t);
}
}
}
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.Stack`1" />, this property always returns false.</returns>
// Token: 0x1700005E RID: 94
// (get) Token: 0x0600015F RID: 351 RVA: 0x00006490 File Offset: 0x00004690
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.Stack`1" />, this property always returns the current instance.</returns>
// Token: 0x1700005F RID: 95
// (get) Token: 0x06000160 RID: 352 RVA: 0x00006494 File Offset: 0x00004694
object ICollection.SyncRoot
{
get
{
return this;
}
}
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an <see cref="T:System.Array" />, starting at a particular <see cref="T:System.Array" /> index.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="arrayIndex">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
// Token: 0x06000161 RID: 353 RVA: 0x00006498 File Offset: 0x00004698
void ICollection.CopyTo(Array dest, int idx)
{
try
{
if (this._array != null)
{
this._array.CopyTo(dest, idx);
Array.Reverse(dest, idx, this._size);
}
}
catch (ArrayTypeMismatchException)
{
throw new ArgumentException();
}
}
// Token: 0x06000162 RID: 354 RVA: 0x000064F8 File Offset: 0x000046F8
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Returns an enumerator that iterates through a collection.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
// Token: 0x06000163 RID: 355 RVA: 0x00006508 File Offset: 0x00004708
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Removes all objects from the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x06000164 RID: 356 RVA: 0x00006518 File Offset: 0x00004718
public void Clear()
{
if (this._array != null)
{
Array.Clear(this._array, 0, this._array.Length);
}
this._size = 0;
this._version++;
}
/// <summary>Determines whether an element is in the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <returns>true if <paramref name="item" /> is found in the <see cref="T:System.Collections.Generic.Stack`1" />; otherwise, false.</returns>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.Stack`1" />. The value can be null for reference types.</param>
// Token: 0x06000165 RID: 357 RVA: 0x0000655C File Offset: 0x0000475C
public bool Contains(T t)
{
return this._array != null && Array.IndexOf<T>(this._array, t, 0, this._size) != -1;
}
/// <summary>Copies the <see cref="T:System.Collections.Generic.Stack`1" /> to an existing one-dimensional <see cref="T:System.Array" />, starting at the specified array index.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.Stack`1" />. The <see cref="T:System.Array" /> must have zero-based indexing.</param>
/// <param name="arrayIndex">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="arrayIndex" /> is less than zero.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.Stack`1" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.</exception>
// Token: 0x06000166 RID: 358 RVA: 0x00006588 File Offset: 0x00004788
public void CopyTo(T[] dest, int idx)
{
if (dest == null)
{
throw new ArgumentNullException("dest");
}
if (idx < 0)
{
throw new ArgumentOutOfRangeException("idx");
}
if (this._array != null)
{
Array.Copy(this._array, 0, dest, idx, this._size);
Array.Reverse(dest, idx, this._size);
}
}
/// <summary>Returns the object at the top of the <see cref="T:System.Collections.Generic.Stack`1" /> without removing it.</summary>
/// <returns>The object at the top of the <see cref="T:System.Collections.Generic.Stack`1" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Collections.Generic.Stack`1" /> is empty.</exception>
// Token: 0x06000167 RID: 359 RVA: 0x000065E4 File Offset: 0x000047E4
public T Peek()
{
if (this._size == 0)
{
throw new InvalidOperationException();
}
return this._array[this._size - 1];
}
/// <summary>Removes and returns the object at the top of the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <returns>The object removed from the top of the <see cref="T:System.Collections.Generic.Stack`1" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Collections.Generic.Stack`1" /> is empty.</exception>
// Token: 0x06000168 RID: 360 RVA: 0x00006618 File Offset: 0x00004818
public T Pop()
{
if (this._size == 0)
{
throw new InvalidOperationException();
}
this._version++;
T t = this._array[--this._size];
this._array[this._size] = default(T);
return t;
}
/// <summary>Inserts an object at the top of the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <param name="item">The object to push onto the <see cref="T:System.Collections.Generic.Stack`1" />. The value can be null for reference types.</param>
// Token: 0x06000169 RID: 361 RVA: 0x0000667C File Offset: 0x0000487C
public void Push(T t)
{
if (this._array == null || this._size == this._array.Length)
{
Array.Resize<T>(ref this._array, (this._size != 0) ? (2 * this._size) : 16);
}
this._version++;
this._array[this._size++] = t;
}
/// <summary>Copies the <see cref="T:System.Collections.Generic.Stack`1" /> to a new array.</summary>
/// <returns>A new array containing copies of the elements of the <see cref="T:System.Collections.Generic.Stack`1" />.</returns>
// Token: 0x0600016A RID: 362 RVA: 0x000066F8 File Offset: 0x000048F8
public T[] ToArray()
{
T[] array = new T[this._size];
this.CopyTo(array, 0);
return array;
}
/// <summary>Sets the capacity to the actual number of elements in the <see cref="T:System.Collections.Generic.Stack`1" />, if that number is less than 90 percent of current capacity.</summary>
// Token: 0x0600016B RID: 363 RVA: 0x0000671C File Offset: 0x0000491C
public void TrimExcess()
{
if (this._array != null && (double)this._size < (double)this._array.Length * 0.9)
{
Array.Resize<T>(ref this._array, this._size);
}
this._version++;
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.Stack`1" />.</returns>
// Token: 0x17000060 RID: 96
// (get) Token: 0x0600016C RID: 364 RVA: 0x00006774 File Offset: 0x00004974
public int Count
{
get
{
return this._size;
}
}
/// <summary>Returns an enumerator for the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <returns>An <see cref="T:System.Collections.Generic.Stack`1.Enumerator" /> for the <see cref="T:System.Collections.Generic.Stack`1" />.</returns>
// Token: 0x0600016D RID: 365 RVA: 0x0000677C File Offset: 0x0000497C
public Stack<T>.Enumerator GetEnumerator()
{
return new Stack<T>.Enumerator(this);
}
// Token: 0x04000076 RID: 118
private const int INITIAL_SIZE = 16;
// Token: 0x04000077 RID: 119
private T[] _array;
// Token: 0x04000078 RID: 120
private int _size;
// Token: 0x04000079 RID: 121
private int _version;
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
// Token: 0x02000024 RID: 36
[Serializable]
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<T>
{
// Token: 0x0600016E RID: 366 RVA: 0x00006784 File Offset: 0x00004984
internal Enumerator(Stack<T> t)
{
this.parent = t;
this.idx = -2;
this._version = t._version;
}
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection. This class cannot be inherited.</summary>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x0600016F RID: 367 RVA: 0x000067A4 File Offset: 0x000049A4
void IEnumerator.Reset()
{
if (this._version != this.parent._version)
{
throw new InvalidOperationException();
}
this.idx = -2;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the collection at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000061 RID: 97
// (get) Token: 0x06000170 RID: 368 RVA: 0x000067D8 File Offset: 0x000049D8
object IEnumerator.Current
{
get
{
return this.Current;
}
}
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.Stack`1.Enumerator" />.</summary>
// Token: 0x06000171 RID: 369 RVA: 0x000067E8 File Offset: 0x000049E8
public void Dispose()
{
this.idx = -2;
}
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.Stack`1" />.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
// Token: 0x06000172 RID: 370 RVA: 0x000067F4 File Offset: 0x000049F4
public bool MoveNext()
{
if (this._version != this.parent._version)
{
throw new InvalidOperationException();
}
if (this.idx == -2)
{
this.idx = this.parent._size;
}
return this.idx != -1 && --this.idx != -1;
}
/// <summary>Gets the element at the current position of the enumerator.</summary>
/// <returns>The element in the <see cref="T:System.Collections.Generic.Stack`1" /> at the current position of the enumerator.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
// Token: 0x17000062 RID: 98
// (get) Token: 0x06000173 RID: 371 RVA: 0x00006864 File Offset: 0x00004A64
public T Current
{
get
{
if (this.idx < 0)
{
throw new InvalidOperationException();
}
return this.parent._array[this.idx];
}
}
// Token: 0x0400007A RID: 122
private const int NOT_STARTED = -2;
// Token: 0x0400007B RID: 123
private const int FINISHED = -1;
// Token: 0x0400007C RID: 124
private Stack<T> parent;
// Token: 0x0400007D RID: 125
private int idx;
// Token: 0x0400007E RID: 126
private int _version;
}
}
}