scripts
This commit is contained in:
@@ -0,0 +1,746 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Google.Protobuf.Reflection;
|
||||
|
||||
namespace Google.Protobuf.Collections
|
||||
{
|
||||
// Token: 0x0200006F RID: 111
|
||||
public sealed class MapField<TKey, TValue> : IDeepCloneable<MapField<TKey, TValue>>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IEquatable<MapField<TKey, TValue>>, IDictionary, ICollection
|
||||
{
|
||||
// Token: 0x0600060B RID: 1547 RVA: 0x000151CC File Offset: 0x000133CC
|
||||
public MapField<TKey, TValue> Clone()
|
||||
{
|
||||
MapField<TKey, TValue> mapField = new MapField<TKey, TValue>();
|
||||
if (typeof(IDeepCloneable<TValue>).IsAssignableFrom(typeof(TValue)))
|
||||
{
|
||||
using (LinkedList<KeyValuePair<TKey, TValue>>.Enumerator enumerator = this.list.GetEnumerator())
|
||||
{
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
KeyValuePair<TKey, TValue> keyValuePair = enumerator.Current;
|
||||
mapField.Add(keyValuePair.Key, ((IDeepCloneable<TValue>)((object)keyValuePair.Value)).Clone());
|
||||
}
|
||||
return mapField;
|
||||
}
|
||||
}
|
||||
mapField.Add(this);
|
||||
return mapField;
|
||||
}
|
||||
|
||||
// Token: 0x0600060C RID: 1548 RVA: 0x00015264 File Offset: 0x00013464
|
||||
public void Add(TKey key, TValue value)
|
||||
{
|
||||
if (this.ContainsKey(key))
|
||||
{
|
||||
throw new ArgumentException("Key already exists in map", "key");
|
||||
}
|
||||
this[key] = value;
|
||||
}
|
||||
|
||||
// Token: 0x0600060D RID: 1549 RVA: 0x00015287 File Offset: 0x00013487
|
||||
public bool ContainsKey(TKey key)
|
||||
{
|
||||
ProtoPreconditions.CheckNotNullUnconstrained<TKey>(key, "key");
|
||||
return this.map.ContainsKey(key);
|
||||
}
|
||||
|
||||
// Token: 0x0600060E RID: 1550 RVA: 0x000152A4 File Offset: 0x000134A4
|
||||
private bool ContainsValue(TValue value)
|
||||
{
|
||||
EqualityComparer<TValue> comparer = EqualityComparer<TValue>.Default;
|
||||
return this.list.Any((KeyValuePair<TKey, TValue> pair) => comparer.Equals(pair.Value, value));
|
||||
}
|
||||
|
||||
// Token: 0x0600060F RID: 1551 RVA: 0x000152E0 File Offset: 0x000134E0
|
||||
public bool Remove(TKey key)
|
||||
{
|
||||
ProtoPreconditions.CheckNotNullUnconstrained<TKey>(key, "key");
|
||||
LinkedListNode<KeyValuePair<TKey, TValue>> linkedListNode;
|
||||
if (this.map.TryGetValue(key, out linkedListNode))
|
||||
{
|
||||
this.map.Remove(key);
|
||||
linkedListNode.List.Remove(linkedListNode);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000610 RID: 1552 RVA: 0x00015328 File Offset: 0x00013528
|
||||
public bool TryGetValue(TKey key, out TValue value)
|
||||
{
|
||||
LinkedListNode<KeyValuePair<TKey, TValue>> linkedListNode;
|
||||
if (this.map.TryGetValue(key, out linkedListNode))
|
||||
{
|
||||
value = linkedListNode.Value.Value;
|
||||
return true;
|
||||
}
|
||||
value = default(TValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x170001B5 RID: 437
|
||||
public TValue this[TKey key]
|
||||
{
|
||||
get
|
||||
{
|
||||
ProtoPreconditions.CheckNotNullUnconstrained<TKey>(key, "key");
|
||||
TValue tvalue;
|
||||
if (this.TryGetValue(key, out tvalue))
|
||||
{
|
||||
return tvalue;
|
||||
}
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
set
|
||||
{
|
||||
ProtoPreconditions.CheckNotNullUnconstrained<TKey>(key, "key");
|
||||
if (value == null)
|
||||
{
|
||||
ProtoPreconditions.CheckNotNullUnconstrained<TValue>(value, "value");
|
||||
}
|
||||
KeyValuePair<TKey, TValue> keyValuePair = new KeyValuePair<TKey, TValue>(key, value);
|
||||
LinkedListNode<KeyValuePair<TKey, TValue>> linkedListNode;
|
||||
if (this.map.TryGetValue(key, out linkedListNode))
|
||||
{
|
||||
linkedListNode.Value = keyValuePair;
|
||||
return;
|
||||
}
|
||||
linkedListNode = this.list.AddLast(keyValuePair);
|
||||
this.map[key] = linkedListNode;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001B6 RID: 438
|
||||
// (get) Token: 0x06000613 RID: 1555 RVA: 0x000153F8 File Offset: 0x000135F8
|
||||
public ICollection<TKey> Keys
|
||||
{
|
||||
get
|
||||
{
|
||||
return new MapField<TKey, TValue>.MapView<TKey>(this, (KeyValuePair<TKey, TValue> pair) => pair.Key, new Func<TKey, bool>(this.ContainsKey));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001B7 RID: 439
|
||||
// (get) Token: 0x06000614 RID: 1556 RVA: 0x0001542C File Offset: 0x0001362C
|
||||
public ICollection<TValue> Values
|
||||
{
|
||||
get
|
||||
{
|
||||
return new MapField<TKey, TValue>.MapView<TValue>(this, (KeyValuePair<TKey, TValue> pair) => pair.Value, new Func<TValue, bool>(this.ContainsValue));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000615 RID: 1557 RVA: 0x00015460 File Offset: 0x00013660
|
||||
public void Add(IDictionary<TKey, TValue> entries)
|
||||
{
|
||||
ProtoPreconditions.CheckNotNull<IDictionary<TKey, TValue>>(entries, "entries");
|
||||
foreach (KeyValuePair<TKey, TValue> keyValuePair in entries)
|
||||
{
|
||||
this.Add(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000616 RID: 1558 RVA: 0x000154C4 File Offset: 0x000136C4
|
||||
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
|
||||
{
|
||||
return this.list.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x06000617 RID: 1559 RVA: 0x000154D6 File Offset: 0x000136D6
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x06000618 RID: 1560 RVA: 0x000154DE File Offset: 0x000136DE
|
||||
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
this.Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
// Token: 0x06000619 RID: 1561 RVA: 0x000154F4 File Offset: 0x000136F4
|
||||
public void Clear()
|
||||
{
|
||||
this.list.Clear();
|
||||
this.map.Clear();
|
||||
}
|
||||
|
||||
// Token: 0x0600061A RID: 1562 RVA: 0x0001550C File Offset: 0x0001370C
|
||||
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: 0x0600061B RID: 1563 RVA: 0x0001553E File Offset: 0x0001373E
|
||||
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
|
||||
{
|
||||
this.list.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
// Token: 0x0600061C RID: 1564 RVA: 0x00015550 File Offset: 0x00013750
|
||||
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
if (item.Key == null)
|
||||
{
|
||||
throw new ArgumentException("Key is null", "item");
|
||||
}
|
||||
LinkedListNode<KeyValuePair<TKey, TValue>> linkedListNode;
|
||||
if (this.map.TryGetValue(item.Key, out linkedListNode) && EqualityComparer<TValue>.Default.Equals(item.Value, linkedListNode.Value.Value))
|
||||
{
|
||||
this.map.Remove(item.Key);
|
||||
linkedListNode.List.Remove(linkedListNode);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x170001B8 RID: 440
|
||||
// (get) Token: 0x0600061D RID: 1565 RVA: 0x000155D4 File Offset: 0x000137D4
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.list.Count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001B9 RID: 441
|
||||
// (get) Token: 0x0600061E RID: 1566 RVA: 0x0000761F File Offset: 0x0000581F
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600061F RID: 1567 RVA: 0x000155E1 File Offset: 0x000137E1
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
return this.Equals(other as MapField<TKey, TValue>);
|
||||
}
|
||||
|
||||
// Token: 0x06000620 RID: 1568 RVA: 0x000155F0 File Offset: 0x000137F0
|
||||
public override int GetHashCode()
|
||||
{
|
||||
EqualityComparer<TValue> @default = EqualityComparer<TValue>.Default;
|
||||
int num = 0;
|
||||
foreach (KeyValuePair<TKey, TValue> keyValuePair in this.list)
|
||||
{
|
||||
int num2 = num;
|
||||
TKey key = keyValuePair.Key;
|
||||
num = num2 ^ (key.GetHashCode() * 31 + @default.GetHashCode(keyValuePair.Value));
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000621 RID: 1569 RVA: 0x00015670 File Offset: 0x00013870
|
||||
public bool Equals(MapField<TKey, TValue> other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (other == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (other.Count != this.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
EqualityComparer<TValue> @default = EqualityComparer<TValue>.Default;
|
||||
foreach (KeyValuePair<TKey, TValue> keyValuePair in this)
|
||||
{
|
||||
TValue tvalue;
|
||||
if (!other.TryGetValue(keyValuePair.Key, out tvalue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!@default.Equals(tvalue, keyValuePair.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06000622 RID: 1570 RVA: 0x00015704 File Offset: 0x00013904
|
||||
public void AddEntriesFrom(CodedInputStream input, MapField<TKey, TValue>.Codec codec)
|
||||
{
|
||||
MapField<TKey, TValue>.Codec.MessageAdapter messageAdapter = new MapField<TKey, TValue>.Codec.MessageAdapter(codec);
|
||||
do
|
||||
{
|
||||
messageAdapter.Reset();
|
||||
input.ReadMessage(messageAdapter);
|
||||
this[messageAdapter.Key] = messageAdapter.Value;
|
||||
}
|
||||
while (input.MaybeConsumeTag(codec.MapTag));
|
||||
}
|
||||
|
||||
// Token: 0x06000623 RID: 1571 RVA: 0x00015748 File Offset: 0x00013948
|
||||
public void WriteTo(CodedOutputStream output, MapField<TKey, TValue>.Codec codec)
|
||||
{
|
||||
MapField<TKey, TValue>.Codec.MessageAdapter messageAdapter = new MapField<TKey, TValue>.Codec.MessageAdapter(codec);
|
||||
foreach (KeyValuePair<TKey, TValue> keyValuePair in this.list)
|
||||
{
|
||||
messageAdapter.Key = keyValuePair.Key;
|
||||
messageAdapter.Value = keyValuePair.Value;
|
||||
output.WriteTag(codec.MapTag);
|
||||
output.WriteMessage(messageAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000624 RID: 1572 RVA: 0x000157C8 File Offset: 0x000139C8
|
||||
public int CalculateSize(MapField<TKey, TValue>.Codec codec)
|
||||
{
|
||||
if (this.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
MapField<TKey, TValue>.Codec.MessageAdapter messageAdapter = new MapField<TKey, TValue>.Codec.MessageAdapter(codec);
|
||||
int num = 0;
|
||||
foreach (KeyValuePair<TKey, TValue> keyValuePair in this.list)
|
||||
{
|
||||
messageAdapter.Key = keyValuePair.Key;
|
||||
messageAdapter.Value = keyValuePair.Value;
|
||||
num += CodedOutputStream.ComputeRawVarint32Size(codec.MapTag);
|
||||
num += CodedOutputStream.ComputeMessageSize(messageAdapter);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000625 RID: 1573 RVA: 0x0001585C File Offset: 0x00013A5C
|
||||
public override string ToString()
|
||||
{
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
JsonFormatter.Default.WriteDictionary(stringWriter, this);
|
||||
return stringWriter.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06000626 RID: 1574 RVA: 0x00015881 File Offset: 0x00013A81
|
||||
void IDictionary.Add(object key, object value)
|
||||
{
|
||||
this.Add((TKey)((object)key), (TValue)((object)value));
|
||||
}
|
||||
|
||||
// Token: 0x06000627 RID: 1575 RVA: 0x00015895 File Offset: 0x00013A95
|
||||
bool IDictionary.Contains(object key)
|
||||
{
|
||||
return key is TKey && this.ContainsKey((TKey)((object)key));
|
||||
}
|
||||
|
||||
// Token: 0x06000628 RID: 1576 RVA: 0x000158AD File Offset: 0x00013AAD
|
||||
IDictionaryEnumerator IDictionary.GetEnumerator()
|
||||
{
|
||||
return new MapField<TKey, TValue>.DictionaryEnumerator(this.GetEnumerator());
|
||||
}
|
||||
|
||||
// Token: 0x06000629 RID: 1577 RVA: 0x000158BA File Offset: 0x00013ABA
|
||||
void IDictionary.Remove(object key)
|
||||
{
|
||||
ProtoPreconditions.CheckNotNull<object>(key, "key");
|
||||
if (!(key is TKey))
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.Remove((TKey)((object)key));
|
||||
}
|
||||
|
||||
// Token: 0x0600062A RID: 1578 RVA: 0x000158DE File Offset: 0x00013ADE
|
||||
void ICollection.CopyTo(Array array, int index)
|
||||
{
|
||||
((ICollection)this.Select((KeyValuePair<TKey, TValue> pair) => new DictionaryEntry(pair.Key, pair.Value)).ToList<DictionaryEntry>()).CopyTo(array, index);
|
||||
}
|
||||
|
||||
// Token: 0x170001BA RID: 442
|
||||
// (get) Token: 0x0600062B RID: 1579 RVA: 0x0000761F File Offset: 0x0000581F
|
||||
bool IDictionary.IsFixedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001BB RID: 443
|
||||
// (get) Token: 0x0600062C RID: 1580 RVA: 0x00015911 File Offset: 0x00013B11
|
||||
ICollection IDictionary.Keys
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ICollection)this.Keys;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001BC RID: 444
|
||||
// (get) Token: 0x0600062D RID: 1581 RVA: 0x0001591E File Offset: 0x00013B1E
|
||||
ICollection IDictionary.Values
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ICollection)this.Values;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001BD RID: 445
|
||||
// (get) Token: 0x0600062E RID: 1582 RVA: 0x0000761F File Offset: 0x0000581F
|
||||
bool ICollection.IsSynchronized
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001BE RID: 446
|
||||
// (get) Token: 0x0600062F RID: 1583 RVA: 0x000142A1 File Offset: 0x000124A1
|
||||
object ICollection.SyncRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001BF RID: 447
|
||||
object IDictionary.this[object key]
|
||||
{
|
||||
get
|
||||
{
|
||||
ProtoPreconditions.CheckNotNull<object>(key, "key");
|
||||
if (!(key is TKey))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
TValue tvalue;
|
||||
this.TryGetValue((TKey)((object)key), out tvalue);
|
||||
return tvalue;
|
||||
}
|
||||
set
|
||||
{
|
||||
this[(TKey)((object)key)] = (TValue)((object)value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000266 RID: 614
|
||||
private readonly Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> map = new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>>();
|
||||
|
||||
// Token: 0x04000267 RID: 615
|
||||
private readonly LinkedList<KeyValuePair<TKey, TValue>> list = new LinkedList<KeyValuePair<TKey, TValue>>();
|
||||
|
||||
// Token: 0x020000C8 RID: 200
|
||||
private class DictionaryEnumerator : IDictionaryEnumerator, IEnumerator
|
||||
{
|
||||
// Token: 0x06000787 RID: 1927 RVA: 0x00017941 File Offset: 0x00015B41
|
||||
internal DictionaryEnumerator(IEnumerator<KeyValuePair<TKey, TValue>> enumerator)
|
||||
{
|
||||
this.enumerator = enumerator;
|
||||
}
|
||||
|
||||
// Token: 0x06000788 RID: 1928 RVA: 0x00017950 File Offset: 0x00015B50
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
// Token: 0x06000789 RID: 1929 RVA: 0x0001795D File Offset: 0x00015B5D
|
||||
public void Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x170001D4 RID: 468
|
||||
// (get) Token: 0x0600078A RID: 1930 RVA: 0x0001796A File Offset: 0x00015B6A
|
||||
public object Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Entry;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001D5 RID: 469
|
||||
// (get) Token: 0x0600078B RID: 1931 RVA: 0x00017977 File Offset: 0x00015B77
|
||||
public DictionaryEntry Entry
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DictionaryEntry(this.Key, this.Value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001D6 RID: 470
|
||||
// (get) Token: 0x0600078C RID: 1932 RVA: 0x0001798C File Offset: 0x00015B8C
|
||||
public object Key
|
||||
{
|
||||
get
|
||||
{
|
||||
KeyValuePair<TKey, TValue> keyValuePair = this.enumerator.Current;
|
||||
return keyValuePair.Key;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001D7 RID: 471
|
||||
// (get) Token: 0x0600078D RID: 1933 RVA: 0x000179B4 File Offset: 0x00015BB4
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
KeyValuePair<TKey, TValue> keyValuePair = this.enumerator.Current;
|
||||
return keyValuePair.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000305 RID: 773
|
||||
private readonly IEnumerator<KeyValuePair<TKey, TValue>> enumerator;
|
||||
}
|
||||
|
||||
// Token: 0x020000C9 RID: 201
|
||||
public sealed class Codec
|
||||
{
|
||||
// Token: 0x0600078E RID: 1934 RVA: 0x000179D9 File Offset: 0x00015BD9
|
||||
public Codec(FieldCodec<TKey> keyCodec, FieldCodec<TValue> valueCodec, uint mapTag)
|
||||
{
|
||||
this.keyCodec = keyCodec;
|
||||
this.valueCodec = valueCodec;
|
||||
this.mapTag = mapTag;
|
||||
}
|
||||
|
||||
// Token: 0x170001D8 RID: 472
|
||||
// (get) Token: 0x0600078F RID: 1935 RVA: 0x000179F6 File Offset: 0x00015BF6
|
||||
internal uint MapTag
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mapTag;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000306 RID: 774
|
||||
private readonly FieldCodec<TKey> keyCodec;
|
||||
|
||||
// Token: 0x04000307 RID: 775
|
||||
private readonly FieldCodec<TValue> valueCodec;
|
||||
|
||||
// Token: 0x04000308 RID: 776
|
||||
private readonly uint mapTag;
|
||||
|
||||
// Token: 0x020000DF RID: 223
|
||||
internal class MessageAdapter : IMessage
|
||||
{
|
||||
// Token: 0x170001FD RID: 509
|
||||
// (get) Token: 0x06000818 RID: 2072 RVA: 0x00018B77 File Offset: 0x00016D77
|
||||
// (set) Token: 0x06000819 RID: 2073 RVA: 0x00018B7F File Offset: 0x00016D7F
|
||||
internal TKey Key { get; set; }
|
||||
|
||||
// Token: 0x170001FE RID: 510
|
||||
// (get) Token: 0x0600081A RID: 2074 RVA: 0x00018B88 File Offset: 0x00016D88
|
||||
// (set) Token: 0x0600081B RID: 2075 RVA: 0x00018B90 File Offset: 0x00016D90
|
||||
internal TValue Value { get; set; }
|
||||
|
||||
// Token: 0x0600081C RID: 2076 RVA: 0x00018B99 File Offset: 0x00016D99
|
||||
internal MessageAdapter(MapField<TKey, TValue>.Codec codec)
|
||||
{
|
||||
this.codec = codec;
|
||||
}
|
||||
|
||||
// Token: 0x0600081D RID: 2077 RVA: 0x00018BA8 File Offset: 0x00016DA8
|
||||
internal void Reset()
|
||||
{
|
||||
this.Key = this.codec.keyCodec.DefaultValue;
|
||||
this.Value = this.codec.valueCodec.DefaultValue;
|
||||
}
|
||||
|
||||
// Token: 0x0600081E RID: 2078 RVA: 0x00018BD8 File Offset: 0x00016DD8
|
||||
public void MergeFrom(CodedInputStream input)
|
||||
{
|
||||
uint num;
|
||||
while ((num = input.ReadTag()) != 0U)
|
||||
{
|
||||
if (num == this.codec.keyCodec.Tag)
|
||||
{
|
||||
this.Key = this.codec.keyCodec.Read(input);
|
||||
}
|
||||
else if (num == this.codec.valueCodec.Tag)
|
||||
{
|
||||
this.Value = this.codec.valueCodec.Read(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
input.SkipLastField();
|
||||
}
|
||||
}
|
||||
if (this.Value == null)
|
||||
{
|
||||
this.Value = this.codec.valueCodec.Read(new CodedInputStream(MapField<TKey, TValue>.Codec.MessageAdapter.ZeroLengthMessageStreamData));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600081F RID: 2079 RVA: 0x00018C7C File Offset: 0x00016E7C
|
||||
public void WriteTo(CodedOutputStream output)
|
||||
{
|
||||
this.codec.keyCodec.WriteTagAndValue(output, this.Key);
|
||||
this.codec.valueCodec.WriteTagAndValue(output, this.Value);
|
||||
}
|
||||
|
||||
// Token: 0x06000820 RID: 2080 RVA: 0x00018CAC File Offset: 0x00016EAC
|
||||
public int CalculateSize()
|
||||
{
|
||||
return this.codec.keyCodec.CalculateSizeWithTag(this.Key) + this.codec.valueCodec.CalculateSizeWithTag(this.Value);
|
||||
}
|
||||
|
||||
// Token: 0x170001FF RID: 511
|
||||
// (get) Token: 0x06000821 RID: 2081 RVA: 0x00018CDB File Offset: 0x00016EDB
|
||||
MessageDescriptor IMessage.Descriptor
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400038E RID: 910
|
||||
private static readonly byte[] ZeroLengthMessageStreamData = new byte[1];
|
||||
|
||||
// Token: 0x0400038F RID: 911
|
||||
private readonly MapField<TKey, TValue>.Codec codec;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x020000CA RID: 202
|
||||
private class MapView<T> : ICollection<T>, IEnumerable<T>, IEnumerable, ICollection
|
||||
{
|
||||
// Token: 0x06000790 RID: 1936 RVA: 0x000179FE File Offset: 0x00015BFE
|
||||
internal MapView(MapField<TKey, TValue> parent, Func<KeyValuePair<TKey, TValue>, T> projection, Func<T, bool> containsCheck)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.projection = projection;
|
||||
this.containsCheck = containsCheck;
|
||||
}
|
||||
|
||||
// Token: 0x170001D9 RID: 473
|
||||
// (get) Token: 0x06000791 RID: 1937 RVA: 0x00017A1B File Offset: 0x00015C1B
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parent.Count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001DA RID: 474
|
||||
// (get) Token: 0x06000792 RID: 1938 RVA: 0x0000324B File Offset: 0x0000144B
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001DB RID: 475
|
||||
// (get) Token: 0x06000793 RID: 1939 RVA: 0x0000761F File Offset: 0x0000581F
|
||||
public bool IsSynchronized
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170001DC RID: 476
|
||||
// (get) Token: 0x06000794 RID: 1940 RVA: 0x00017A28 File Offset: 0x00015C28
|
||||
public object SyncRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000795 RID: 1941 RVA: 0x00007624 File Offset: 0x00005824
|
||||
public void Add(T item)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000796 RID: 1942 RVA: 0x00007624 File Offset: 0x00005824
|
||||
public void Clear()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000797 RID: 1943 RVA: 0x00017A30 File Offset: 0x00015C30
|
||||
public bool Contains(T item)
|
||||
{
|
||||
return this.containsCheck(item);
|
||||
}
|
||||
|
||||
// Token: 0x06000798 RID: 1944 RVA: 0x00017A40 File Offset: 0x00015C40
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
if (arrayIndex < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("arrayIndex");
|
||||
}
|
||||
if (arrayIndex + this.Count >= array.Length)
|
||||
{
|
||||
throw new ArgumentException("Not enough space in the array", "array");
|
||||
}
|
||||
foreach (T t in this)
|
||||
{
|
||||
array[arrayIndex++] = t;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000799 RID: 1945 RVA: 0x00017ABC File Offset: 0x00015CBC
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return this.parent.list.Select(this.projection).GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600079A RID: 1946 RVA: 0x00007624 File Offset: 0x00005824
|
||||
public bool Remove(T item)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
// Token: 0x0600079B RID: 1947 RVA: 0x00017AD9 File Offset: 0x00015CD9
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600079C RID: 1948 RVA: 0x00017AE4 File Offset: 0x00015CE4
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
if (index + this.Count >= array.Length)
|
||||
{
|
||||
throw new ArgumentException("Not enough space in the array", "array");
|
||||
}
|
||||
foreach (T t in this)
|
||||
{
|
||||
array.SetValue(t, index++);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000309 RID: 777
|
||||
private readonly MapField<TKey, TValue> parent;
|
||||
|
||||
// Token: 0x0400030A RID: 778
|
||||
private readonly Func<KeyValuePair<TKey, TValue>, T> projection;
|
||||
|
||||
// Token: 0x0400030B RID: 779
|
||||
private readonly Func<T, bool> containsCheck;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user