scripts
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace UnityEngine.Serialization
|
||||
{
|
||||
// Token: 0x020004EF RID: 1263
|
||||
internal class DictionarySerializationSurrogate<TKey, TValue> : ISerializationSurrogate
|
||||
{
|
||||
// Token: 0x06003C32 RID: 15410 RVA: 0x0006A070 File Offset: 0x00068270
|
||||
public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
Dictionary<TKey, TValue> dictionary = (Dictionary<TKey, TValue>)obj;
|
||||
dictionary.GetObjectData(info, context);
|
||||
}
|
||||
|
||||
// Token: 0x06003C33 RID: 15411 RVA: 0x0006A090 File Offset: 0x00068290
|
||||
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
|
||||
{
|
||||
IEqualityComparer<TKey> equalityComparer = (IEqualityComparer<TKey>)info.GetValue("Comparer", typeof(IEqualityComparer<TKey>));
|
||||
Dictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>(equalityComparer);
|
||||
if (info.MemberCount > 3)
|
||||
{
|
||||
KeyValuePair<TKey, TValue>[] array = (KeyValuePair<TKey, TValue>[])info.GetValue("KeyValuePairs", typeof(KeyValuePair<TKey, TValue>[]));
|
||||
if (array != null)
|
||||
{
|
||||
foreach (KeyValuePair<TKey, TValue> keyValuePair in array)
|
||||
{
|
||||
dictionary.Add(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user