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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace UnityEngine.Serialization
|
||||
{
|
||||
// Token: 0x020004EC RID: 1260
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
|
||||
[RequiredByNativeCode]
|
||||
public class FormerlySerializedAsAttribute : Attribute
|
||||
{
|
||||
// Token: 0x06003C26 RID: 15398 RVA: 0x00069E74 File Offset: 0x00068074
|
||||
public FormerlySerializedAsAttribute(string oldName)
|
||||
{
|
||||
this.m_oldName = oldName;
|
||||
}
|
||||
|
||||
// Token: 0x17000D96 RID: 3478
|
||||
// (get) Token: 0x06003C27 RID: 15399 RVA: 0x00069E84 File Offset: 0x00068084
|
||||
public string oldName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_oldName;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04001250 RID: 4688
|
||||
private string m_oldName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace UnityEngine.Serialization
|
||||
{
|
||||
// Token: 0x020004EE RID: 1262
|
||||
internal class ListSerializationSurrogate : ISerializationSurrogate
|
||||
{
|
||||
// Token: 0x06003C2D RID: 15405 RVA: 0x00069F48 File Offset: 0x00068148
|
||||
public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
IList list = (IList)obj;
|
||||
info.AddValue("_size", list.Count);
|
||||
info.AddValue("_items", ListSerializationSurrogate.ArrayFromGenericList(list));
|
||||
info.AddValue("_version", 0);
|
||||
}
|
||||
|
||||
// Token: 0x06003C2E RID: 15406 RVA: 0x00069F8C File Offset: 0x0006818C
|
||||
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
|
||||
{
|
||||
IList list = (IList)Activator.CreateInstance(obj.GetType());
|
||||
int @int = info.GetInt32("_size");
|
||||
object obj2;
|
||||
if (@int == 0)
|
||||
{
|
||||
obj2 = list;
|
||||
}
|
||||
else
|
||||
{
|
||||
IEnumerator enumerator = ((IEnumerable)info.GetValue("_items", typeof(IEnumerable))).GetEnumerator();
|
||||
for (int i = 0; i < @int; i++)
|
||||
{
|
||||
if (!enumerator.MoveNext())
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
list.Add(enumerator.Current);
|
||||
}
|
||||
obj2 = list;
|
||||
}
|
||||
return obj2;
|
||||
}
|
||||
|
||||
// Token: 0x06003C2F RID: 15407 RVA: 0x0006A024 File Offset: 0x00068224
|
||||
private static Array ArrayFromGenericList(IList list)
|
||||
{
|
||||
Array array = Array.CreateInstance(list.GetType().GetGenericArguments()[0], list.Count);
|
||||
list.CopyTo(array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x04001251 RID: 4689
|
||||
public static readonly ISerializationSurrogate Default = new ListSerializationSurrogate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace UnityEngine.Serialization
|
||||
{
|
||||
// Token: 0x020004ED RID: 1261
|
||||
public class UnitySurrogateSelector : ISurrogateSelector
|
||||
{
|
||||
// Token: 0x06003C29 RID: 15401 RVA: 0x00069EA8 File Offset: 0x000680A8
|
||||
public ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
|
||||
{
|
||||
if (type.IsGenericType)
|
||||
{
|
||||
Type genericTypeDefinition = type.GetGenericTypeDefinition();
|
||||
if (genericTypeDefinition == typeof(List<>))
|
||||
{
|
||||
selector = this;
|
||||
return ListSerializationSurrogate.Default;
|
||||
}
|
||||
if (genericTypeDefinition == typeof(Dictionary<, >))
|
||||
{
|
||||
selector = this;
|
||||
Type type2 = typeof(DictionarySerializationSurrogate<, >).MakeGenericType(type.GetGenericArguments());
|
||||
return (ISerializationSurrogate)Activator.CreateInstance(type2);
|
||||
}
|
||||
}
|
||||
selector = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06003C2A RID: 15402 RVA: 0x00069F30 File Offset: 0x00068130
|
||||
public void ChainSelector(ISurrogateSelector selector)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x06003C2B RID: 15403 RVA: 0x00069F38 File Offset: 0x00068138
|
||||
public ISurrogateSelector GetNextSelector()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user