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
@@ -0,0 +1,25 @@
using System;
namespace System.Runtime.Serialization
{
// Token: 0x02000485 RID: 1157
internal class ArrayFixupRecord : BaseFixupRecord
{
// Token: 0x06002C1D RID: 11293 RVA: 0x00091558 File Offset: 0x0008F758
public ArrayFixupRecord(ObjectRecord objectToBeFixed, int index, ObjectRecord objectRequired)
: base(objectToBeFixed, objectRequired)
{
this._index = index;
}
// Token: 0x06002C1E RID: 11294 RVA: 0x0009156C File Offset: 0x0008F76C
protected override void FixupImpl(ObjectManager manager)
{
Array array = (Array)this.ObjectToBeFixed.ObjectInstance;
array.SetValue(this.ObjectRequired.ObjectInstance, this._index);
}
// Token: 0x04001110 RID: 4368
private int _index;
}
}
@@ -0,0 +1,53 @@
using System;
namespace System.Runtime.Serialization
{
// Token: 0x02000484 RID: 1156
internal abstract class BaseFixupRecord
{
// Token: 0x06002C1A RID: 11290 RVA: 0x00091494 File Offset: 0x0008F694
public BaseFixupRecord(ObjectRecord objectToBeFixed, ObjectRecord objectRequired)
{
this.ObjectToBeFixed = objectToBeFixed;
this.ObjectRequired = objectRequired;
}
// Token: 0x06002C1B RID: 11291 RVA: 0x000914AC File Offset: 0x0008F6AC
public bool DoFixup(ObjectManager manager, bool strict)
{
if (this.ObjectToBeFixed.IsRegistered && this.ObjectRequired.IsInstanceReady)
{
this.FixupImpl(manager);
return true;
}
if (!strict)
{
return false;
}
if (!this.ObjectToBeFixed.IsRegistered)
{
throw new SerializationException("An object with ID " + this.ObjectToBeFixed.ObjectID + " was included in a fixup, but it has not been registered");
}
if (!this.ObjectRequired.IsRegistered)
{
throw new SerializationException("An object with ID " + this.ObjectRequired.ObjectID + " was included in a fixup, but it has not been registered");
}
return false;
}
// Token: 0x06002C1C RID: 11292
protected abstract void FixupImpl(ObjectManager manager);
// Token: 0x0400110C RID: 4364
protected internal ObjectRecord ObjectToBeFixed;
// Token: 0x0400110D RID: 4365
protected internal ObjectRecord ObjectRequired;
// Token: 0x0400110E RID: 4366
public BaseFixupRecord NextSameContainer;
// Token: 0x0400110F RID: 4367
public BaseFixupRecord NextSameRequired;
}
}
@@ -0,0 +1,24 @@
using System;
namespace System.Runtime.Serialization
{
// Token: 0x02000488 RID: 1160
internal class DelayedFixupRecord : BaseFixupRecord
{
// Token: 0x06002C23 RID: 11299 RVA: 0x0009160C File Offset: 0x0008F80C
public DelayedFixupRecord(ObjectRecord objectToBeFixed, string memberName, ObjectRecord objectRequired)
: base(objectToBeFixed, objectRequired)
{
this._memberName = memberName;
}
// Token: 0x06002C24 RID: 11300 RVA: 0x00091620 File Offset: 0x0008F820
protected override void FixupImpl(ObjectManager manager)
{
this.ObjectToBeFixed.SetMemberValue(manager, this._memberName, this.ObjectRequired.ObjectInstance);
}
// Token: 0x04001113 RID: 4371
public string _memberName;
}
}
@@ -0,0 +1,25 @@
using System;
using System.Reflection;
namespace System.Runtime.Serialization
{
// Token: 0x02000487 RID: 1159
internal class FixupRecord : BaseFixupRecord
{
// Token: 0x06002C21 RID: 11297 RVA: 0x000915D8 File Offset: 0x0008F7D8
public FixupRecord(ObjectRecord objectToBeFixed, MemberInfo member, ObjectRecord objectRequired)
: base(objectToBeFixed, objectRequired)
{
this._member = member;
}
// Token: 0x06002C22 RID: 11298 RVA: 0x000915EC File Offset: 0x0008F7EC
protected override void FixupImpl(ObjectManager manager)
{
this.ObjectToBeFixed.SetMemberValue(manager, this._member, this.ObjectRequired.ObjectInstance);
}
// Token: 0x04001112 RID: 4370
public MemberInfo _member;
}
}
@@ -0,0 +1,290 @@
using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Provides base functionality for the common language runtime serialization formatters.</summary>
// Token: 0x02000478 RID: 1144
[CLSCompliant(false)]
[ComVisible(true)]
[Serializable]
public abstract class Formatter : IFormatter
{
/// <summary>When overridden in a derived class, gets or sets the <see cref="T:System.Runtime.Serialization.SerializationBinder" /> used with the current formatter.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.SerializationBinder" /> used with the current formatter.</returns>
// Token: 0x17000894 RID: 2196
// (get) Token: 0x06002BA7 RID: 11175
// (set) Token: 0x06002BA8 RID: 11176
public abstract SerializationBinder Binder { get; set; }
/// <summary>When overridden in a derived class, gets or sets the <see cref="T:System.Runtime.Serialization.StreamingContext" /> used for the current serialization.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.StreamingContext" /> used for the current serialization.</returns>
// Token: 0x17000895 RID: 2197
// (get) Token: 0x06002BA9 RID: 11177
// (set) Token: 0x06002BAA RID: 11178
public abstract StreamingContext Context { get; set; }
/// <summary>When overridden in a derived class, gets or sets the <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> used with the current formatter.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> used with the current formatter.</returns>
// Token: 0x17000896 RID: 2198
// (get) Token: 0x06002BAB RID: 11179
// (set) Token: 0x06002BAC RID: 11180
public abstract ISurrogateSelector SurrogateSelector { get; set; }
/// <summary>When overridden in a derived class, deserializes the stream attached to the formatter when it was created, creating a graph of objects identical to the graph originally serialized into that stream.</summary>
/// <returns>The top object of the deserialized graph of objects.</returns>
/// <param name="serializationStream">The stream to deserialize. </param>
// Token: 0x06002BAD RID: 11181
public abstract object Deserialize(Stream serializationStream);
/// <summary>Returns the next object to serialize, from the formatter's internal work queue.</summary>
/// <returns>The next object to serialize.</returns>
/// <param name="objID">The ID assigned to the current object during serialization. </param>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The next object retrieved from the work queue did not have an assigned ID. </exception>
// Token: 0x06002BAE RID: 11182 RVA: 0x00090350 File Offset: 0x0008E550
protected virtual object GetNext(out long objID)
{
if (this.m_objectQueue.Count == 0)
{
objID = 0L;
return null;
}
object obj = this.m_objectQueue.Dequeue();
bool flag;
objID = this.m_idGenerator.HasId(obj, out flag);
return obj;
}
/// <summary>Schedules an object for later serialization.</summary>
/// <returns>The object ID assigned to the object.</returns>
/// <param name="obj">The object to schedule for serialization. </param>
// Token: 0x06002BAF RID: 11183 RVA: 0x00090390 File Offset: 0x0008E590
protected virtual long Schedule(object obj)
{
if (obj == null)
{
return 0L;
}
bool flag;
long id = this.m_idGenerator.GetId(obj, out flag);
if (flag)
{
this.m_objectQueue.Enqueue(obj);
}
return id;
}
/// <summary>When overridden in a derived class, serializes the graph of objects with the specified root to the stream already attached to the formatter.</summary>
/// <param name="serializationStream">The stream to which the objects are serialized. </param>
/// <param name="graph">The object at the root of the graph to serialize. </param>
// Token: 0x06002BB0 RID: 11184
public abstract void Serialize(Stream serializationStream, object graph);
/// <summary>When overridden in a derived class, writes an array to the stream already attached to the formatter.</summary>
/// <param name="obj">The array to write. </param>
/// <param name="name">The name of the array. </param>
/// <param name="memberType">The type of elements that the array holds. </param>
// Token: 0x06002BB1 RID: 11185
protected abstract void WriteArray(object obj, string name, Type memberType);
/// <summary>When overridden in a derived class, writes a Boolean value to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB2 RID: 11186
protected abstract void WriteBoolean(bool val, string name);
/// <summary>When overridden in a derived class, writes an 8-bit unsigned integer to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB3 RID: 11187
protected abstract void WriteByte(byte val, string name);
/// <summary>When overridden in a derived class, writes a Unicode character to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB4 RID: 11188
protected abstract void WriteChar(char val, string name);
/// <summary>When overridden in a derived class, writes a <see cref="T:System.DateTime" /> value to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB5 RID: 11189
protected abstract void WriteDateTime(DateTime val, string name);
/// <summary>When overridden in a derived class, writes a <see cref="T:System.Decimal" /> value to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB6 RID: 11190
protected abstract void WriteDecimal(decimal val, string name);
/// <summary>When overridden in a derived class, writes a double-precision floating-point number to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB7 RID: 11191
protected abstract void WriteDouble(double val, string name);
/// <summary>When overridden in a derived class, writes a 16-bit signed integer to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB8 RID: 11192
protected abstract void WriteInt16(short val, string name);
/// <summary>When overridden in a derived class, writes a 32-bit signed integer to the stream.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BB9 RID: 11193
protected abstract void WriteInt32(int val, string name);
/// <summary>When overridden in a derived class, writes a 64-bit signed integer to the stream.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BBA RID: 11194
protected abstract void WriteInt64(long val, string name);
/// <summary>Inspects the type of data received, and calls the appropriate Write method to perform the write to the stream already attached to the formatter.</summary>
/// <param name="memberName">The name of the member to serialize. </param>
/// <param name="data">The object to write to the stream attached to the formatter. </param>
// Token: 0x06002BBB RID: 11195 RVA: 0x000903C8 File Offset: 0x0008E5C8
protected virtual void WriteMember(string memberName, object data)
{
if (data == null)
{
this.WriteObjectRef(data, memberName, typeof(object));
}
Type type = data.GetType();
if (type.IsArray)
{
this.WriteArray(data, memberName, type);
}
else if (type == typeof(bool))
{
this.WriteBoolean((bool)data, memberName);
}
else if (type == typeof(byte))
{
this.WriteByte((byte)data, memberName);
}
else if (type == typeof(char))
{
this.WriteChar((char)data, memberName);
}
else if (type == typeof(DateTime))
{
this.WriteDateTime((DateTime)data, memberName);
}
else if (type == typeof(decimal))
{
this.WriteDecimal((decimal)data, memberName);
}
else if (type == typeof(double))
{
this.WriteDouble((double)data, memberName);
}
else if (type == typeof(short))
{
this.WriteInt16((short)data, memberName);
}
else if (type == typeof(int))
{
this.WriteInt32((int)data, memberName);
}
else if (type == typeof(long))
{
this.WriteInt64((long)data, memberName);
}
else if (type == typeof(sbyte))
{
this.WriteSByte((sbyte)data, memberName);
}
else if (type == typeof(float))
{
this.WriteSingle((float)data, memberName);
}
else if (type == typeof(TimeSpan))
{
this.WriteTimeSpan((TimeSpan)data, memberName);
}
else if (type == typeof(ushort))
{
this.WriteUInt16((ushort)data, memberName);
}
else if (type == typeof(uint))
{
this.WriteUInt32((uint)data, memberName);
}
else if (type == typeof(ulong))
{
this.WriteUInt64((ulong)data, memberName);
}
else if (type.IsValueType)
{
this.WriteValueType(data, memberName, type);
}
this.WriteObjectRef(data, memberName, type);
}
/// <summary>When overridden in a derived class, writes an object reference to the stream already attached to the formatter.</summary>
/// <param name="obj">The object reference to write. </param>
/// <param name="name">The name of the member. </param>
/// <param name="memberType">The type of object the reference points to. </param>
// Token: 0x06002BBC RID: 11196
protected abstract void WriteObjectRef(object obj, string name, Type memberType);
/// <summary>When overridden in a derived class, writes an 8-bit signed integer to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BBD RID: 11197
[CLSCompliant(false)]
protected abstract void WriteSByte(sbyte val, string name);
/// <summary>When overridden in a derived class, writes a single-precision floating-point number to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BBE RID: 11198
protected abstract void WriteSingle(float val, string name);
/// <summary>When overridden in a derived class, writes a <see cref="T:System.TimeSpan" /> value to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BBF RID: 11199
protected abstract void WriteTimeSpan(TimeSpan val, string name);
/// <summary>When overridden in a derived class, writes a 16-bit unsigned integer to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BC0 RID: 11200
[CLSCompliant(false)]
protected abstract void WriteUInt16(ushort val, string name);
/// <summary>When overridden in a derived class, writes a 32-bit unsigned integer to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BC1 RID: 11201
[CLSCompliant(false)]
protected abstract void WriteUInt32(uint val, string name);
/// <summary>When overridden in a derived class, writes a 64-bit unsigned integer to the stream already attached to the formatter.</summary>
/// <param name="val">The value to write. </param>
/// <param name="name">The name of the member. </param>
// Token: 0x06002BC2 RID: 11202
[CLSCompliant(false)]
protected abstract void WriteUInt64(ulong val, string name);
/// <summary>When overridden in a derived class, writes a value of the given type to the stream already attached to the formatter.</summary>
/// <param name="obj">The object representing the value type. </param>
/// <param name="name">The name of the member. </param>
/// <param name="memberType">The <see cref="T:System.Type" /> of the value type. </param>
// Token: 0x06002BC3 RID: 11203
protected abstract void WriteValueType(object obj, string name, Type memberType);
/// <summary>Contains the <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" /> used with the current formatter.</summary>
// Token: 0x040010FD RID: 4349
protected ObjectIDGenerator m_idGenerator = new ObjectIDGenerator();
/// <summary>Contains a <see cref="T:System.Collections.Queue" /> of the objects left to serialize.</summary>
// Token: 0x040010FE RID: 4350
protected Queue m_objectQueue = new Queue();
}
}
@@ -0,0 +1,247 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Represents a base implementation of the <see cref="T:System.Runtime.Serialization.IFormatterConverter" /> interface that uses the <see cref="T:System.Convert" /> class and the <see cref="T:System.IConvertible" /> interface.</summary>
// Token: 0x02000479 RID: 1145
[ComVisible(true)]
public class FormatterConverter : IFormatterConverter
{
/// <summary>Converts a value to the given <see cref="T:System.Type" />.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <param name="type">The <see cref="T:System.Type" /> into which <paramref name="value" /> is converted. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BC5 RID: 11205 RVA: 0x00090630 File Offset: 0x0008E830
public object Convert(object value, Type type)
{
return global::System.Convert.ChangeType(value, type);
}
/// <summary>Converts a value to the given <see cref="T:System.TypeCode" />.</summary>
/// <returns>The converted <paramref name="value" />, or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <param name="typeCode">The <see cref="T:System.TypeCode" /> into which <paramref name="value" /> is converted. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BC6 RID: 11206 RVA: 0x0009063C File Offset: 0x0008E83C
public object Convert(object value, TypeCode typeCode)
{
return global::System.Convert.ChangeType(value, typeCode);
}
/// <summary>Converts a value to a <see cref="T:System.Boolean" />.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BC7 RID: 11207 RVA: 0x00090648 File Offset: 0x0008E848
public bool ToBoolean(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToBoolean(value);
}
/// <summary>Converts a value to an 8-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BC8 RID: 11208 RVA: 0x00090664 File Offset: 0x0008E864
public byte ToByte(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToByte(value);
}
/// <summary>Converts a value to a Unicode character.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BC9 RID: 11209 RVA: 0x00090680 File Offset: 0x0008E880
public char ToChar(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToChar(value);
}
/// <summary>Converts a value to a <see cref="T:System.DateTime" />.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BCA RID: 11210 RVA: 0x0009069C File Offset: 0x0008E89C
public DateTime ToDateTime(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToDateTime(value);
}
/// <summary>Converts a value to a <see cref="T:System.Decimal" />.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BCB RID: 11211 RVA: 0x000906B8 File Offset: 0x0008E8B8
public decimal ToDecimal(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToDecimal(value);
}
/// <summary>Converts a value to a double-precision floating-point number.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BCC RID: 11212 RVA: 0x000906D4 File Offset: 0x0008E8D4
public double ToDouble(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToDouble(value);
}
/// <summary>Converts a value to a 16-bit signed integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BCD RID: 11213 RVA: 0x000906F0 File Offset: 0x0008E8F0
public short ToInt16(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToInt16(value);
}
/// <summary>Converts a value to a 32-bit signed integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BCE RID: 11214 RVA: 0x0009070C File Offset: 0x0008E90C
public int ToInt32(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToInt32(value);
}
/// <summary>Converts a value to a 64-bit signed integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BCF RID: 11215 RVA: 0x00090728 File Offset: 0x0008E928
public long ToInt64(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToInt64(value);
}
/// <summary>Converts a value to a single-precision floating-point number.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BD0 RID: 11216 RVA: 0x00090744 File Offset: 0x0008E944
public float ToSingle(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToSingle(value);
}
/// <summary>Converts the specified object to a <see cref="T:System.String" />.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BD1 RID: 11217 RVA: 0x00090760 File Offset: 0x0008E960
public string ToString(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToString(value);
}
/// <summary>Converts a value to a <see cref="T:System.SByte" />.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BD2 RID: 11218 RVA: 0x0009077C File Offset: 0x0008E97C
[CLSCompliant(false)]
public sbyte ToSByte(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToSByte(value);
}
/// <summary>Converts a value to a 16-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BD3 RID: 11219 RVA: 0x00090798 File Offset: 0x0008E998
[CLSCompliant(false)]
public ushort ToUInt16(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToUInt16(value);
}
/// <summary>Converts a value to a 32-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BD4 RID: 11220 RVA: 0x000907B4 File Offset: 0x0008E9B4
[CLSCompliant(false)]
public uint ToUInt32(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToUInt32(value);
}
/// <summary>Converts a value to a 64-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" /> or null if the <paramref name="type" /> parameter is null.</returns>
/// <param name="value">The object to convert. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
// Token: 0x06002BD5 RID: 11221 RVA: 0x000907D0 File Offset: 0x0008E9D0
[CLSCompliant(false)]
public ulong ToUInt64(object value)
{
if (value == null)
{
throw new ArgumentNullException("value is null.");
}
return global::System.Convert.ToUInt64(value);
}
}
}
@@ -0,0 +1,271 @@
using System;
using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Lifetime;
using System.Runtime.Serialization.Formatters;
using System.Security;
namespace System.Runtime.Serialization
{
/// <summary>Provides static methods to aid with the implementation of a <see cref="T:System.Runtime.Serialization.Formatter" /> for serialization. This class cannot be inherited.</summary>
// Token: 0x0200047A RID: 1146
[ComVisible(true)]
public sealed class FormatterServices
{
// Token: 0x06002BD6 RID: 11222 RVA: 0x000907EC File Offset: 0x0008E9EC
private FormatterServices()
{
}
/// <summary>Extracts the data from the specified object and returns it as an array of objects.</summary>
/// <returns>An array of <see cref="T:System.Object" /> that contains data stored in <paramref name="members" /> and associated with <paramref name="obj" />.</returns>
/// <param name="obj">The object to write to the formatter. </param>
/// <param name="members">The members to extract from the object. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> or <paramref name="members" /> parameter is null.An element of <paramref name="members" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element of <paramref name="members" /> does not represent a field. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BD7 RID: 11223 RVA: 0x000907F4 File Offset: 0x0008E9F4
public static object[] GetObjectData(object obj, MemberInfo[] members)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (members == null)
{
throw new ArgumentNullException("members");
}
int num = members.Length;
object[] array = new object[num];
for (int i = 0; i < num; i++)
{
MemberInfo memberInfo = members[i];
if (memberInfo == null)
{
throw new ArgumentNullException(string.Format("members[{0}]", i));
}
if (memberInfo.MemberType != MemberTypes.Field)
{
throw new SerializationException(string.Format("members [{0}] is not a field.", i));
}
FieldInfo fieldInfo = memberInfo as FieldInfo;
array[i] = fieldInfo.GetValue(obj);
}
return array;
}
/// <summary>Gets all the serializable members for a class of the specified <see cref="T:System.Type" />.</summary>
/// <returns>An array of type <see cref="T:System.Reflection.MemberInfo" /> of the non-transient, non-static members.</returns>
/// <param name="type">The type being serialized. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BD8 RID: 11224 RVA: 0x00090898 File Offset: 0x0008EA98
public static MemberInfo[] GetSerializableMembers(Type type)
{
StreamingContext streamingContext = new StreamingContext(StreamingContextStates.All);
return FormatterServices.GetSerializableMembers(type, streamingContext);
}
/// <summary>Gets all the serializable members for a class of the specified <see cref="T:System.Type" /> and in the provided <see cref="T:System.Runtime.Serialization.StreamingContext" />.</summary>
/// <returns>An array of type <see cref="T:System.Reflection.MemberInfo" /> of the non-transient, non-static members.</returns>
/// <param name="type">The type being serialized or cloned. </param>
/// <param name="context">The context where the serialization occurs. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BD9 RID: 11225 RVA: 0x000908B8 File Offset: 0x0008EAB8
public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
ArrayList arrayList = new ArrayList();
for (Type type2 = type; type2 != null; type2 = type2.BaseType)
{
if (!type2.IsSerializable)
{
string text = string.Format("Type {0} in assembly {1} is not marked as serializable.", type2, type2.Assembly.FullName);
throw new SerializationException(text);
}
FormatterServices.GetFields(type, type2, arrayList);
}
MemberInfo[] array = new MemberInfo[arrayList.Count];
arrayList.CopyTo(array);
return array;
}
// Token: 0x06002BDA RID: 11226 RVA: 0x00090938 File Offset: 0x0008EB38
private static void GetFields(Type reflectedType, Type type, ArrayList fields)
{
FieldInfo[] fields2 = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (FieldInfo fieldInfo in fields2)
{
if (!fieldInfo.IsNotSerialized)
{
MonoField monoField = fieldInfo as MonoField;
if (monoField != null && reflectedType != type && !monoField.IsPublic)
{
string text = type.Name + "+" + monoField.Name;
fields.Add(monoField.Clone(text));
}
else
{
fields.Add(fieldInfo);
}
}
}
}
/// <summary>Looks up the <see cref="T:System.Type" /> of the specified object in the provided <see cref="T:System.Reflection.Assembly" />.</summary>
/// <returns>The <see cref="T:System.Type" /> of the object.</returns>
/// <param name="assem">The assembly where you want to look up the object. </param>
/// <param name="name">The name of the object. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="assem" /> parameter is null. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BDB RID: 11227 RVA: 0x000909CC File Offset: 0x0008EBCC
public static Type GetTypeFromAssembly(Assembly assem, string name)
{
if (assem == null)
{
throw new ArgumentNullException("assem");
}
if (name == null)
{
throw new ArgumentNullException("name");
}
return assem.GetType(name);
}
/// <summary>Creates a new instance of the specified object type.</summary>
/// <returns>A zeroed object of the specified type.</returns>
/// <param name="type">The type of object to create. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BDC RID: 11228 RVA: 0x000909F8 File Offset: 0x0008EBF8
public static object GetUninitializedObject(Type type)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (type == typeof(string))
{
throw new ArgumentException("Uninitialized Strings cannot be created.");
}
return ActivationServices.AllocateUninitializedClassInstance(type);
}
/// <summary>Populates the specified object with values for each field drawn from the data array of objects.</summary>
/// <returns>The newly populated object.</returns>
/// <param name="obj">The object to populate. </param>
/// <param name="members">An array of <see cref="T:System.Reflection.MemberInfo" /> that describes which fields and properties to populate. </param>
/// <param name="data">An array of <see cref="T:System.Object" /> that specifies the values for each field and property to populate. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" />, <paramref name="members" />, or <paramref name="data" /> parameter is null.An element of <paramref name="members" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="members" /> does not match the length of <paramref name="data" />. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element of <paramref name="members" /> is not an instance of <see cref="T:System.Reflection.FieldInfo" />. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BDD RID: 11229 RVA: 0x00090A38 File Offset: 0x0008EC38
public static object PopulateObjectMembers(object obj, MemberInfo[] members, object[] data)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (members == null)
{
throw new ArgumentNullException("members");
}
if (data == null)
{
throw new ArgumentNullException("data");
}
int num = members.Length;
if (num != data.Length)
{
throw new ArgumentException("different length in members and data");
}
for (int i = 0; i < num; i++)
{
MemberInfo memberInfo = members[i];
if (memberInfo == null)
{
throw new ArgumentNullException(string.Format("members[{0}]", i));
}
if (memberInfo.MemberType != MemberTypes.Field)
{
throw new SerializationException(string.Format("members [{0}] is not a field.", i));
}
FieldInfo fieldInfo = memberInfo as FieldInfo;
fieldInfo.SetValue(obj, data[i]);
}
return obj;
}
/// <summary>Determines whether the specified <see cref="T:System.Type" /> can be deserialized with the <see cref="T:System.Runtime.Serialization.Formatters.TypeFilterLevel" /> property set to Low.</summary>
/// <param name="t">The <see cref="T:System.Type" /> to check for the ability to deserialize. </param>
/// <param name="securityLevel">The <see cref="T:System.Runtime.Serialization.Formatters.TypeFilterLevel" /> property value. </param>
/// <exception cref="T:System.Security.SecurityException">The <paramref name="t" /> parameter is an advanced type and cannot be deserialized when the <see cref="T:System.Runtime.Serialization.Formatters.TypeFilterLevel" /> property is set to Low. </exception>
// Token: 0x06002BDE RID: 11230 RVA: 0x00090AF8 File Offset: 0x0008ECF8
public static void CheckTypeSecurity(Type t, TypeFilterLevel securityLevel)
{
if (securityLevel == TypeFilterLevel.Full)
{
return;
}
FormatterServices.CheckNotAssignable(typeof(DelegateSerializationHolder), t);
FormatterServices.CheckNotAssignable(typeof(ISponsor), t);
FormatterServices.CheckNotAssignable(typeof(IEnvoyInfo), t);
FormatterServices.CheckNotAssignable(typeof(ObjRef), t);
}
// Token: 0x06002BDF RID: 11231 RVA: 0x00090B50 File Offset: 0x0008ED50
private static void CheckNotAssignable(Type basetype, Type type)
{
if (basetype.IsAssignableFrom(type))
{
string text = "Type " + basetype + " and the types derived from it";
string text2 = text;
text = string.Concat(new object[] { text2, " (such as ", type, ") are not permitted to be deserialized at this security level" });
throw new SecurityException(text);
}
}
/// <summary>Creates a new instance of the specified object type.</summary>
/// <returns>A zeroed object of the specified type.</returns>
/// <param name="type">The type of object to create. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="type" /> parameter is not a valid common language runtime type. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002BE0 RID: 11232 RVA: 0x00090BA8 File Offset: 0x0008EDA8
public static object GetSafeUninitializedObject(Type type)
{
return FormatterServices.GetUninitializedObject(type);
}
// Token: 0x040010FF RID: 4351
private const BindingFlags fieldFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
}
}
@@ -0,0 +1,15 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200045E RID: 1118
internal enum ArrayStructure : byte
{
// Token: 0x0400108E RID: 4238
SingleDimensional,
// Token: 0x0400108F RID: 4239
Jagged,
// Token: 0x04001090 RID: 4240
MultiDimensional
}
}
@@ -0,0 +1,148 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200045B RID: 1115
internal class BinaryCommon
{
// Token: 0x06002AE8 RID: 10984 RVA: 0x0008B30C File Offset: 0x0008950C
static BinaryCommon()
{
BinaryCommon._typeCodesToType[1] = typeof(bool);
BinaryCommon._typeCodesToType[2] = typeof(byte);
BinaryCommon._typeCodesToType[3] = typeof(char);
BinaryCommon._typeCodesToType[12] = typeof(TimeSpan);
BinaryCommon._typeCodesToType[13] = typeof(DateTime);
BinaryCommon._typeCodesToType[5] = typeof(decimal);
BinaryCommon._typeCodesToType[6] = typeof(double);
BinaryCommon._typeCodesToType[7] = typeof(short);
BinaryCommon._typeCodesToType[8] = typeof(int);
BinaryCommon._typeCodesToType[9] = typeof(long);
BinaryCommon._typeCodesToType[10] = typeof(sbyte);
BinaryCommon._typeCodesToType[11] = typeof(float);
BinaryCommon._typeCodesToType[14] = typeof(ushort);
BinaryCommon._typeCodesToType[15] = typeof(uint);
BinaryCommon._typeCodesToType[16] = typeof(ulong);
BinaryCommon._typeCodesToType[17] = null;
BinaryCommon._typeCodesToType[18] = typeof(string);
BinaryCommon._typeCodeMap = new byte[30];
BinaryCommon._typeCodeMap[3] = 1;
BinaryCommon._typeCodeMap[6] = 2;
BinaryCommon._typeCodeMap[4] = 3;
BinaryCommon._typeCodeMap[16] = 13;
BinaryCommon._typeCodeMap[15] = 5;
BinaryCommon._typeCodeMap[14] = 6;
BinaryCommon._typeCodeMap[7] = 7;
BinaryCommon._typeCodeMap[9] = 8;
BinaryCommon._typeCodeMap[11] = 9;
BinaryCommon._typeCodeMap[5] = 10;
BinaryCommon._typeCodeMap[13] = 11;
BinaryCommon._typeCodeMap[8] = 14;
BinaryCommon._typeCodeMap[10] = 15;
BinaryCommon._typeCodeMap[12] = 16;
BinaryCommon._typeCodeMap[18] = 18;
string text = Environment.GetEnvironmentVariable("MONO_REFLECTION_SERIALIZER");
if (text == null)
{
text = "no";
}
BinaryCommon.UseReflectionSerialization = text != "no";
}
// Token: 0x06002AE9 RID: 10985 RVA: 0x0008B520 File Offset: 0x00089720
public static bool IsPrimitive(Type type)
{
return (type.IsPrimitive && type != typeof(IntPtr)) || type == typeof(DateTime) || type == typeof(TimeSpan) || type == typeof(decimal);
}
// Token: 0x06002AEA RID: 10986 RVA: 0x0008B578 File Offset: 0x00089778
public static byte GetTypeCode(Type type)
{
if (type == typeof(TimeSpan))
{
return 12;
}
return BinaryCommon._typeCodeMap[(int)Type.GetTypeCode(type)];
}
// Token: 0x06002AEB RID: 10987 RVA: 0x0008B59C File Offset: 0x0008979C
public static Type GetTypeFromCode(int code)
{
return BinaryCommon._typeCodesToType[code];
}
// Token: 0x06002AEC RID: 10988 RVA: 0x0008B5A8 File Offset: 0x000897A8
public static void CheckSerializable(Type type, ISurrogateSelector selector, StreamingContext context)
{
if (type.IsSerializable || type.IsInterface)
{
return;
}
if (selector != null && selector.GetSurrogate(type, context, out selector) != null)
{
return;
}
throw new SerializationException("Type " + type + " is not marked as Serializable.");
}
// Token: 0x06002AED RID: 10989 RVA: 0x0008B5F8 File Offset: 0x000897F8
public static void SwapBytes(byte[] byteArray, int size, int dataSize)
{
if (dataSize == 8)
{
for (int i = 0; i < size; i += 8)
{
byte b = byteArray[i];
byteArray[i] = byteArray[i + 7];
byteArray[i + 7] = b;
b = byteArray[i + 1];
byteArray[i + 1] = byteArray[i + 6];
byteArray[i + 6] = b;
b = byteArray[i + 2];
byteArray[i + 2] = byteArray[i + 5];
byteArray[i + 5] = b;
b = byteArray[i + 3];
byteArray[i + 3] = byteArray[i + 4];
byteArray[i + 4] = b;
}
}
else if (dataSize == 4)
{
for (int j = 0; j < size; j += 4)
{
byte b = byteArray[j];
byteArray[j] = byteArray[j + 3];
byteArray[j + 3] = b;
b = byteArray[j + 1];
byteArray[j + 1] = byteArray[j + 2];
byteArray[j + 2] = b;
}
}
else if (dataSize == 2)
{
for (int k = 0; k < size; k += 2)
{
byte b = byteArray[k];
byteArray[k] = byteArray[k + 1];
byteArray[k + 1] = b;
}
}
}
// Token: 0x04001068 RID: 4200
public static byte[] BinaryHeader = new byte[]
{
0, 1, 0, 0, 0, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, 1,
0, 0, 0, 0, 0, 0, 0
};
// Token: 0x04001069 RID: 4201
private static Type[] _typeCodesToType = new Type[19];
// Token: 0x0400106A RID: 4202
private static byte[] _typeCodeMap;
// Token: 0x0400106B RID: 4203
public static bool UseReflectionSerialization = false;
}
}
@@ -0,0 +1,55 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200045C RID: 1116
internal enum BinaryElement : byte
{
// Token: 0x0400106D RID: 4205
Header,
// Token: 0x0400106E RID: 4206
RefTypeObject,
// Token: 0x0400106F RID: 4207
UntypedRuntimeObject,
// Token: 0x04001070 RID: 4208
UntypedExternalObject,
// Token: 0x04001071 RID: 4209
RuntimeObject,
// Token: 0x04001072 RID: 4210
ExternalObject,
// Token: 0x04001073 RID: 4211
String,
// Token: 0x04001074 RID: 4212
GenericArray,
// Token: 0x04001075 RID: 4213
BoxedPrimitiveTypeValue,
// Token: 0x04001076 RID: 4214
ObjectReference,
// Token: 0x04001077 RID: 4215
NullValue,
// Token: 0x04001078 RID: 4216
End,
// Token: 0x04001079 RID: 4217
Assembly,
// Token: 0x0400107A RID: 4218
ArrayFiller8b,
// Token: 0x0400107B RID: 4219
ArrayFiller32b,
// Token: 0x0400107C RID: 4220
ArrayOfPrimitiveType,
// Token: 0x0400107D RID: 4221
ArrayOfObject,
// Token: 0x0400107E RID: 4222
ArrayOfString,
// Token: 0x0400107F RID: 4223
Method,
// Token: 0x04001080 RID: 4224
_Unknown4,
// Token: 0x04001081 RID: 4225
_Unknown5,
// Token: 0x04001082 RID: 4226
MethodCall,
// Token: 0x04001083 RID: 4227
MethodResponse
}
}
@@ -0,0 +1,378 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Serialization.Formatters.Binary
{
/// <summary>Serializes and deserializes an object, or an entire graph of connected objects, in binary format.</summary>
// Token: 0x02000462 RID: 1122
[ComVisible(true)]
public sealed class BinaryFormatter : IRemotingFormatter, IFormatter
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> class with default values.</summary>
// Token: 0x06002AEE RID: 10990 RVA: 0x0008B6E8 File Offset: 0x000898E8
public BinaryFormatter()
{
this.surrogate_selector = BinaryFormatter.DefaultSurrogateSelector;
this.context = new StreamingContext(StreamingContextStates.All);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> class with a given surrogate selector and streaming context.</summary>
/// <param name="selector">The <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> to use. Can be null. </param>
/// <param name="context">The source and destination for the serialized data. </param>
// Token: 0x06002AEF RID: 10991 RVA: 0x0008B71C File Offset: 0x0008991C
public BinaryFormatter(ISurrogateSelector selector, StreamingContext context)
{
this.surrogate_selector = selector;
this.context = context;
}
// Token: 0x17000874 RID: 2164
// (get) Token: 0x06002AF0 RID: 10992 RVA: 0x0008B74C File Offset: 0x0008994C
// (set) Token: 0x06002AF1 RID: 10993 RVA: 0x0008B754 File Offset: 0x00089954
public static ISurrogateSelector DefaultSurrogateSelector { get; set; }
/// <summary>Gets or sets the behavior of the deserializer with regards to finding and loading assemblies.</summary>
/// <returns>One of the <see cref="T:System.Runtime.Serialization.Formatters.FormatterAssemblyStyle" /> values that specifies the deserializer behavior.</returns>
// Token: 0x17000875 RID: 2165
// (get) Token: 0x06002AF2 RID: 10994 RVA: 0x0008B75C File Offset: 0x0008995C
// (set) Token: 0x06002AF3 RID: 10995 RVA: 0x0008B764 File Offset: 0x00089964
public FormatterAssemblyStyle AssemblyFormat
{
get
{
return this.assembly_format;
}
set
{
this.assembly_format = value;
}
}
/// <summary>Gets or sets an object of type <see cref="T:System.Runtime.Serialization.SerializationBinder" /> that controls the binding of a serialized object to a type.</summary>
/// <returns>The serialization binder to use with this formatter.</returns>
// Token: 0x17000876 RID: 2166
// (get) Token: 0x06002AF4 RID: 10996 RVA: 0x0008B770 File Offset: 0x00089970
// (set) Token: 0x06002AF5 RID: 10997 RVA: 0x0008B778 File Offset: 0x00089978
public SerializationBinder Binder
{
get
{
return this.binder;
}
set
{
this.binder = value;
}
}
/// <summary>Gets or sets the <see cref="T:System.Runtime.Serialization.StreamingContext" /> for this formatter.</summary>
/// <returns>The streaming context to use with this formatter.</returns>
// Token: 0x17000877 RID: 2167
// (get) Token: 0x06002AF6 RID: 10998 RVA: 0x0008B784 File Offset: 0x00089984
// (set) Token: 0x06002AF7 RID: 10999 RVA: 0x0008B78C File Offset: 0x0008998C
public StreamingContext Context
{
get
{
return this.context;
}
set
{
this.context = value;
}
}
/// <summary>Gets or sets a <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> that controls type substitution during serialization and deserialization.</summary>
/// <returns>The surrogate selector to use with this formatter.</returns>
// Token: 0x17000878 RID: 2168
// (get) Token: 0x06002AF8 RID: 11000 RVA: 0x0008B798 File Offset: 0x00089998
// (set) Token: 0x06002AF9 RID: 11001 RVA: 0x0008B7A0 File Offset: 0x000899A0
public ISurrogateSelector SurrogateSelector
{
get
{
return this.surrogate_selector;
}
set
{
this.surrogate_selector = value;
}
}
/// <summary>Gets or sets the format in which type descriptions are laid out in the serialized stream.</summary>
/// <returns>The style of type layouts to use.</returns>
// Token: 0x17000879 RID: 2169
// (get) Token: 0x06002AFA RID: 11002 RVA: 0x0008B7AC File Offset: 0x000899AC
// (set) Token: 0x06002AFB RID: 11003 RVA: 0x0008B7B4 File Offset: 0x000899B4
public FormatterTypeStyle TypeFormat
{
get
{
return this.type_format;
}
set
{
this.type_format = value;
}
}
/// <summary>Gets or sets the <see cref="T:System.Runtime.Serialization.Formatters.TypeFilterLevel" /> of automatic deserialization the <see cref="T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> performs.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.Formatters.TypeFilterLevel" /> that represents the current automatic deserialization level.</returns>
// Token: 0x1700087A RID: 2170
// (get) Token: 0x06002AFC RID: 11004 RVA: 0x0008B7C0 File Offset: 0x000899C0
// (set) Token: 0x06002AFD RID: 11005 RVA: 0x0008B7C8 File Offset: 0x000899C8
public TypeFilterLevel FilterLevel
{
get
{
return this.filter_level;
}
set
{
this.filter_level = value;
}
}
/// <summary>Deserializes the specified stream into an object graph.</summary>
/// <returns>The top (root) of the object graph.</returns>
/// <param name="serializationStream">The stream from which to deserialize the object graph. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="serializationStream" /> supports seeking, but its length is 0. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x06002AFE RID: 11006 RVA: 0x0008B7D4 File Offset: 0x000899D4
public object Deserialize(Stream serializationStream)
{
return this.NoCheckDeserialize(serializationStream, null);
}
/// <summary>Deserializes the specified stream into an object graph. The provided <see cref="T:System.Runtime.Remoting.Messaging.HeaderHandler" /> handles any headers in that stream.</summary>
/// <returns>The deserialized object or the top object (root) of the object graph.</returns>
/// <param name="serializationStream">The stream from which to deserialize the object graph. </param>
/// <param name="handler">The <see cref="T:System.Runtime.Remoting.Messaging.HeaderHandler" /> that handles any headers in the <paramref name="serializationStream" />. Can be null. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="serializationStream" /> supports seeking, but its length is 0. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x06002AFF RID: 11007 RVA: 0x0008B7E0 File Offset: 0x000899E0
public object Deserialize(Stream serializationStream, HeaderHandler handler)
{
return this.NoCheckDeserialize(serializationStream, handler);
}
// Token: 0x06002B00 RID: 11008 RVA: 0x0008B7EC File Offset: 0x000899EC
private object NoCheckDeserialize(Stream serializationStream, HeaderHandler handler)
{
if (serializationStream == null)
{
throw new ArgumentNullException("serializationStream");
}
if (serializationStream.CanSeek && serializationStream.Length == 0L)
{
throw new SerializationException("serializationStream supports seeking, but its length is 0");
}
BinaryReader binaryReader = new BinaryReader(serializationStream);
bool flag;
this.ReadBinaryHeader(binaryReader, out flag);
BinaryElement binaryElement = (BinaryElement)binaryReader.Read();
if (binaryElement == BinaryElement.MethodCall)
{
return MessageFormatter.ReadMethodCall(binaryElement, binaryReader, flag, handler, this);
}
if (binaryElement == BinaryElement.MethodResponse)
{
return MessageFormatter.ReadMethodResponse(binaryElement, binaryReader, flag, handler, null, this);
}
ObjectReader objectReader = new ObjectReader(this);
object obj;
Header[] array;
objectReader.ReadObjectGraph(binaryElement, binaryReader, flag, out obj, out array);
if (handler != null)
{
handler(array);
}
return obj;
}
/// <summary>Deserializes a response to a remote method call from the provided <see cref="T:System.IO.Stream" />.</summary>
/// <returns>The deserialized response to the remote method call.</returns>
/// <param name="serializationStream">The stream from which to deserialize the object graph. </param>
/// <param name="handler">The <see cref="T:System.Runtime.Remoting.Messaging.HeaderHandler" /> that handles any headers in the <paramref name="serializationStream" />. Can be null. </param>
/// <param name="methodCallMessage">The <see cref="T:System.Runtime.Remoting.Messaging.IMethodCallMessage" /> that contains details about where the call came from. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="serializationStream" /> supports seeking, but its length is 0. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x06002B01 RID: 11009 RVA: 0x0008B890 File Offset: 0x00089A90
public object DeserializeMethodResponse(Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage)
{
return this.NoCheckDeserializeMethodResponse(serializationStream, handler, methodCallMessage);
}
// Token: 0x06002B02 RID: 11010 RVA: 0x0008B89C File Offset: 0x00089A9C
private object NoCheckDeserializeMethodResponse(Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage)
{
if (serializationStream == null)
{
throw new ArgumentNullException("serializationStream");
}
if (serializationStream.CanSeek && serializationStream.Length == 0L)
{
throw new SerializationException("serializationStream supports seeking, but its length is 0");
}
BinaryReader binaryReader = new BinaryReader(serializationStream);
bool flag;
this.ReadBinaryHeader(binaryReader, out flag);
return MessageFormatter.ReadMethodResponse(binaryReader, flag, handler, methodCallMessage, this);
}
/// <summary>Serializes the object, or graph of objects with the specified top (root), to the given stream.</summary>
/// <param name="serializationStream">The stream to which the graph is to be serialized. </param>
/// <param name="graph">The object at the root of the graph to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. -or-The <paramref name="graph" /> is null.</exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An error has occurred during serialization, such as if an object in the <paramref name="graph" /> parameter is not marked as serializable. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// </PermissionSet>
// Token: 0x06002B03 RID: 11011 RVA: 0x0008B8F8 File Offset: 0x00089AF8
public void Serialize(Stream serializationStream, object graph)
{
this.Serialize(serializationStream, graph, null);
}
/// <summary>Serializes the object, or graph of objects with the specified top (root), to the given stream attaching the provided headers.</summary>
/// <param name="serializationStream">The stream to which the object is to be serialized. </param>
/// <param name="graph">The object at the root of the graph to serialize. </param>
/// <param name="headers">Remoting headers to include in the serialization. Can be null. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An error has occurred during serialization, such as if an object in the <paramref name="graph" /> parameter is not marked as serializable. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// </PermissionSet>
// Token: 0x06002B04 RID: 11012 RVA: 0x0008B904 File Offset: 0x00089B04
public void Serialize(Stream serializationStream, object graph, Header[] headers)
{
if (serializationStream == null)
{
throw new ArgumentNullException("serializationStream");
}
BinaryWriter binaryWriter = new BinaryWriter(serializationStream);
this.WriteBinaryHeader(binaryWriter, headers != null);
if (graph is IMethodCallMessage)
{
MessageFormatter.WriteMethodCall(binaryWriter, graph, headers, this.surrogate_selector, this.context, this.assembly_format, this.type_format);
}
else if (graph is IMethodReturnMessage)
{
MessageFormatter.WriteMethodResponse(binaryWriter, graph, headers, this.surrogate_selector, this.context, this.assembly_format, this.type_format);
}
else
{
ObjectWriter objectWriter = new ObjectWriter(this.surrogate_selector, this.context, this.assembly_format, this.type_format);
objectWriter.WriteObjectGraph(binaryWriter, graph, headers);
}
binaryWriter.Flush();
}
/// <summary>Deserializes the specified stream into an object graph. The provided <see cref="T:System.Runtime.Remoting.Messaging.HeaderHandler" /> handles any headers in that stream.</summary>
/// <returns>The deserialized object or the top object (root) of the object graph.</returns>
/// <param name="serializationStream">The stream from which to deserialize the object graph. </param>
/// <param name="handler">The <see cref="T:System.Runtime.Remoting.Messaging.HeaderHandler" /> that handles any headers in the <paramref name="serializationStream" />. Can be null. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="serializationStream" /> supports seeking, but its length is 0. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002B05 RID: 11013 RVA: 0x0008B9C4 File Offset: 0x00089BC4
[ComVisible(false)]
public object UnsafeDeserialize(Stream serializationStream, HeaderHandler handler)
{
return this.NoCheckDeserialize(serializationStream, handler);
}
/// <summary>Deserializes a response to a remote method call from the provided <see cref="T:System.IO.Stream" />.</summary>
/// <returns>The deserialized response to the remote method call.</returns>
/// <param name="serializationStream">The stream from which to deserialize the object graph. </param>
/// <param name="handler">The <see cref="T:System.Runtime.Remoting.Messaging.HeaderHandler" /> that handles any headers in the <paramref name="serializationStream" />. Can be null. </param>
/// <param name="methodCallMessage">The <see cref="T:System.Runtime.Remoting.Messaging.IMethodCallMessage" /> that contains details about where the call came from. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="serializationStream" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="serializationStream" /> supports seeking, but its length is 0. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002B06 RID: 11014 RVA: 0x0008B9D0 File Offset: 0x00089BD0
[ComVisible(false)]
public object UnsafeDeserializeMethodResponse(Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage)
{
return this.NoCheckDeserializeMethodResponse(serializationStream, handler, methodCallMessage);
}
// Token: 0x06002B07 RID: 11015 RVA: 0x0008B9DC File Offset: 0x00089BDC
private void WriteBinaryHeader(BinaryWriter writer, bool hasHeaders)
{
writer.Write(0);
writer.Write(1);
if (hasHeaders)
{
writer.Write(2);
}
else
{
writer.Write(-1);
}
writer.Write(1);
writer.Write(0);
}
// Token: 0x06002B08 RID: 11016 RVA: 0x0008BA20 File Offset: 0x00089C20
private void ReadBinaryHeader(BinaryReader reader, out bool hasHeaders)
{
reader.ReadByte();
reader.ReadInt32();
int num = reader.ReadInt32();
hasHeaders = num == 2;
reader.ReadInt32();
reader.ReadInt32();
}
// Token: 0x040010B3 RID: 4275
private FormatterAssemblyStyle assembly_format;
// Token: 0x040010B4 RID: 4276
private SerializationBinder binder;
// Token: 0x040010B5 RID: 4277
private StreamingContext context;
// Token: 0x040010B6 RID: 4278
private ISurrogateSelector surrogate_selector;
// Token: 0x040010B7 RID: 4279
private FormatterTypeStyle type_format = FormatterTypeStyle.TypesAlways;
// Token: 0x040010B8 RID: 4280
private TypeFilterLevel filter_level = TypeFilterLevel.Full;
}
}
@@ -0,0 +1,43 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000461 RID: 1121
internal enum BinaryTypeCode : byte
{
// Token: 0x040010A2 RID: 4258
Boolean = 1,
// Token: 0x040010A3 RID: 4259
Byte,
// Token: 0x040010A4 RID: 4260
Char,
// Token: 0x040010A5 RID: 4261
Decimal = 5,
// Token: 0x040010A6 RID: 4262
Double,
// Token: 0x040010A7 RID: 4263
Int16,
// Token: 0x040010A8 RID: 4264
Int32,
// Token: 0x040010A9 RID: 4265
Int64,
// Token: 0x040010AA RID: 4266
SByte,
// Token: 0x040010AB RID: 4267
Single,
// Token: 0x040010AC RID: 4268
TimeSpan,
// Token: 0x040010AD RID: 4269
DateTime,
// Token: 0x040010AE RID: 4270
UInt16,
// Token: 0x040010AF RID: 4271
UInt32,
// Token: 0x040010B0 RID: 4272
UInt64,
// Token: 0x040010B1 RID: 4273
Null,
// Token: 0x040010B2 RID: 4274
String
}
}
@@ -0,0 +1,29 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000469 RID: 1129
internal abstract class ClrTypeMetadata : TypeMetadata
{
// Token: 0x06002B41 RID: 11073 RVA: 0x0008E8AC File Offset: 0x0008CAAC
public ClrTypeMetadata(Type instanceType)
{
this.InstanceType = instanceType;
this.InstanceTypeName = instanceType.FullName;
this.TypeAssemblyName = instanceType.Assembly.FullName;
}
// Token: 0x1700087D RID: 2173
// (get) Token: 0x06002B42 RID: 11074 RVA: 0x0008E8E4 File Offset: 0x0008CAE4
public override bool RequiresTypes
{
get
{
return false;
}
}
// Token: 0x040010D1 RID: 4305
public Type InstanceType;
}
}
@@ -0,0 +1,376 @@
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000463 RID: 1123
internal class CodeGenerator
{
// Token: 0x06002B0A RID: 11018 RVA: 0x0008BA60 File Offset: 0x00089C60
static CodeGenerator()
{
AppDomain domain = Thread.GetDomain();
AssemblyBuilder assemblyBuilder = domain.DefineInternalDynamicAssembly(new AssemblyName
{
Name = "__MetadataTypes"
}, AssemblyBuilderAccess.Run);
CodeGenerator._module = assemblyBuilder.DefineDynamicModule("__MetadataTypesModule", false);
}
// Token: 0x06002B0B RID: 11019 RVA: 0x0008BAA8 File Offset: 0x00089CA8
public static Type GenerateMetadataType(Type type, StreamingContext context)
{
object obj = CodeGenerator.monitor;
Type type2;
lock (obj)
{
type2 = CodeGenerator.GenerateMetadataTypeInternal(type, context);
}
return type2;
}
// Token: 0x06002B0C RID: 11020 RVA: 0x0008BAF8 File Offset: 0x00089CF8
public static Type GenerateMetadataTypeInternal(Type type, StreamingContext context)
{
string text = type.Name + "__TypeMetadata";
string text2 = string.Empty;
int num = 0;
while (CodeGenerator._module.GetType(text + text2) != null)
{
int num2;
num = (num2 = num + 1);
text2 = num2.ToString();
}
text += text2;
MemberInfo[] serializableMembers = FormatterServices.GetSerializableMembers(type, context);
TypeBuilder typeBuilder = CodeGenerator._module.DefineType(text, TypeAttributes.Public, typeof(ClrTypeMetadata));
Type[] array = Type.EmptyTypes;
ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, array);
ConstructorInfo constructor = typeof(ClrTypeMetadata).GetConstructor(new Type[] { typeof(Type) });
ILGenerator ilgenerator = constructorBuilder.GetILGenerator();
ilgenerator.Emit(OpCodes.Ldarg_0);
ilgenerator.Emit(OpCodes.Ldtoken, type);
ilgenerator.EmitCall(OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
ilgenerator.Emit(OpCodes.Call, constructor);
ilgenerator.Emit(OpCodes.Ret);
array = new Type[]
{
typeof(ObjectWriter),
typeof(BinaryWriter)
};
MethodBuilder methodBuilder = typeBuilder.DefineMethod("WriteAssemblies", MethodAttributes.FamANDAssem | MethodAttributes.Family | MethodAttributes.Virtual, typeof(void), array);
ilgenerator = methodBuilder.GetILGenerator();
foreach (FieldInfo fieldInfo in serializableMembers)
{
Type type2 = fieldInfo.FieldType;
while (type2.IsArray)
{
type2 = type2.GetElementType();
}
if (type2.Assembly != ObjectWriter.CorlibAssembly)
{
ilgenerator.Emit(OpCodes.Ldarg_1);
ilgenerator.Emit(OpCodes.Ldarg_2);
CodeGenerator.EmitLoadTypeAssembly(ilgenerator, type2, fieldInfo.Name);
ilgenerator.EmitCall(OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
ilgenerator.Emit(OpCodes.Pop);
}
}
ilgenerator.Emit(OpCodes.Ret);
typeBuilder.DefineMethodOverride(methodBuilder, typeof(TypeMetadata).GetMethod("WriteAssemblies"));
array = new Type[]
{
typeof(ObjectWriter),
typeof(BinaryWriter),
typeof(bool)
};
methodBuilder = typeBuilder.DefineMethod("WriteTypeData", MethodAttributes.FamANDAssem | MethodAttributes.Family | MethodAttributes.Virtual, typeof(void), array);
ilgenerator = methodBuilder.GetILGenerator();
ilgenerator.Emit(OpCodes.Ldarg_2);
ilgenerator.Emit(OpCodes.Ldc_I4, serializableMembers.Length);
CodeGenerator.EmitWrite(ilgenerator, typeof(int));
foreach (FieldInfo fieldInfo2 in serializableMembers)
{
ilgenerator.Emit(OpCodes.Ldarg_2);
ilgenerator.Emit(OpCodes.Ldstr, fieldInfo2.Name);
CodeGenerator.EmitWrite(ilgenerator, typeof(string));
}
Label label = ilgenerator.DefineLabel();
ilgenerator.Emit(OpCodes.Ldarg_3);
ilgenerator.Emit(OpCodes.Brfalse, label);
foreach (FieldInfo fieldInfo3 in serializableMembers)
{
ilgenerator.Emit(OpCodes.Ldarg_2);
ilgenerator.Emit(OpCodes.Ldc_I4_S, (byte)ObjectWriter.GetTypeTag(fieldInfo3.FieldType));
CodeGenerator.EmitWrite(ilgenerator, typeof(byte));
}
foreach (FieldInfo fieldInfo4 in serializableMembers)
{
CodeGenerator.EmitWriteTypeSpec(ilgenerator, fieldInfo4.FieldType, fieldInfo4.Name);
}
ilgenerator.MarkLabel(label);
ilgenerator.Emit(OpCodes.Ret);
typeBuilder.DefineMethodOverride(methodBuilder, typeof(TypeMetadata).GetMethod("WriteTypeData"));
array = new Type[]
{
typeof(ObjectWriter),
typeof(BinaryWriter),
typeof(object)
};
methodBuilder = typeBuilder.DefineMethod("WriteObjectData", MethodAttributes.FamANDAssem | MethodAttributes.Family | MethodAttributes.Virtual, typeof(void), array);
ilgenerator = methodBuilder.GetILGenerator();
LocalBuilder localBuilder = ilgenerator.DeclareLocal(type);
OpCode opCode = OpCodes.Ldloc;
ilgenerator.Emit(OpCodes.Ldarg_3);
if (type.IsValueType)
{
ilgenerator.Emit(OpCodes.Unbox, type);
CodeGenerator.LoadFromPtr(ilgenerator, type);
opCode = OpCodes.Ldloca_S;
}
else
{
ilgenerator.Emit(OpCodes.Castclass, type);
}
ilgenerator.Emit(OpCodes.Stloc, localBuilder);
foreach (FieldInfo fieldInfo5 in serializableMembers)
{
Type fieldType = fieldInfo5.FieldType;
if (BinaryCommon.IsPrimitive(fieldType))
{
ilgenerator.Emit(OpCodes.Ldarg_2);
ilgenerator.Emit(opCode, localBuilder);
if (fieldType == typeof(DateTime) || fieldType == typeof(TimeSpan) || fieldType == typeof(decimal))
{
ilgenerator.Emit(OpCodes.Ldflda, fieldInfo5);
}
else
{
ilgenerator.Emit(OpCodes.Ldfld, fieldInfo5);
}
CodeGenerator.EmitWritePrimitiveValue(ilgenerator, fieldType);
}
else
{
ilgenerator.Emit(OpCodes.Ldarg_1);
ilgenerator.Emit(OpCodes.Ldarg_2);
ilgenerator.Emit(OpCodes.Ldtoken, fieldType);
ilgenerator.EmitCall(OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
ilgenerator.Emit(opCode, localBuilder);
ilgenerator.Emit(OpCodes.Ldfld, fieldInfo5);
if (fieldType.IsValueType)
{
ilgenerator.Emit(OpCodes.Box, fieldType);
}
ilgenerator.EmitCall(OpCodes.Call, typeof(ObjectWriter).GetMethod("WriteValue"), null);
}
}
ilgenerator.Emit(OpCodes.Ret);
typeBuilder.DefineMethodOverride(methodBuilder, typeof(TypeMetadata).GetMethod("WriteObjectData"));
return typeBuilder.CreateType();
}
// Token: 0x06002B0D RID: 11021 RVA: 0x0008C128 File Offset: 0x0008A328
public static void LoadFromPtr(ILGenerator ig, Type t)
{
if (t == typeof(int))
{
ig.Emit(OpCodes.Ldind_I4);
}
else if (t == typeof(uint))
{
ig.Emit(OpCodes.Ldind_U4);
}
else if (t == typeof(short))
{
ig.Emit(OpCodes.Ldind_I2);
}
else if (t == typeof(ushort))
{
ig.Emit(OpCodes.Ldind_U2);
}
else if (t == typeof(char))
{
ig.Emit(OpCodes.Ldind_U2);
}
else if (t == typeof(byte))
{
ig.Emit(OpCodes.Ldind_U1);
}
else if (t == typeof(sbyte))
{
ig.Emit(OpCodes.Ldind_I1);
}
else if (t == typeof(ulong))
{
ig.Emit(OpCodes.Ldind_I8);
}
else if (t == typeof(long))
{
ig.Emit(OpCodes.Ldind_I8);
}
else if (t == typeof(float))
{
ig.Emit(OpCodes.Ldind_R4);
}
else if (t == typeof(double))
{
ig.Emit(OpCodes.Ldind_R8);
}
else if (t == typeof(bool))
{
ig.Emit(OpCodes.Ldind_I1);
}
else if (t == typeof(IntPtr))
{
ig.Emit(OpCodes.Ldind_I);
}
else if (t.IsEnum)
{
if (t == typeof(Enum))
{
ig.Emit(OpCodes.Ldind_Ref);
}
else
{
CodeGenerator.LoadFromPtr(ig, CodeGenerator.EnumToUnderlying(t));
}
}
else if (t.IsValueType)
{
ig.Emit(OpCodes.Ldobj, t);
}
else
{
ig.Emit(OpCodes.Ldind_Ref);
}
}
// Token: 0x06002B0E RID: 11022 RVA: 0x0008C338 File Offset: 0x0008A538
private static void EmitWriteTypeSpec(ILGenerator gen, Type type, string member)
{
switch (ObjectWriter.GetTypeTag(type))
{
case TypeTag.PrimitiveType:
gen.Emit(OpCodes.Ldarg_2);
gen.Emit(OpCodes.Ldc_I4_S, BinaryCommon.GetTypeCode(type));
CodeGenerator.EmitWrite(gen, typeof(byte));
break;
case TypeTag.RuntimeType:
gen.Emit(OpCodes.Ldarg_2);
gen.Emit(OpCodes.Ldstr, type.FullName);
CodeGenerator.EmitWrite(gen, typeof(string));
break;
case TypeTag.GenericType:
gen.Emit(OpCodes.Ldarg_2);
gen.Emit(OpCodes.Ldstr, type.FullName);
CodeGenerator.EmitWrite(gen, typeof(string));
gen.Emit(OpCodes.Ldarg_2);
gen.Emit(OpCodes.Ldarg_1);
CodeGenerator.EmitLoadTypeAssembly(gen, type, member);
gen.EmitCall(OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("GetAssemblyId"), null);
gen.Emit(OpCodes.Conv_I4);
CodeGenerator.EmitWrite(gen, typeof(int));
break;
case TypeTag.ArrayOfPrimitiveType:
gen.Emit(OpCodes.Ldarg_2);
gen.Emit(OpCodes.Ldc_I4_S, BinaryCommon.GetTypeCode(type.GetElementType()));
CodeGenerator.EmitWrite(gen, typeof(byte));
break;
}
}
// Token: 0x06002B0F RID: 11023 RVA: 0x0008C4A0 File Offset: 0x0008A6A0
private static void EmitLoadTypeAssembly(ILGenerator gen, Type type, string member)
{
gen.Emit(OpCodes.Ldtoken, type);
gen.EmitCall(OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
gen.EmitCall(OpCodes.Callvirt, typeof(Type).GetProperty("Assembly").GetGetMethod(), null);
}
// Token: 0x06002B10 RID: 11024 RVA: 0x0008C500 File Offset: 0x0008A700
private static void EmitWrite(ILGenerator gen, Type type)
{
gen.EmitCall(OpCodes.Callvirt, typeof(BinaryWriter).GetMethod("Write", new Type[] { type }), null);
}
// Token: 0x06002B11 RID: 11025 RVA: 0x0008C538 File Offset: 0x0008A738
public static void EmitWritePrimitiveValue(ILGenerator gen, Type type)
{
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
case TypeCode.Char:
case TypeCode.SByte:
case TypeCode.Byte:
case TypeCode.Int16:
case TypeCode.UInt16:
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Single:
case TypeCode.Double:
case TypeCode.String:
CodeGenerator.EmitWrite(gen, type);
return;
case TypeCode.Decimal:
gen.EmitCall(OpCodes.Call, typeof(CultureInfo).GetProperty("InvariantCulture").GetGetMethod(), null);
gen.EmitCall(OpCodes.Call, typeof(decimal).GetMethod("ToString", new Type[] { typeof(IFormatProvider) }), null);
CodeGenerator.EmitWrite(gen, typeof(string));
return;
case TypeCode.DateTime:
gen.EmitCall(OpCodes.Call, typeof(DateTime).GetMethod("ToBinary", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), null);
CodeGenerator.EmitWrite(gen, typeof(long));
return;
}
if (type != typeof(TimeSpan))
{
throw new NotSupportedException("Unsupported primitive type: " + type.FullName);
}
gen.EmitCall(OpCodes.Call, typeof(TimeSpan).GetProperty("Ticks").GetGetMethod(), null);
CodeGenerator.EmitWrite(gen, typeof(long));
}
// Token: 0x06002B12 RID: 11026 RVA: 0x0008C6B0 File Offset: 0x0008A8B0
public static Type EnumToUnderlying(Type t)
{
TypeCode typeCode = Type.GetTypeCode(t);
switch (typeCode)
{
case TypeCode.Boolean:
return typeof(bool);
case TypeCode.Char:
return typeof(char);
case TypeCode.SByte:
return typeof(sbyte);
case TypeCode.Byte:
return typeof(byte);
case TypeCode.Int16:
return typeof(short);
case TypeCode.UInt16:
return typeof(ushort);
case TypeCode.Int32:
return typeof(int);
case TypeCode.UInt32:
return typeof(uint);
case TypeCode.Int64:
return typeof(long);
case TypeCode.UInt64:
return typeof(ulong);
default:
throw new Exception(string.Concat(new object[] { "Unhandled typecode in enum ", typeCode, " from ", t.AssemblyQualifiedName }));
}
}
// Token: 0x040010BA RID: 4282
private static object monitor = new object();
// Token: 0x040010BB RID: 4283
private static ModuleBuilder _module;
}
}
@@ -0,0 +1,65 @@
using System;
using System.IO;
using System.Reflection;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200046B RID: 1131
internal class MemberTypeMetadata : ClrTypeMetadata
{
// Token: 0x06002B49 RID: 11081 RVA: 0x0008EB60 File Offset: 0x0008CD60
public MemberTypeMetadata(Type type, StreamingContext context)
: base(type)
{
this.members = FormatterServices.GetSerializableMembers(type, context);
}
// Token: 0x06002B4A RID: 11082 RVA: 0x0008EB78 File Offset: 0x0008CD78
public override void WriteAssemblies(ObjectWriter ow, BinaryWriter writer)
{
foreach (FieldInfo fieldInfo in this.members)
{
Type type = fieldInfo.FieldType;
while (type.IsArray)
{
type = type.GetElementType();
}
ow.WriteAssembly(writer, type.Assembly);
}
}
// Token: 0x06002B4B RID: 11083 RVA: 0x0008EBD8 File Offset: 0x0008CDD8
public override void WriteTypeData(ObjectWriter ow, BinaryWriter writer, bool writeTypes)
{
writer.Write(this.members.Length);
foreach (FieldInfo fieldInfo in this.members)
{
writer.Write(fieldInfo.Name);
}
if (writeTypes)
{
foreach (FieldInfo fieldInfo2 in this.members)
{
ObjectWriter.WriteTypeCode(writer, fieldInfo2.FieldType);
}
foreach (FieldInfo fieldInfo3 in this.members)
{
ow.WriteTypeSpec(writer, fieldInfo3.FieldType);
}
}
}
// Token: 0x06002B4C RID: 11084 RVA: 0x0008EC9C File Offset: 0x0008CE9C
public override void WriteObjectData(ObjectWriter ow, BinaryWriter writer, object data)
{
object[] objectData = FormatterServices.GetObjectData(data, this.members);
for (int i = 0; i < objectData.Length; i++)
{
ow.WriteValue(writer, ((FieldInfo)this.members[i]).FieldType, objectData[i]);
}
}
// Token: 0x040010D4 RID: 4308
private MemberInfo[] members;
}
}
@@ -0,0 +1,534 @@
using System;
using System.Collections;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000464 RID: 1124
internal class MessageFormatter
{
// Token: 0x06002B14 RID: 11028 RVA: 0x0008C7A4 File Offset: 0x0008A9A4
public static void WriteMethodCall(BinaryWriter writer, object obj, Header[] headers, ISurrogateSelector surrogateSelector, StreamingContext context, FormatterAssemblyStyle assemblyFormat, FormatterTypeStyle typeFormat)
{
IMethodCallMessage methodCallMessage = (IMethodCallMessage)obj;
writer.Write(21);
int num = 0;
object obj2 = null;
object[] array = null;
MethodFlags methodFlags;
if (methodCallMessage.LogicalCallContext != null && methodCallMessage.LogicalCallContext.HasInfo)
{
methodFlags = MethodFlags.IncludesLogicalCallContext;
num++;
}
else
{
methodFlags = MethodFlags.ExcludeLogicalCallContext;
}
if (RemotingServices.IsMethodOverloaded(methodCallMessage))
{
num++;
methodFlags |= MethodFlags.IncludesSignature;
}
if (methodCallMessage.Properties.Count > MethodCallDictionary.InternalKeys.Length)
{
array = MessageFormatter.GetExtraProperties(methodCallMessage.Properties, MethodCallDictionary.InternalKeys);
num++;
}
if (methodCallMessage.MethodBase.IsGenericMethod)
{
num++;
methodFlags |= MethodFlags.GenericArguments;
}
if (methodCallMessage.ArgCount == 0)
{
methodFlags |= MethodFlags.NoArguments;
}
else if (MessageFormatter.AllTypesArePrimitive(methodCallMessage.Args))
{
methodFlags |= MethodFlags.PrimitiveArguments;
}
else if (num == 0)
{
methodFlags |= MethodFlags.ArgumentsInSimpleArray;
}
else
{
methodFlags |= MethodFlags.ArgumentsInMultiArray;
num++;
}
writer.Write((int)methodFlags);
writer.Write(18);
writer.Write(methodCallMessage.MethodName);
writer.Write(18);
writer.Write(methodCallMessage.TypeName);
if ((methodFlags & MethodFlags.PrimitiveArguments) > (MethodFlags)0)
{
writer.Write((uint)methodCallMessage.Args.Length);
for (int i = 0; i < methodCallMessage.ArgCount; i++)
{
object arg = methodCallMessage.GetArg(i);
if (arg != null)
{
writer.Write(BinaryCommon.GetTypeCode(arg.GetType()));
ObjectWriter.WritePrimitiveValue(writer, arg);
}
else
{
writer.Write(17);
}
}
}
if (num > 0)
{
object[] array2 = new object[num];
int num2 = 0;
if ((methodFlags & MethodFlags.ArgumentsInMultiArray) > (MethodFlags)0)
{
array2[num2++] = methodCallMessage.Args;
}
if ((methodFlags & MethodFlags.GenericArguments) > (MethodFlags)0)
{
array2[num2++] = methodCallMessage.MethodBase.GetGenericArguments();
}
if ((methodFlags & MethodFlags.IncludesSignature) > (MethodFlags)0)
{
array2[num2++] = methodCallMessage.MethodSignature;
}
if ((methodFlags & MethodFlags.IncludesLogicalCallContext) > (MethodFlags)0)
{
array2[num2++] = methodCallMessage.LogicalCallContext;
}
if (array != null)
{
array2[num2++] = array;
}
obj2 = array2;
}
else if ((methodFlags & MethodFlags.ArgumentsInSimpleArray) > (MethodFlags)0)
{
obj2 = methodCallMessage.Args;
}
if (obj2 != null)
{
ObjectWriter objectWriter = new ObjectWriter(surrogateSelector, context, assemblyFormat, typeFormat);
objectWriter.WriteObjectGraph(writer, obj2, headers);
}
else
{
writer.Write(11);
}
}
// Token: 0x06002B15 RID: 11029 RVA: 0x0008CA08 File Offset: 0x0008AC08
public static void WriteMethodResponse(BinaryWriter writer, object obj, Header[] headers, ISurrogateSelector surrogateSelector, StreamingContext context, FormatterAssemblyStyle assemblyFormat, FormatterTypeStyle typeFormat)
{
IMethodReturnMessage methodReturnMessage = (IMethodReturnMessage)obj;
writer.Write(22);
string[] array = MethodReturnDictionary.InternalReturnKeys;
int num = 0;
object obj2 = null;
object[] array2 = null;
MethodFlags methodFlags = MethodFlags.ExcludeLogicalCallContext;
ReturnTypeTag returnTypeTag;
if (methodReturnMessage.Exception != null)
{
returnTypeTag = (ReturnTypeTag)34;
array = MethodReturnDictionary.InternalExceptionKeys;
num = 1;
}
else if (methodReturnMessage.ReturnValue == null)
{
returnTypeTag = ReturnTypeTag.Null;
}
else if (MessageFormatter.IsMethodPrimitive(methodReturnMessage.ReturnValue.GetType()))
{
returnTypeTag = ReturnTypeTag.PrimitiveType;
}
else
{
returnTypeTag = ReturnTypeTag.ObjectType;
num++;
}
if (methodReturnMessage.LogicalCallContext != null && methodReturnMessage.LogicalCallContext.HasInfo)
{
methodFlags = MethodFlags.IncludesLogicalCallContext;
num++;
}
if (methodReturnMessage.Properties.Count > array.Length && (byte)(returnTypeTag & ReturnTypeTag.Exception) == 0)
{
array2 = MessageFormatter.GetExtraProperties(methodReturnMessage.Properties, array);
num++;
}
MethodFlags methodFlags2;
if (methodReturnMessage.OutArgCount == 0)
{
methodFlags2 = MethodFlags.NoArguments;
}
else if (MessageFormatter.AllTypesArePrimitive(methodReturnMessage.Args))
{
methodFlags2 = MethodFlags.PrimitiveArguments;
}
else if (num == 0)
{
methodFlags2 = MethodFlags.ArgumentsInSimpleArray;
}
else
{
methodFlags2 = MethodFlags.ArgumentsInMultiArray;
num++;
}
writer.Write((byte)(methodFlags | methodFlags2));
writer.Write((byte)returnTypeTag);
writer.Write(0);
writer.Write(0);
if (returnTypeTag == ReturnTypeTag.PrimitiveType)
{
writer.Write(BinaryCommon.GetTypeCode(methodReturnMessage.ReturnValue.GetType()));
ObjectWriter.WritePrimitiveValue(writer, methodReturnMessage.ReturnValue);
}
if (methodFlags2 == MethodFlags.PrimitiveArguments)
{
writer.Write((uint)methodReturnMessage.ArgCount);
for (int i = 0; i < methodReturnMessage.ArgCount; i++)
{
object arg = methodReturnMessage.GetArg(i);
if (arg != null)
{
writer.Write(BinaryCommon.GetTypeCode(arg.GetType()));
ObjectWriter.WritePrimitiveValue(writer, arg);
}
else
{
writer.Write(17);
}
}
}
if (num > 0)
{
object[] array3 = new object[num];
int num2 = 0;
if ((byte)(returnTypeTag & ReturnTypeTag.Exception) != 0)
{
array3[num2++] = methodReturnMessage.Exception;
}
if (methodFlags2 == MethodFlags.ArgumentsInMultiArray)
{
array3[num2++] = methodReturnMessage.Args;
}
if (returnTypeTag == ReturnTypeTag.ObjectType)
{
array3[num2++] = methodReturnMessage.ReturnValue;
}
if (methodFlags == MethodFlags.IncludesLogicalCallContext)
{
array3[num2++] = methodReturnMessage.LogicalCallContext;
}
if (array2 != null)
{
array3[num2++] = array2;
}
obj2 = array3;
}
else if ((methodFlags2 & MethodFlags.ArgumentsInSimpleArray) > (MethodFlags)0)
{
obj2 = methodReturnMessage.Args;
}
if (obj2 != null)
{
ObjectWriter objectWriter = new ObjectWriter(surrogateSelector, context, assemblyFormat, typeFormat);
objectWriter.WriteObjectGraph(writer, obj2, headers);
}
else
{
writer.Write(11);
}
}
// Token: 0x06002B16 RID: 11030 RVA: 0x0008CCA0 File Offset: 0x0008AEA0
public static object ReadMethodCall(BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, BinaryFormatter formatter)
{
BinaryElement binaryElement = (BinaryElement)reader.ReadByte();
return MessageFormatter.ReadMethodCall(binaryElement, reader, hasHeaders, headerHandler, formatter);
}
// Token: 0x06002B17 RID: 11031 RVA: 0x0008CCC0 File Offset: 0x0008AEC0
public static object ReadMethodCall(BinaryElement elem, BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, BinaryFormatter formatter)
{
if (elem != BinaryElement.MethodCall)
{
throw new SerializationException("Invalid format. Expected BinaryElement.MethodCall, found " + elem);
}
MethodFlags methodFlags = (MethodFlags)reader.ReadInt32();
if (reader.ReadByte() != 18)
{
throw new SerializationException("Invalid format");
}
string text = reader.ReadString();
if (reader.ReadByte() != 18)
{
throw new SerializationException("Invalid format");
}
string text2 = reader.ReadString();
object[] array = null;
object obj = null;
object obj2 = null;
object[] array2 = null;
Header[] array3 = null;
Type[] array4 = null;
if ((methodFlags & MethodFlags.PrimitiveArguments) > (MethodFlags)0)
{
uint num = reader.ReadUInt32();
array = new object[num];
int num2 = 0;
while ((long)num2 < (long)((ulong)num))
{
Type typeFromCode = BinaryCommon.GetTypeFromCode((int)reader.ReadByte());
array[num2] = ObjectReader.ReadPrimitiveTypeValue(reader, typeFromCode);
num2++;
}
}
if ((methodFlags & MethodFlags.NeedsInfoArrayMask) > (MethodFlags)0)
{
ObjectReader objectReader = new ObjectReader(formatter);
object obj3;
objectReader.ReadObjectGraph(reader, hasHeaders, out obj3, out array3);
object[] array5 = (object[])obj3;
if ((methodFlags & MethodFlags.ArgumentsInSimpleArray) > (MethodFlags)0)
{
array = array5;
}
else
{
int num3 = 0;
if ((methodFlags & MethodFlags.ArgumentsInMultiArray) > (MethodFlags)0)
{
if (array5.Length > 1)
{
array = (object[])array5[num3++];
}
else
{
array = new object[0];
}
}
if ((methodFlags & MethodFlags.GenericArguments) > (MethodFlags)0)
{
array4 = (Type[])array5[num3++];
}
if ((methodFlags & MethodFlags.IncludesSignature) > (MethodFlags)0)
{
obj = array5[num3++];
}
if ((methodFlags & MethodFlags.IncludesLogicalCallContext) > (MethodFlags)0)
{
obj2 = array5[num3++];
}
if (num3 < array5.Length)
{
array2 = (object[])array5[num3];
}
}
}
else
{
reader.ReadByte();
}
if (array == null)
{
array = new object[0];
}
string text3 = null;
if (headerHandler != null)
{
text3 = headerHandler(array3) as string;
}
MethodCall methodCall = new MethodCall(new Header[]
{
new Header("__MethodName", text),
new Header("__MethodSignature", obj),
new Header("__TypeName", text2),
new Header("__Args", array),
new Header("__CallContext", obj2),
new Header("__Uri", text3),
new Header("__GenericArguments", array4)
});
if (array2 != null)
{
foreach (DictionaryEntry dictionaryEntry in array2)
{
methodCall.Properties[(string)dictionaryEntry.Key] = dictionaryEntry.Value;
}
}
return methodCall;
}
// Token: 0x06002B18 RID: 11032 RVA: 0x0008CF60 File Offset: 0x0008B160
public static object ReadMethodResponse(BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, BinaryFormatter formatter)
{
BinaryElement binaryElement = (BinaryElement)reader.ReadByte();
return MessageFormatter.ReadMethodResponse(binaryElement, reader, hasHeaders, headerHandler, methodCallMessage, formatter);
}
// Token: 0x06002B19 RID: 11033 RVA: 0x0008CF80 File Offset: 0x0008B180
public static object ReadMethodResponse(BinaryElement elem, BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, BinaryFormatter formatter)
{
if (elem != BinaryElement.MethodResponse)
{
throw new SerializationException("Invalid format. Expected BinaryElement.MethodResponse, found " + elem);
}
MethodFlags methodFlags = (MethodFlags)reader.ReadByte();
ReturnTypeTag returnTypeTag = (ReturnTypeTag)reader.ReadByte();
bool flag = (methodFlags & MethodFlags.IncludesLogicalCallContext) > (MethodFlags)0;
reader.ReadByte();
reader.ReadByte();
object obj = null;
object[] array = null;
LogicalCallContext logicalCallContext = null;
Exception ex = null;
object[] array2 = null;
Header[] array3 = null;
if ((byte)(returnTypeTag & ReturnTypeTag.PrimitiveType) > 0)
{
Type typeFromCode = BinaryCommon.GetTypeFromCode((int)reader.ReadByte());
obj = ObjectReader.ReadPrimitiveTypeValue(reader, typeFromCode);
}
if ((methodFlags & MethodFlags.PrimitiveArguments) > (MethodFlags)0)
{
uint num = reader.ReadUInt32();
array = new object[num];
int num2 = 0;
while ((long)num2 < (long)((ulong)num))
{
Type typeFromCode2 = BinaryCommon.GetTypeFromCode((int)reader.ReadByte());
array[num2] = ObjectReader.ReadPrimitiveTypeValue(reader, typeFromCode2);
num2++;
}
}
if (flag || (byte)(returnTypeTag & ReturnTypeTag.ObjectType) > 0 || (byte)(returnTypeTag & ReturnTypeTag.Exception) > 0 || (methodFlags & MethodFlags.ArgumentsInSimpleArray) > (MethodFlags)0 || (methodFlags & MethodFlags.ArgumentsInMultiArray) > (MethodFlags)0)
{
ObjectReader objectReader = new ObjectReader(formatter);
object obj2;
objectReader.ReadObjectGraph(reader, hasHeaders, out obj2, out array3);
object[] array4 = (object[])obj2;
if ((byte)(returnTypeTag & ReturnTypeTag.Exception) > 0)
{
ex = (Exception)array4[0];
if (flag)
{
logicalCallContext = (LogicalCallContext)array4[1];
}
}
else if ((methodFlags & MethodFlags.NoArguments) > (MethodFlags)0 || (methodFlags & MethodFlags.PrimitiveArguments) > (MethodFlags)0)
{
int num3 = 0;
if ((byte)(returnTypeTag & ReturnTypeTag.ObjectType) > 0)
{
obj = array4[num3++];
}
if (flag)
{
logicalCallContext = (LogicalCallContext)array4[num3++];
}
if (num3 < array4.Length)
{
array2 = (object[])array4[num3];
}
}
else if ((methodFlags & MethodFlags.ArgumentsInSimpleArray) > (MethodFlags)0)
{
array = array4;
}
else
{
int num4 = 0;
array = (object[])array4[num4++];
if ((byte)(returnTypeTag & ReturnTypeTag.ObjectType) > 0)
{
obj = array4[num4++];
}
if (flag)
{
logicalCallContext = (LogicalCallContext)array4[num4++];
}
if (num4 < array4.Length)
{
array2 = (object[])array4[num4];
}
}
}
else
{
reader.ReadByte();
}
if (headerHandler != null)
{
headerHandler(array3);
}
if (ex != null)
{
return new ReturnMessage(ex, methodCallMessage);
}
int num5 = ((array == null) ? 0 : array.Length);
ReturnMessage returnMessage = new ReturnMessage(obj, array, num5, logicalCallContext, methodCallMessage);
if (array2 != null)
{
foreach (DictionaryEntry dictionaryEntry in array2)
{
returnMessage.Properties[(string)dictionaryEntry.Key] = dictionaryEntry.Value;
}
}
return returnMessage;
}
// Token: 0x06002B1A RID: 11034 RVA: 0x0008D230 File Offset: 0x0008B430
private static bool AllTypesArePrimitive(object[] objects)
{
foreach (object obj in objects)
{
if (obj != null && !MessageFormatter.IsMethodPrimitive(obj.GetType()))
{
return false;
}
}
return true;
}
// Token: 0x06002B1B RID: 11035 RVA: 0x0008D270 File Offset: 0x0008B470
public static bool IsMethodPrimitive(Type type)
{
return type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(decimal);
}
// Token: 0x06002B1C RID: 11036 RVA: 0x0008D2B0 File Offset: 0x0008B4B0
private static object[] GetExtraProperties(IDictionary properties, string[] internalKeys)
{
object[] array = new object[properties.Count - internalKeys.Length];
int num = 0;
IDictionaryEnumerator enumerator = properties.GetEnumerator();
while (enumerator.MoveNext())
{
if (!MessageFormatter.IsInternalKey((string)enumerator.Entry.Key, internalKeys))
{
array[num++] = enumerator.Entry;
}
}
return array;
}
// Token: 0x06002B1D RID: 11037 RVA: 0x0008D318 File Offset: 0x0008B518
private static bool IsInternalKey(string key, string[] internalKeys)
{
foreach (string text in internalKeys)
{
if (key == text)
{
return true;
}
}
return false;
}
}
}
@@ -0,0 +1,29 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200045F RID: 1119
internal enum MethodFlags
{
// Token: 0x04001092 RID: 4242
NoArguments = 1,
// Token: 0x04001093 RID: 4243
PrimitiveArguments,
// Token: 0x04001094 RID: 4244
ArgumentsInSimpleArray = 4,
// Token: 0x04001095 RID: 4245
ArgumentsInMultiArray = 8,
// Token: 0x04001096 RID: 4246
ExcludeLogicalCallContext = 16,
// Token: 0x04001097 RID: 4247
IncludesLogicalCallContext = 64,
// Token: 0x04001098 RID: 4248
IncludesSignature = 128,
// Token: 0x04001099 RID: 4249
FormatMask = 15,
// Token: 0x0400109A RID: 4250
GenericArguments = 32768,
// Token: 0x0400109B RID: 4251
NeedsInfoArrayMask = 32972
}
}
@@ -0,0 +1,1013 @@
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000465 RID: 1125
internal class ObjectReader
{
// Token: 0x06002B1E RID: 11038 RVA: 0x0008D350 File Offset: 0x0008B550
public ObjectReader(BinaryFormatter formatter)
{
this._surrogateSelector = formatter.SurrogateSelector;
this._context = formatter.Context;
this._binder = formatter.Binder;
this._manager = new ObjectManager(this._surrogateSelector, this._context);
this._filterLevel = formatter.FilterLevel;
}
// Token: 0x06002B1F RID: 11039 RVA: 0x0008D3CC File Offset: 0x0008B5CC
public void ReadObjectGraph(BinaryReader reader, bool readHeaders, out object result, out Header[] headers)
{
BinaryElement binaryElement = (BinaryElement)reader.ReadByte();
this.ReadObjectGraph(binaryElement, reader, readHeaders, out result, out headers);
}
// Token: 0x06002B20 RID: 11040 RVA: 0x0008D3EC File Offset: 0x0008B5EC
public void ReadObjectGraph(BinaryElement elem, BinaryReader reader, bool readHeaders, out object result, out Header[] headers)
{
headers = null;
bool flag = this.ReadNextObject(elem, reader);
if (flag)
{
do
{
if (readHeaders && headers == null)
{
headers = (Header[])this.CurrentObject;
}
else if (this._rootObjectID == 0L)
{
this._rootObjectID = this._lastObjectID;
}
}
while (this.ReadNextObject(reader));
}
result = this._manager.GetObject(this._rootObjectID);
}
// Token: 0x06002B21 RID: 11041 RVA: 0x0008D464 File Offset: 0x0008B664
private bool ReadNextObject(BinaryElement element, BinaryReader reader)
{
if (element == BinaryElement.End)
{
this._manager.DoFixups();
this._manager.RaiseDeserializationEvent();
return false;
}
long num;
SerializationInfo serializationInfo;
this.ReadObject(element, reader, out num, out this._lastObject, out serializationInfo);
if (num != 0L)
{
this.RegisterObject(num, this._lastObject, serializationInfo, 0L, null, null);
this._lastObjectID = num;
}
return true;
}
// Token: 0x06002B22 RID: 11042 RVA: 0x0008D4C4 File Offset: 0x0008B6C4
public bool ReadNextObject(BinaryReader reader)
{
BinaryElement binaryElement = (BinaryElement)reader.ReadByte();
if (binaryElement == BinaryElement.End)
{
this._manager.DoFixups();
this._manager.RaiseDeserializationEvent();
return false;
}
long num;
SerializationInfo serializationInfo;
this.ReadObject(binaryElement, reader, out num, out this._lastObject, out serializationInfo);
if (num != 0L)
{
this.RegisterObject(num, this._lastObject, serializationInfo, 0L, null, null);
this._lastObjectID = num;
}
return true;
}
// Token: 0x1700087B RID: 2171
// (get) Token: 0x06002B23 RID: 11043 RVA: 0x0008D52C File Offset: 0x0008B72C
public object CurrentObject
{
get
{
return this._lastObject;
}
}
// Token: 0x06002B24 RID: 11044 RVA: 0x0008D534 File Offset: 0x0008B734
private void ReadObject(BinaryElement element, BinaryReader reader, out long objectId, out object value, out SerializationInfo info)
{
switch (element)
{
case BinaryElement.RefTypeObject:
this.ReadRefTypeObjectInstance(reader, out objectId, out value, out info);
return;
case BinaryElement.UntypedRuntimeObject:
this.ReadObjectInstance(reader, true, false, out objectId, out value, out info);
return;
case BinaryElement.UntypedExternalObject:
this.ReadObjectInstance(reader, false, false, out objectId, out value, out info);
return;
case BinaryElement.RuntimeObject:
this.ReadObjectInstance(reader, true, true, out objectId, out value, out info);
return;
case BinaryElement.ExternalObject:
this.ReadObjectInstance(reader, false, true, out objectId, out value, out info);
return;
case BinaryElement.String:
info = null;
this.ReadStringIntance(reader, out objectId, out value);
return;
case BinaryElement.GenericArray:
info = null;
this.ReadGenericArray(reader, out objectId, out value);
return;
case BinaryElement.BoxedPrimitiveTypeValue:
value = this.ReadBoxedPrimitiveTypeValue(reader);
objectId = 0L;
info = null;
return;
case BinaryElement.NullValue:
value = null;
objectId = 0L;
info = null;
return;
case BinaryElement.Assembly:
this.ReadAssembly(reader);
this.ReadObject((BinaryElement)reader.ReadByte(), reader, out objectId, out value, out info);
return;
case BinaryElement.ArrayFiller8b:
value = new ObjectReader.ArrayNullFiller((int)reader.ReadByte());
objectId = 0L;
info = null;
return;
case BinaryElement.ArrayFiller32b:
value = new ObjectReader.ArrayNullFiller(reader.ReadInt32());
objectId = 0L;
info = null;
return;
case BinaryElement.ArrayOfPrimitiveType:
this.ReadArrayOfPrimitiveType(reader, out objectId, out value);
info = null;
return;
case BinaryElement.ArrayOfObject:
this.ReadArrayOfObject(reader, out objectId, out value);
info = null;
return;
case BinaryElement.ArrayOfString:
this.ReadArrayOfString(reader, out objectId, out value);
info = null;
return;
}
throw new SerializationException("Unexpected binary element: " + (int)element);
}
// Token: 0x06002B25 RID: 11045 RVA: 0x0008D6E4 File Offset: 0x0008B8E4
private void ReadAssembly(BinaryReader reader)
{
long num = (long)((ulong)reader.ReadUInt32());
string text = reader.ReadString();
this._registeredAssemblies[num] = text;
}
// Token: 0x06002B26 RID: 11046 RVA: 0x0008D714 File Offset: 0x0008B914
private void ReadObjectInstance(BinaryReader reader, bool isRuntimeObject, bool hasTypeInfo, out long objectId, out object value, out SerializationInfo info)
{
objectId = (long)((ulong)reader.ReadUInt32());
ObjectReader.TypeMetadata typeMetadata = this.ReadTypeMetadata(reader, isRuntimeObject, hasTypeInfo);
this.ReadObjectContent(reader, typeMetadata, objectId, out value, out info);
}
// Token: 0x06002B27 RID: 11047 RVA: 0x0008D744 File Offset: 0x0008B944
private void ReadRefTypeObjectInstance(BinaryReader reader, out long objectId, out object value, out SerializationInfo info)
{
objectId = (long)((ulong)reader.ReadUInt32());
long num = (long)((ulong)reader.ReadUInt32());
object @object = this._manager.GetObject(num);
if (@object == null)
{
throw new SerializationException("Invalid binary format");
}
ObjectReader.TypeMetadata typeMetadata = (ObjectReader.TypeMetadata)this._typeMetadataCache[@object.GetType()];
this.ReadObjectContent(reader, typeMetadata, objectId, out value, out info);
}
// Token: 0x06002B28 RID: 11048 RVA: 0x0008D7A4 File Offset: 0x0008B9A4
private void ReadObjectContent(BinaryReader reader, ObjectReader.TypeMetadata metadata, long objectId, out object objectInstance, out SerializationInfo info)
{
if (this._filterLevel == TypeFilterLevel.Low)
{
objectInstance = FormatterServices.GetSafeUninitializedObject(metadata.Type);
}
else
{
objectInstance = FormatterServices.GetUninitializedObject(metadata.Type);
}
this._manager.RaiseOnDeserializingEvent(objectInstance);
info = ((!metadata.NeedsSerializationInfo) ? null : new SerializationInfo(metadata.Type, new FormatterConverter()));
if (metadata.MemberNames != null)
{
for (int i = 0; i < metadata.FieldCount; i++)
{
this.ReadValue(reader, objectInstance, objectId, info, metadata.MemberTypes[i], metadata.MemberNames[i], null, null);
}
}
else
{
for (int j = 0; j < metadata.FieldCount; j++)
{
this.ReadValue(reader, objectInstance, objectId, info, metadata.MemberTypes[j], metadata.MemberInfos[j].Name, metadata.MemberInfos[j], null);
}
}
}
// Token: 0x06002B29 RID: 11049 RVA: 0x0008D89C File Offset: 0x0008BA9C
private void RegisterObject(long objectId, object objectInstance, SerializationInfo info, long parentObjectId, MemberInfo parentObjectMemeber, int[] indices)
{
if (parentObjectId == 0L)
{
indices = null;
}
if (!objectInstance.GetType().IsValueType || parentObjectId == 0L)
{
this._manager.RegisterObject(objectInstance, objectId, info, 0L, null, null);
}
else
{
if (indices != null)
{
indices = (int[])indices.Clone();
}
this._manager.RegisterObject(objectInstance, objectId, info, parentObjectId, parentObjectMemeber, indices);
}
}
// Token: 0x06002B2A RID: 11050 RVA: 0x0008D90C File Offset: 0x0008BB0C
private void ReadStringIntance(BinaryReader reader, out long objectId, out object value)
{
objectId = (long)((ulong)reader.ReadUInt32());
value = reader.ReadString();
}
// Token: 0x06002B2B RID: 11051 RVA: 0x0008D920 File Offset: 0x0008BB20
private void ReadGenericArray(BinaryReader reader, out long objectId, out object val)
{
objectId = (long)((ulong)reader.ReadUInt32());
reader.ReadByte();
int num = reader.ReadInt32();
bool flag = false;
int[] array = new int[num];
for (int i = 0; i < num; i++)
{
array[i] = reader.ReadInt32();
if (array[i] == 0)
{
flag = true;
}
}
TypeTag typeTag = (TypeTag)reader.ReadByte();
Type type = this.ReadType(reader, typeTag);
Array array2 = Array.CreateInstance(type, array);
if (flag)
{
val = array2;
return;
}
int[] array3 = new int[num];
for (int j = num - 1; j >= 0; j--)
{
array3[j] = array2.GetLowerBound(j);
}
bool flag2 = false;
while (!flag2)
{
this.ReadValue(reader, array2, objectId, null, type, null, null, array3);
int k = array2.Rank - 1;
while (k >= 0)
{
array3[k]++;
if (array3[k] > array2.GetUpperBound(k))
{
if (k > 0)
{
array3[k] = array2.GetLowerBound(k);
k--;
continue;
}
flag2 = true;
}
break;
}
}
val = array2;
}
// Token: 0x06002B2C RID: 11052 RVA: 0x0008DA50 File Offset: 0x0008BC50
private object ReadBoxedPrimitiveTypeValue(BinaryReader reader)
{
Type type = this.ReadType(reader, TypeTag.PrimitiveType);
return ObjectReader.ReadPrimitiveTypeValue(reader, type);
}
// Token: 0x06002B2D RID: 11053 RVA: 0x0008DA70 File Offset: 0x0008BC70
private void ReadArrayOfPrimitiveType(BinaryReader reader, out long objectId, out object val)
{
objectId = (long)((ulong)reader.ReadUInt32());
int num = reader.ReadInt32();
Type type = this.ReadType(reader, TypeTag.PrimitiveType);
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
{
bool[] array = new bool[num];
for (int i = 0; i < num; i++)
{
array[i] = reader.ReadBoolean();
}
val = array;
return;
}
case TypeCode.Char:
{
char[] array2 = new char[num];
int num2;
for (int j = 0; j < num; j += num2)
{
num2 = reader.Read(array2, j, num - j);
if (num2 == 0)
{
break;
}
}
val = array2;
return;
}
case TypeCode.SByte:
{
sbyte[] array3 = new sbyte[num];
if (num > 2)
{
this.BlockRead(reader, array3, 1);
}
else
{
for (int k = 0; k < num; k++)
{
array3[k] = reader.ReadSByte();
}
}
val = array3;
return;
}
case TypeCode.Byte:
{
byte[] array4 = new byte[num];
int num3;
for (int l = 0; l < num; l += num3)
{
num3 = reader.Read(array4, l, num - l);
if (num3 == 0)
{
break;
}
}
val = array4;
return;
}
case TypeCode.Int16:
{
short[] array5 = new short[num];
if (num > 2)
{
this.BlockRead(reader, array5, 2);
}
else
{
for (int m = 0; m < num; m++)
{
array5[m] = reader.ReadInt16();
}
}
val = array5;
return;
}
case TypeCode.UInt16:
{
ushort[] array6 = new ushort[num];
if (num > 2)
{
this.BlockRead(reader, array6, 2);
}
else
{
for (int n = 0; n < num; n++)
{
array6[n] = reader.ReadUInt16();
}
}
val = array6;
return;
}
case TypeCode.Int32:
{
int[] array7 = new int[num];
if (num > 2)
{
this.BlockRead(reader, array7, 4);
}
else
{
for (int num4 = 0; num4 < num; num4++)
{
array7[num4] = reader.ReadInt32();
}
}
val = array7;
return;
}
case TypeCode.UInt32:
{
uint[] array8 = new uint[num];
if (num > 2)
{
this.BlockRead(reader, array8, 4);
}
else
{
for (int num5 = 0; num5 < num; num5++)
{
array8[num5] = reader.ReadUInt32();
}
}
val = array8;
return;
}
case TypeCode.Int64:
{
long[] array9 = new long[num];
if (num > 2)
{
this.BlockRead(reader, array9, 8);
}
else
{
for (int num6 = 0; num6 < num; num6++)
{
array9[num6] = reader.ReadInt64();
}
}
val = array9;
return;
}
case TypeCode.UInt64:
{
ulong[] array10 = new ulong[num];
if (num > 2)
{
this.BlockRead(reader, array10, 8);
}
else
{
for (int num7 = 0; num7 < num; num7++)
{
array10[num7] = reader.ReadUInt64();
}
}
val = array10;
return;
}
case TypeCode.Single:
{
float[] array11 = new float[num];
if (num > 2)
{
this.BlockRead(reader, array11, 4);
}
else
{
for (int num8 = 0; num8 < num; num8++)
{
array11[num8] = reader.ReadSingle();
}
}
val = array11;
return;
}
case TypeCode.Double:
{
double[] array12 = new double[num];
if (num > 2)
{
this.BlockRead(reader, array12, 8);
}
else
{
for (int num9 = 0; num9 < num; num9++)
{
array12[num9] = reader.ReadDouble();
}
}
val = array12;
return;
}
case TypeCode.Decimal:
{
decimal[] array13 = new decimal[num];
for (int num10 = 0; num10 < num; num10++)
{
array13[num10] = reader.ReadDecimal();
}
val = array13;
return;
}
case TypeCode.DateTime:
{
DateTime[] array14 = new DateTime[num];
for (int num11 = 0; num11 < num; num11++)
{
array14[num11] = DateTime.FromBinary(reader.ReadInt64());
}
val = array14;
return;
}
case TypeCode.String:
{
string[] array15 = new string[num];
for (int num12 = 0; num12 < num; num12++)
{
array15[num12] = reader.ReadString();
}
val = array15;
return;
}
}
if (type != typeof(TimeSpan))
{
throw new NotSupportedException("Unsupported primitive type: " + type.FullName);
}
TimeSpan[] array16 = new TimeSpan[num];
for (int num13 = 0; num13 < num; num13++)
{
array16[num13] = new TimeSpan(reader.ReadInt64());
}
val = array16;
}
// Token: 0x06002B2E RID: 11054 RVA: 0x0008DF40 File Offset: 0x0008C140
private void BlockRead(BinaryReader reader, Array array, int dataSize)
{
int i = Buffer.ByteLength(array);
if (this.arrayBuffer == null || (i > this.arrayBuffer.Length && this.arrayBuffer.Length != this.ArrayBufferLength))
{
this.arrayBuffer = new byte[(i > this.ArrayBufferLength) ? this.ArrayBufferLength : i];
}
int num = 0;
while (i > 0)
{
int num2 = ((i >= this.arrayBuffer.Length) ? this.arrayBuffer.Length : i);
int num3 = 0;
do
{
int num4 = reader.Read(this.arrayBuffer, num3, num2 - num3);
if (num4 == 0)
{
break;
}
num3 += num4;
}
while (num3 < num2);
IL_A6:
if (!BitConverter.IsLittleEndian && dataSize > 1)
{
BinaryCommon.SwapBytes(this.arrayBuffer, num2, dataSize);
}
Buffer.BlockCopy(this.arrayBuffer, 0, array, num, num2);
i -= num2;
num += num2;
continue;
goto IL_A6;
}
}
// Token: 0x06002B2F RID: 11055 RVA: 0x0008E030 File Offset: 0x0008C230
private void ReadArrayOfObject(BinaryReader reader, out long objectId, out object array)
{
this.ReadSimpleArray(reader, typeof(object), out objectId, out array);
}
// Token: 0x06002B30 RID: 11056 RVA: 0x0008E048 File Offset: 0x0008C248
private void ReadArrayOfString(BinaryReader reader, out long objectId, out object array)
{
this.ReadSimpleArray(reader, typeof(string), out objectId, out array);
}
// Token: 0x06002B31 RID: 11057 RVA: 0x0008E060 File Offset: 0x0008C260
private void ReadSimpleArray(BinaryReader reader, Type elementType, out long objectId, out object val)
{
objectId = (long)((ulong)reader.ReadUInt32());
int num = reader.ReadInt32();
int[] array = new int[1];
Array array2 = Array.CreateInstance(elementType, num);
for (int i = 0; i < num; i++)
{
array[0] = i;
this.ReadValue(reader, array2, objectId, null, elementType, null, null, array);
i = array[0];
}
val = array2;
}
// Token: 0x06002B32 RID: 11058 RVA: 0x0008E0BC File Offset: 0x0008C2BC
private ObjectReader.TypeMetadata ReadTypeMetadata(BinaryReader reader, bool isRuntimeObject, bool hasTypeInfo)
{
ObjectReader.TypeMetadata typeMetadata = new ObjectReader.TypeMetadata();
string text = reader.ReadString();
int num = reader.ReadInt32();
Type[] array = new Type[num];
string[] array2 = new string[num];
for (int i = 0; i < num; i++)
{
array2[i] = reader.ReadString();
}
if (hasTypeInfo)
{
TypeTag[] array3 = new TypeTag[num];
for (int j = 0; j < num; j++)
{
array3[j] = (TypeTag)reader.ReadByte();
}
for (int k = 0; k < num; k++)
{
array[k] = this.ReadType(reader, array3[k]);
}
}
if (!isRuntimeObject)
{
long num2 = (long)((ulong)reader.ReadUInt32());
typeMetadata.Type = this.GetDeserializationType(num2, text);
}
else
{
typeMetadata.Type = Type.GetType(text, true);
}
typeMetadata.MemberTypes = array;
typeMetadata.MemberNames = array2;
typeMetadata.FieldCount = array2.Length;
if (this._surrogateSelector != null)
{
ISurrogateSelector surrogateSelector;
ISerializationSurrogate surrogate = this._surrogateSelector.GetSurrogate(typeMetadata.Type, this._context, out surrogateSelector);
typeMetadata.NeedsSerializationInfo = surrogate != null;
}
if (!typeMetadata.NeedsSerializationInfo)
{
if (!typeMetadata.Type.IsSerializable)
{
throw new SerializationException("Serializable objects must be marked with the Serializable attribute");
}
typeMetadata.NeedsSerializationInfo = typeof(ISerializable).IsAssignableFrom(typeMetadata.Type);
if (!typeMetadata.NeedsSerializationInfo)
{
typeMetadata.MemberInfos = new MemberInfo[num];
for (int l = 0; l < num; l++)
{
FieldInfo fieldInfo = null;
string text2 = array2[l];
int num3 = text2.IndexOf('+');
if (num3 != -1)
{
string text3 = array2[l].Substring(0, num3);
text2 = array2[l].Substring(num3 + 1);
for (Type type = typeMetadata.Type.BaseType; type != null; type = type.BaseType)
{
if (type.Name == text3)
{
fieldInfo = type.GetField(text2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
break;
}
}
}
else
{
fieldInfo = typeMetadata.Type.GetField(text2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
if (fieldInfo == null)
{
throw new SerializationException("Field \"" + array2[l] + "\" not found in class " + typeMetadata.Type.FullName);
}
typeMetadata.MemberInfos[l] = fieldInfo;
if (!hasTypeInfo)
{
array[l] = fieldInfo.FieldType;
}
}
typeMetadata.MemberNames = null;
}
}
if (!this._typeMetadataCache.ContainsKey(typeMetadata.Type))
{
this._typeMetadataCache[typeMetadata.Type] = typeMetadata;
}
return typeMetadata;
}
// Token: 0x06002B33 RID: 11059 RVA: 0x0008E360 File Offset: 0x0008C560
private void ReadValue(BinaryReader reader, object parentObject, long parentObjectId, SerializationInfo info, Type valueType, string fieldName, MemberInfo memberInfo, int[] indices)
{
object obj;
if (BinaryCommon.IsPrimitive(valueType))
{
obj = ObjectReader.ReadPrimitiveTypeValue(reader, valueType);
this.SetObjectValue(parentObject, fieldName, memberInfo, info, obj, valueType, indices);
return;
}
BinaryElement binaryElement = (BinaryElement)reader.ReadByte();
if (binaryElement == BinaryElement.ObjectReference)
{
long num = (long)((ulong)reader.ReadUInt32());
this.RecordFixup(parentObjectId, num, parentObject, info, fieldName, memberInfo, indices);
return;
}
long num2;
SerializationInfo serializationInfo;
this.ReadObject(binaryElement, reader, out num2, out obj, out serializationInfo);
bool flag = false;
if (num2 != 0L)
{
if (obj.GetType().IsValueType)
{
this.RecordFixup(parentObjectId, num2, parentObject, info, fieldName, memberInfo, indices);
flag = true;
}
if (info == null && !(parentObject is Array))
{
this.RegisterObject(num2, obj, serializationInfo, parentObjectId, memberInfo, null);
}
else
{
this.RegisterObject(num2, obj, serializationInfo, parentObjectId, null, indices);
}
}
if (!flag)
{
this.SetObjectValue(parentObject, fieldName, memberInfo, info, obj, valueType, indices);
}
}
// Token: 0x06002B34 RID: 11060 RVA: 0x0008E448 File Offset: 0x0008C648
private void SetObjectValue(object parentObject, string fieldName, MemberInfo memberInfo, SerializationInfo info, object value, Type valueType, int[] indices)
{
if (value is IObjectReference)
{
value = ((IObjectReference)value).GetRealObject(this._context);
}
if (parentObject is Array)
{
if (value is ObjectReader.ArrayNullFiller)
{
int nullCount = ((ObjectReader.ArrayNullFiller)value).NullCount;
indices[0] += nullCount - 1;
}
else
{
((Array)parentObject).SetValue(value, indices);
}
}
else if (info != null)
{
info.AddValue(fieldName, value, valueType);
}
else if (memberInfo is FieldInfo)
{
((FieldInfo)memberInfo).SetValue(parentObject, value);
}
else
{
((PropertyInfo)memberInfo).SetValue(parentObject, value, null);
}
}
// Token: 0x06002B35 RID: 11061 RVA: 0x0008E508 File Offset: 0x0008C708
private void RecordFixup(long parentObjectId, long childObjectId, object parentObject, SerializationInfo info, string fieldName, MemberInfo memberInfo, int[] indices)
{
if (info != null)
{
this._manager.RecordDelayedFixup(parentObjectId, fieldName, childObjectId);
}
else if (parentObject is Array)
{
if (indices.Length == 1)
{
this._manager.RecordArrayElementFixup(parentObjectId, indices[0], childObjectId);
}
else
{
this._manager.RecordArrayElementFixup(parentObjectId, (int[])indices.Clone(), childObjectId);
}
}
else
{
this._manager.RecordFixup(parentObjectId, memberInfo, childObjectId);
}
}
// Token: 0x06002B36 RID: 11062 RVA: 0x0008E588 File Offset: 0x0008C788
private Type GetDeserializationType(long assemblyId, string className)
{
string text = (string)this._registeredAssemblies[assemblyId];
Type type;
if (this._binder != null)
{
type = this._binder.BindToType(text, className);
if (type != null)
{
return type;
}
}
Assembly assembly = Assembly.Load(text);
type = assembly.GetType(className, true);
if (type != null)
{
return type;
}
throw new SerializationException("Couldn't find type '" + className + "'.");
}
// Token: 0x06002B37 RID: 11063 RVA: 0x0008E5FC File Offset: 0x0008C7FC
public Type ReadType(BinaryReader reader, TypeTag code)
{
switch (code)
{
case TypeTag.PrimitiveType:
return BinaryCommon.GetTypeFromCode((int)reader.ReadByte());
case TypeTag.String:
return typeof(string);
case TypeTag.ObjectType:
return typeof(object);
case TypeTag.RuntimeType:
{
string text = reader.ReadString();
if (this._context.State == StreamingContextStates.Remoting)
{
if (text == "System.RuntimeType")
{
return typeof(MonoType);
}
if (text == "System.RuntimeType[]")
{
return typeof(MonoType[]);
}
}
Type type = Type.GetType(text);
if (type != null)
{
return type;
}
throw new SerializationException(string.Format("Could not find type '{0}'.", text));
}
case TypeTag.GenericType:
{
string text2 = reader.ReadString();
long num = (long)((ulong)reader.ReadUInt32());
return this.GetDeserializationType(num, text2);
}
case TypeTag.ArrayOfObject:
return typeof(object[]);
case TypeTag.ArrayOfString:
return typeof(string[]);
case TypeTag.ArrayOfPrimitiveType:
{
Type typeFromCode = BinaryCommon.GetTypeFromCode((int)reader.ReadByte());
return Type.GetType(typeFromCode.FullName + "[]");
}
default:
throw new NotSupportedException("Unknow type tag");
}
}
// Token: 0x06002B38 RID: 11064 RVA: 0x0008E728 File Offset: 0x0008C928
public static object ReadPrimitiveTypeValue(BinaryReader reader, Type type)
{
if (type == null)
{
return null;
}
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
return reader.ReadBoolean();
case TypeCode.Char:
return reader.ReadChar();
case TypeCode.SByte:
return reader.ReadSByte();
case TypeCode.Byte:
return reader.ReadByte();
case TypeCode.Int16:
return reader.ReadInt16();
case TypeCode.UInt16:
return reader.ReadUInt16();
case TypeCode.Int32:
return reader.ReadInt32();
case TypeCode.UInt32:
return reader.ReadUInt32();
case TypeCode.Int64:
return reader.ReadInt64();
case TypeCode.UInt64:
return reader.ReadUInt64();
case TypeCode.Single:
return reader.ReadSingle();
case TypeCode.Double:
return reader.ReadDouble();
case TypeCode.Decimal:
return decimal.Parse(reader.ReadString(), CultureInfo.InvariantCulture);
case TypeCode.DateTime:
return DateTime.FromBinary(reader.ReadInt64());
case TypeCode.String:
return reader.ReadString();
}
if (type == typeof(TimeSpan))
{
return new TimeSpan(reader.ReadInt64());
}
throw new NotSupportedException("Unsupported primitive type: " + type.FullName);
}
// Token: 0x040010BC RID: 4284
private ISurrogateSelector _surrogateSelector;
// Token: 0x040010BD RID: 4285
private StreamingContext _context;
// Token: 0x040010BE RID: 4286
private SerializationBinder _binder;
// Token: 0x040010BF RID: 4287
private TypeFilterLevel _filterLevel;
// Token: 0x040010C0 RID: 4288
private ObjectManager _manager;
// Token: 0x040010C1 RID: 4289
private Hashtable _registeredAssemblies = new Hashtable();
// Token: 0x040010C2 RID: 4290
private Hashtable _typeMetadataCache = new Hashtable();
// Token: 0x040010C3 RID: 4291
private object _lastObject;
// Token: 0x040010C4 RID: 4292
private long _lastObjectID;
// Token: 0x040010C5 RID: 4293
private long _rootObjectID;
// Token: 0x040010C6 RID: 4294
private byte[] arrayBuffer;
// Token: 0x040010C7 RID: 4295
private int ArrayBufferLength = 4096;
// Token: 0x02000466 RID: 1126
private class TypeMetadata
{
// Token: 0x040010C8 RID: 4296
public Type Type;
// Token: 0x040010C9 RID: 4297
public Type[] MemberTypes;
// Token: 0x040010CA RID: 4298
public string[] MemberNames;
// Token: 0x040010CB RID: 4299
public MemberInfo[] MemberInfos;
// Token: 0x040010CC RID: 4300
public int FieldCount;
// Token: 0x040010CD RID: 4301
public bool NeedsSerializationInfo;
}
// Token: 0x02000467 RID: 1127
private class ArrayNullFiller
{
// Token: 0x06002B3A RID: 11066 RVA: 0x0008E890 File Offset: 0x0008CA90
public ArrayNullFiller(int count)
{
this.NullCount = count;
}
// Token: 0x040010CE RID: 4302
public int NullCount;
}
}
}
@@ -0,0 +1,846 @@
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200046C RID: 1132
internal class ObjectWriter
{
// Token: 0x06002B4D RID: 11085 RVA: 0x0008ECE8 File Offset: 0x0008CEE8
public ObjectWriter(ISurrogateSelector surrogateSelector, StreamingContext context, FormatterAssemblyStyle assemblyFormat, FormatterTypeStyle typeFormat)
{
this._surrogateSelector = surrogateSelector;
this._context = context;
this._assemblyFormat = assemblyFormat;
this._typeFormat = typeFormat;
this._manager = new SerializationObjectManager(context);
}
// Token: 0x06002B4F RID: 11087 RVA: 0x0008EDA0 File Offset: 0x0008CFA0
public void WriteObjectGraph(BinaryWriter writer, object obj, Header[] headers)
{
this._pendingObjects.Clear();
if (headers != null)
{
this.QueueObject(headers);
}
this.QueueObject(obj);
this.WriteQueuedObjects(writer);
ObjectWriter.WriteSerializationEnd(writer);
this._manager.RaiseOnSerializedEvent();
}
// Token: 0x06002B50 RID: 11088 RVA: 0x0008EDE4 File Offset: 0x0008CFE4
public void QueueObject(object obj)
{
this._pendingObjects.Enqueue(obj);
}
// Token: 0x06002B51 RID: 11089 RVA: 0x0008EDF4 File Offset: 0x0008CFF4
public void WriteQueuedObjects(BinaryWriter writer)
{
while (this._pendingObjects.Count > 0)
{
this.WriteObjectInstance(writer, this._pendingObjects.Dequeue(), false);
}
}
// Token: 0x06002B52 RID: 11090 RVA: 0x0008EE2C File Offset: 0x0008D02C
public void WriteObjectInstance(BinaryWriter writer, object obj, bool isValueObject)
{
long num;
if (isValueObject)
{
num = this._idGenerator.NextId;
}
else
{
bool flag;
num = this._idGenerator.GetId(obj, out flag);
}
if (obj is string)
{
this.WriteString(writer, num, (string)obj);
}
else if (obj is Array)
{
this.WriteArray(writer, num, (Array)obj);
}
else
{
this.WriteObject(writer, num, obj);
}
}
// Token: 0x06002B53 RID: 11091 RVA: 0x0008EEA4 File Offset: 0x0008D0A4
public static void WriteSerializationEnd(BinaryWriter writer)
{
writer.Write(11);
}
// Token: 0x06002B54 RID: 11092 RVA: 0x0008EEB0 File Offset: 0x0008D0B0
private void WriteObject(BinaryWriter writer, long id, object obj)
{
TypeMetadata typeMetadata;
object obj2;
this.GetObjectData(obj, out typeMetadata, out obj2);
ObjectWriter.MetadataReference metadataReference = (ObjectWriter.MetadataReference)this._cachedMetadata[typeMetadata.InstanceTypeName];
if (metadataReference != null && typeMetadata.IsCompatible(metadataReference.Metadata))
{
writer.Write(1);
writer.Write((int)id);
writer.Write((int)metadataReference.ObjectID);
typeMetadata.WriteObjectData(this, writer, obj2);
return;
}
if (metadataReference == null)
{
metadataReference = new ObjectWriter.MetadataReference(typeMetadata, id);
this._cachedMetadata[typeMetadata.InstanceTypeName] = metadataReference;
}
bool flag = typeMetadata.RequiresTypes || this._typeFormat == FormatterTypeStyle.TypesAlways;
BinaryElement binaryElement;
int num;
if (typeMetadata.TypeAssemblyName == ObjectWriter.CorlibAssemblyName)
{
binaryElement = ((!flag) ? BinaryElement.UntypedRuntimeObject : BinaryElement.RuntimeObject);
num = -1;
}
else
{
binaryElement = ((!flag) ? BinaryElement.UntypedExternalObject : BinaryElement.ExternalObject);
num = this.WriteAssemblyName(writer, typeMetadata.TypeAssemblyName);
}
typeMetadata.WriteAssemblies(this, writer);
writer.Write((byte)binaryElement);
writer.Write((int)id);
writer.Write(typeMetadata.InstanceTypeName);
typeMetadata.WriteTypeData(this, writer, flag);
if (num != -1)
{
writer.Write(num);
}
typeMetadata.WriteObjectData(this, writer, obj2);
}
// Token: 0x06002B55 RID: 11093 RVA: 0x0008EFE4 File Offset: 0x0008D1E4
private void GetObjectData(object obj, out TypeMetadata metadata, out object data)
{
Type type = obj.GetType();
if (this._surrogateSelector != null)
{
ISurrogateSelector surrogateSelector;
ISerializationSurrogate surrogate = this._surrogateSelector.GetSurrogate(type, this._context, out surrogateSelector);
if (surrogate != null)
{
SerializationInfo serializationInfo = new SerializationInfo(type, new FormatterConverter());
surrogate.GetObjectData(obj, serializationInfo, this._context);
metadata = new SerializableTypeMetadata(type, serializationInfo);
data = serializationInfo;
return;
}
}
BinaryCommon.CheckSerializable(type, this._surrogateSelector, this._context);
this._manager.RegisterObject(obj);
ISerializable serializable = obj as ISerializable;
if (serializable != null)
{
SerializationInfo serializationInfo2 = new SerializationInfo(type, new FormatterConverter());
serializable.GetObjectData(serializationInfo2, this._context);
metadata = new SerializableTypeMetadata(type, serializationInfo2);
data = serializationInfo2;
}
else
{
data = obj;
if (this._context.Context != null)
{
metadata = new MemberTypeMetadata(type, this._context);
return;
}
bool flag = false;
Hashtable cachedTypes = ObjectWriter._cachedTypes;
Hashtable hashtable;
lock (cachedTypes)
{
hashtable = (Hashtable)ObjectWriter._cachedTypes[this._context.State];
if (hashtable == null)
{
hashtable = new Hashtable();
ObjectWriter._cachedTypes[this._context.State] = hashtable;
flag = true;
}
}
metadata = null;
Hashtable hashtable2 = hashtable;
lock (hashtable2)
{
if (!flag)
{
metadata = (TypeMetadata)hashtable[type];
}
if (metadata == null)
{
metadata = this.CreateMemberTypeMetadata(type);
}
hashtable[type] = metadata;
}
}
}
// Token: 0x06002B56 RID: 11094 RVA: 0x0008F1B0 File Offset: 0x0008D3B0
private TypeMetadata CreateMemberTypeMetadata(Type type)
{
if (!BinaryCommon.UseReflectionSerialization)
{
Type type2 = CodeGenerator.GenerateMetadataType(type, this._context);
return (TypeMetadata)Activator.CreateInstance(type2);
}
return new MemberTypeMetadata(type, this._context);
}
// Token: 0x06002B57 RID: 11095 RVA: 0x0008F1EC File Offset: 0x0008D3EC
private void WriteArray(BinaryWriter writer, long id, Array array)
{
Type elementType = array.GetType().GetElementType();
if (elementType == typeof(object) && array.Rank == 1)
{
this.WriteObjectArray(writer, id, array);
}
else if (elementType == typeof(string) && array.Rank == 1)
{
this.WriteStringArray(writer, id, array);
}
else if (BinaryCommon.IsPrimitive(elementType) && array.Rank == 1)
{
this.WritePrimitiveTypeArray(writer, id, array);
}
else
{
this.WriteGenericArray(writer, id, array);
}
}
// Token: 0x06002B58 RID: 11096 RVA: 0x0008F288 File Offset: 0x0008D488
private void WriteGenericArray(BinaryWriter writer, long id, Array array)
{
Type elementType = array.GetType().GetElementType();
if (!elementType.IsArray)
{
this.WriteAssembly(writer, elementType.Assembly);
}
writer.Write(7);
writer.Write((int)id);
if (elementType.IsArray)
{
writer.Write(1);
}
else if (array.Rank == 1)
{
writer.Write(0);
}
else
{
writer.Write(2);
}
writer.Write(array.Rank);
for (int i = 0; i < array.Rank; i++)
{
writer.Write(array.GetUpperBound(i) + 1);
}
ObjectWriter.WriteTypeCode(writer, elementType);
this.WriteTypeSpec(writer, elementType);
if (array.Rank == 1 && !elementType.IsValueType)
{
this.WriteSingleDimensionArrayElements(writer, array, elementType);
}
else
{
foreach (object obj in array)
{
this.WriteValue(writer, elementType, obj);
}
}
}
// Token: 0x06002B59 RID: 11097 RVA: 0x0008F3C4 File Offset: 0x0008D5C4
private void WriteObjectArray(BinaryWriter writer, long id, Array array)
{
writer.Write(16);
writer.Write((int)id);
writer.Write(array.Length);
this.WriteSingleDimensionArrayElements(writer, array, typeof(object));
}
// Token: 0x06002B5A RID: 11098 RVA: 0x0008F400 File Offset: 0x0008D600
private void WriteStringArray(BinaryWriter writer, long id, Array array)
{
writer.Write(17);
writer.Write((int)id);
writer.Write(array.Length);
this.WriteSingleDimensionArrayElements(writer, array, typeof(string));
}
// Token: 0x06002B5B RID: 11099 RVA: 0x0008F43C File Offset: 0x0008D63C
private void WritePrimitiveTypeArray(BinaryWriter writer, long id, Array array)
{
writer.Write(15);
writer.Write((int)id);
writer.Write(array.Length);
Type elementType = array.GetType().GetElementType();
this.WriteTypeSpec(writer, elementType);
switch (Type.GetTypeCode(elementType))
{
case TypeCode.Boolean:
foreach (bool flag in (bool[])array)
{
writer.Write(flag);
}
return;
case TypeCode.Char:
writer.Write((char[])array);
return;
case TypeCode.SByte:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 1);
}
else
{
foreach (sbyte b in (sbyte[])array)
{
writer.Write(b);
}
}
return;
case TypeCode.Byte:
writer.Write((byte[])array);
return;
case TypeCode.Int16:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 2);
}
else
{
foreach (short num in (short[])array)
{
writer.Write(num);
}
}
return;
case TypeCode.UInt16:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 2);
}
else
{
foreach (ushort num2 in (ushort[])array)
{
writer.Write(num2);
}
}
return;
case TypeCode.Int32:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 4);
}
else
{
foreach (int num3 in (int[])array)
{
writer.Write(num3);
}
}
return;
case TypeCode.UInt32:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 4);
}
else
{
foreach (uint num4 in (uint[])array)
{
writer.Write(num4);
}
}
return;
case TypeCode.Int64:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 8);
}
else
{
foreach (long num6 in (long[])array)
{
writer.Write(num6);
}
}
return;
case TypeCode.UInt64:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 8);
}
else
{
foreach (ulong num8 in (ulong[])array)
{
writer.Write(num8);
}
}
return;
case TypeCode.Single:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 4);
}
else
{
foreach (float num10 in (float[])array)
{
writer.Write(num10);
}
}
return;
case TypeCode.Double:
if (array.Length > 2)
{
this.BlockWrite(writer, array, 8);
}
else
{
foreach (double num12 in (double[])array)
{
writer.Write(num12);
}
}
return;
case TypeCode.Decimal:
foreach (decimal num14 in (decimal[])array)
{
writer.Write(num14);
}
return;
case TypeCode.DateTime:
foreach (DateTime dateTime in (DateTime[])array)
{
writer.Write(dateTime.ToBinary());
}
return;
case TypeCode.String:
foreach (string text in (string[])array)
{
writer.Write(text);
}
return;
}
if (elementType != typeof(TimeSpan))
{
throw new NotSupportedException("Unsupported primitive type: " + elementType.FullName);
}
foreach (TimeSpan timeSpan in (TimeSpan[])array)
{
writer.Write(timeSpan.Ticks);
}
}
// Token: 0x06002B5C RID: 11100 RVA: 0x0008F90C File Offset: 0x0008DB0C
private void BlockWrite(BinaryWriter writer, Array array, int dataSize)
{
int i = Buffer.ByteLength(array);
if (this.arrayBuffer == null || (i > this.arrayBuffer.Length && this.arrayBuffer.Length != this.ArrayBufferLength))
{
this.arrayBuffer = new byte[(i > this.ArrayBufferLength) ? this.ArrayBufferLength : i];
}
int num = 0;
while (i > 0)
{
int num2 = ((i >= this.arrayBuffer.Length) ? this.arrayBuffer.Length : i);
Buffer.BlockCopy(array, num, this.arrayBuffer, 0, num2);
if (!BitConverter.IsLittleEndian && dataSize > 1)
{
BinaryCommon.SwapBytes(this.arrayBuffer, num2, dataSize);
}
writer.Write(this.arrayBuffer, 0, num2);
i -= num2;
num += num2;
}
}
// Token: 0x06002B5D RID: 11101 RVA: 0x0008F9E0 File Offset: 0x0008DBE0
private void WriteSingleDimensionArrayElements(BinaryWriter writer, Array array, Type elementType)
{
int num = 0;
foreach (object obj in array)
{
if (obj != null && num > 0)
{
this.WriteNullFiller(writer, num);
this.WriteValue(writer, elementType, obj);
num = 0;
}
else if (obj == null)
{
num++;
}
else
{
this.WriteValue(writer, elementType, obj);
}
}
if (num > 0)
{
this.WriteNullFiller(writer, num);
}
}
// Token: 0x06002B5E RID: 11102 RVA: 0x0008FA8C File Offset: 0x0008DC8C
private void WriteNullFiller(BinaryWriter writer, int numNulls)
{
if (numNulls == 1)
{
writer.Write(10);
}
else if (numNulls == 2)
{
writer.Write(10);
writer.Write(10);
}
else if (numNulls <= 255)
{
writer.Write(13);
writer.Write((byte)numNulls);
}
else
{
writer.Write(14);
writer.Write(numNulls);
}
}
// Token: 0x06002B5F RID: 11103 RVA: 0x0008FAF8 File Offset: 0x0008DCF8
private void WriteObjectReference(BinaryWriter writer, long id)
{
writer.Write(9);
writer.Write((int)id);
}
// Token: 0x06002B60 RID: 11104 RVA: 0x0008FB0C File Offset: 0x0008DD0C
public void WriteValue(BinaryWriter writer, Type valueType, object val)
{
if (val == null)
{
BinaryCommon.CheckSerializable(valueType, this._surrogateSelector, this._context);
writer.Write(10);
}
else if (BinaryCommon.IsPrimitive(val.GetType()))
{
if (!BinaryCommon.IsPrimitive(valueType))
{
writer.Write(8);
this.WriteTypeSpec(writer, val.GetType());
}
ObjectWriter.WritePrimitiveValue(writer, val);
}
else if (valueType.IsValueType)
{
this.WriteObjectInstance(writer, val, true);
}
else if (val is string)
{
bool flag;
long id = this._idGenerator.GetId(val, out flag);
if (flag)
{
this.WriteObjectInstance(writer, val, false);
}
else
{
this.WriteObjectReference(writer, id);
}
}
else
{
bool flag2;
long id2 = this._idGenerator.GetId(val, out flag2);
if (flag2)
{
this._pendingObjects.Enqueue(val);
}
this.WriteObjectReference(writer, id2);
}
}
// Token: 0x06002B61 RID: 11105 RVA: 0x0008FBF8 File Offset: 0x0008DDF8
private void WriteString(BinaryWriter writer, long id, string str)
{
writer.Write(6);
writer.Write((int)id);
writer.Write(str);
}
// Token: 0x06002B62 RID: 11106 RVA: 0x0008FC1C File Offset: 0x0008DE1C
public int WriteAssembly(BinaryWriter writer, Assembly assembly)
{
return this.WriteAssemblyName(writer, assembly.FullName);
}
// Token: 0x06002B63 RID: 11107 RVA: 0x0008FC2C File Offset: 0x0008DE2C
public int WriteAssemblyName(BinaryWriter writer, string assembly)
{
if (assembly == ObjectWriter.CorlibAssemblyName)
{
return -1;
}
bool flag;
int num = this.RegisterAssembly(assembly, out flag);
if (!flag)
{
return num;
}
writer.Write(12);
writer.Write(num);
if (this._assemblyFormat == FormatterAssemblyStyle.Full)
{
writer.Write(assembly);
}
else
{
int num2 = assembly.IndexOf(',');
if (num2 != -1)
{
assembly = assembly.Substring(0, num2);
}
writer.Write(assembly);
}
return num;
}
// Token: 0x06002B64 RID: 11108 RVA: 0x0008FCA8 File Offset: 0x0008DEA8
public int GetAssemblyId(Assembly assembly)
{
return this.GetAssemblyNameId(assembly.FullName);
}
// Token: 0x06002B65 RID: 11109 RVA: 0x0008FCB8 File Offset: 0x0008DEB8
public int GetAssemblyNameId(string assembly)
{
return (int)this._assemblyCache[assembly];
}
// Token: 0x06002B66 RID: 11110 RVA: 0x0008FCCC File Offset: 0x0008DECC
private int RegisterAssembly(string assembly, out bool firstTime)
{
if (this._assemblyCache.ContainsKey(assembly))
{
firstTime = false;
return (int)this._assemblyCache[assembly];
}
int num = (int)this._idGenerator.GetId(0, out firstTime);
this._assemblyCache.Add(assembly, num);
return num;
}
// Token: 0x06002B67 RID: 11111 RVA: 0x0008FD28 File Offset: 0x0008DF28
public static void WritePrimitiveValue(BinaryWriter writer, object value)
{
Type type = value.GetType();
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
writer.Write((bool)value);
return;
case TypeCode.Char:
writer.Write((char)value);
return;
case TypeCode.SByte:
writer.Write((sbyte)value);
return;
case TypeCode.Byte:
writer.Write((byte)value);
return;
case TypeCode.Int16:
writer.Write((short)value);
return;
case TypeCode.UInt16:
writer.Write((ushort)value);
return;
case TypeCode.Int32:
writer.Write((int)value);
return;
case TypeCode.UInt32:
writer.Write((uint)value);
return;
case TypeCode.Int64:
writer.Write((long)value);
return;
case TypeCode.UInt64:
writer.Write((ulong)value);
return;
case TypeCode.Single:
writer.Write((float)value);
return;
case TypeCode.Double:
writer.Write((double)value);
return;
case TypeCode.Decimal:
writer.Write(((decimal)value).ToString(CultureInfo.InvariantCulture));
return;
case TypeCode.DateTime:
writer.Write(((DateTime)value).ToBinary());
return;
case TypeCode.String:
writer.Write((string)value);
return;
}
if (type != typeof(TimeSpan))
{
throw new NotSupportedException("Unsupported primitive type: " + value.GetType().FullName);
}
writer.Write(((TimeSpan)value).Ticks);
}
// Token: 0x06002B68 RID: 11112 RVA: 0x0008FEF0 File Offset: 0x0008E0F0
public static void WriteTypeCode(BinaryWriter writer, Type type)
{
writer.Write((byte)ObjectWriter.GetTypeTag(type));
}
// Token: 0x06002B69 RID: 11113 RVA: 0x0008FF00 File Offset: 0x0008E100
public static TypeTag GetTypeTag(Type type)
{
if (type == typeof(string))
{
return TypeTag.String;
}
if (BinaryCommon.IsPrimitive(type))
{
return TypeTag.PrimitiveType;
}
if (type == typeof(object))
{
return TypeTag.ObjectType;
}
if (type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof(object))
{
return TypeTag.ArrayOfObject;
}
if (type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof(string))
{
return TypeTag.ArrayOfString;
}
if (type.IsArray && type.GetArrayRank() == 1 && BinaryCommon.IsPrimitive(type.GetElementType()))
{
return TypeTag.ArrayOfPrimitiveType;
}
if (type.Assembly == ObjectWriter.CorlibAssembly)
{
return TypeTag.RuntimeType;
}
return TypeTag.GenericType;
}
// Token: 0x06002B6A RID: 11114 RVA: 0x0008FFD8 File Offset: 0x0008E1D8
public void WriteTypeSpec(BinaryWriter writer, Type type)
{
switch (ObjectWriter.GetTypeTag(type))
{
case TypeTag.PrimitiveType:
writer.Write(BinaryCommon.GetTypeCode(type));
break;
case TypeTag.RuntimeType:
{
string text = type.FullName;
if (this._context.State == StreamingContextStates.Remoting)
{
if (type == typeof(MonoType))
{
text = "System.RuntimeType";
}
else if (type == typeof(MonoType[]))
{
text = "System.RuntimeType[]";
}
}
writer.Write(text);
break;
}
case TypeTag.GenericType:
writer.Write(type.FullName);
writer.Write(this.GetAssemblyId(type.Assembly));
break;
case TypeTag.ArrayOfPrimitiveType:
writer.Write(BinaryCommon.GetTypeCode(type.GetElementType()));
break;
}
}
// Token: 0x040010D5 RID: 4309
private ObjectIDGenerator _idGenerator = new ObjectIDGenerator();
// Token: 0x040010D6 RID: 4310
private Hashtable _cachedMetadata = new Hashtable();
// Token: 0x040010D7 RID: 4311
private Queue _pendingObjects = new Queue();
// Token: 0x040010D8 RID: 4312
private Hashtable _assemblyCache = new Hashtable();
// Token: 0x040010D9 RID: 4313
private static Hashtable _cachedTypes = new Hashtable();
// Token: 0x040010DA RID: 4314
internal static Assembly CorlibAssembly = typeof(string).Assembly;
// Token: 0x040010DB RID: 4315
internal static string CorlibAssemblyName = typeof(string).Assembly.FullName;
// Token: 0x040010DC RID: 4316
private ISurrogateSelector _surrogateSelector;
// Token: 0x040010DD RID: 4317
private StreamingContext _context;
// Token: 0x040010DE RID: 4318
private FormatterAssemblyStyle _assemblyFormat;
// Token: 0x040010DF RID: 4319
private FormatterTypeStyle _typeFormat;
// Token: 0x040010E0 RID: 4320
private byte[] arrayBuffer;
// Token: 0x040010E1 RID: 4321
private int ArrayBufferLength = 4096;
// Token: 0x040010E2 RID: 4322
private SerializationObjectManager _manager;
// Token: 0x0200046D RID: 1133
private class MetadataReference
{
// Token: 0x06002B6B RID: 11115 RVA: 0x000900BC File Offset: 0x0008E2BC
public MetadataReference(TypeMetadata metadata, long id)
{
this.Metadata = metadata;
this.ObjectID = id;
}
// Token: 0x040010E3 RID: 4323
public TypeMetadata Metadata;
// Token: 0x040010E4 RID: 4324
public long ObjectID;
}
}
}
@@ -0,0 +1,17 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000460 RID: 1120
internal enum ReturnTypeTag : byte
{
// Token: 0x0400109D RID: 4253
Null = 2,
// Token: 0x0400109E RID: 4254
PrimitiveType = 8,
// Token: 0x0400109F RID: 4255
ObjectType = 16,
// Token: 0x040010A0 RID: 4256
Exception = 32
}
}
@@ -0,0 +1,119 @@
using System;
using System.IO;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200046A RID: 1130
internal class SerializableTypeMetadata : TypeMetadata
{
// Token: 0x06002B43 RID: 11075 RVA: 0x0008E8E8 File Offset: 0x0008CAE8
public SerializableTypeMetadata(Type itype, SerializationInfo info)
{
this.types = new Type[info.MemberCount];
this.names = new string[info.MemberCount];
SerializationInfoEnumerator enumerator = info.GetEnumerator();
int num = 0;
while (enumerator.MoveNext())
{
this.types[num] = enumerator.ObjectType;
this.names[num] = enumerator.Name;
num++;
}
this.TypeAssemblyName = info.AssemblyName;
this.InstanceTypeName = info.FullTypeName;
}
// Token: 0x06002B44 RID: 11076 RVA: 0x0008E970 File Offset: 0x0008CB70
public override bool IsCompatible(TypeMetadata other)
{
if (!(other is SerializableTypeMetadata))
{
return false;
}
SerializableTypeMetadata serializableTypeMetadata = (SerializableTypeMetadata)other;
if (this.types.Length != serializableTypeMetadata.types.Length)
{
return false;
}
if (this.TypeAssemblyName != serializableTypeMetadata.TypeAssemblyName)
{
return false;
}
if (this.InstanceTypeName != serializableTypeMetadata.InstanceTypeName)
{
return false;
}
for (int i = 0; i < this.types.Length; i++)
{
if (this.types[i] != serializableTypeMetadata.types[i])
{
return false;
}
if (this.names[i] != serializableTypeMetadata.names[i])
{
return false;
}
}
return true;
}
// Token: 0x06002B45 RID: 11077 RVA: 0x0008EA28 File Offset: 0x0008CC28
public override void WriteAssemblies(ObjectWriter ow, BinaryWriter writer)
{
foreach (Type type in this.types)
{
Type type2 = type;
while (type2.IsArray)
{
type2 = type2.GetElementType();
}
ow.WriteAssembly(writer, type2.Assembly);
}
}
// Token: 0x06002B46 RID: 11078 RVA: 0x0008EA7C File Offset: 0x0008CC7C
public override void WriteTypeData(ObjectWriter ow, BinaryWriter writer, bool writeTypes)
{
writer.Write(this.types.Length);
foreach (string text in this.names)
{
writer.Write(text);
}
foreach (Type type in this.types)
{
ObjectWriter.WriteTypeCode(writer, type);
}
foreach (Type type2 in this.types)
{
ow.WriteTypeSpec(writer, type2);
}
}
// Token: 0x06002B47 RID: 11079 RVA: 0x0008EB1C File Offset: 0x0008CD1C
public override void WriteObjectData(ObjectWriter ow, BinaryWriter writer, object data)
{
SerializationInfo serializationInfo = (SerializationInfo)data;
SerializationInfoEnumerator enumerator = serializationInfo.GetEnumerator();
while (enumerator.MoveNext())
{
ow.WriteValue(writer, enumerator.ObjectType, enumerator.Value);
}
}
// Token: 0x1700087E RID: 2174
// (get) Token: 0x06002B48 RID: 11080 RVA: 0x0008EB5C File Offset: 0x0008CD5C
public override bool RequiresTypes
{
get
{
return true;
}
}
// Token: 0x040010D2 RID: 4306
private Type[] types;
// Token: 0x040010D3 RID: 4307
private string[] names;
}
}
@@ -0,0 +1,34 @@
using System;
using System.IO;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x02000468 RID: 1128
internal abstract class TypeMetadata
{
// Token: 0x06002B3C RID: 11068
public abstract void WriteAssemblies(ObjectWriter ow, BinaryWriter writer);
// Token: 0x06002B3D RID: 11069
public abstract void WriteTypeData(ObjectWriter ow, BinaryWriter writer, bool writeTypes);
// Token: 0x06002B3E RID: 11070
public abstract void WriteObjectData(ObjectWriter ow, BinaryWriter writer, object data);
// Token: 0x06002B3F RID: 11071 RVA: 0x0008E8A8 File Offset: 0x0008CAA8
public virtual bool IsCompatible(TypeMetadata other)
{
return true;
}
// Token: 0x1700087C RID: 2172
// (get) Token: 0x06002B40 RID: 11072
public abstract bool RequiresTypes { get; }
// Token: 0x040010CF RID: 4303
public string TypeAssemblyName;
// Token: 0x040010D0 RID: 4304
public string InstanceTypeName;
}
}
@@ -0,0 +1,25 @@
using System;
namespace System.Runtime.Serialization.Formatters.Binary
{
// Token: 0x0200045D RID: 1117
internal enum TypeTag : byte
{
// Token: 0x04001085 RID: 4229
PrimitiveType,
// Token: 0x04001086 RID: 4230
String,
// Token: 0x04001087 RID: 4231
ObjectType,
// Token: 0x04001088 RID: 4232
RuntimeType,
// Token: 0x04001089 RID: 4233
GenericType,
// Token: 0x0400108A RID: 4234
ArrayOfObject,
// Token: 0x0400108B RID: 4235
ArrayOfString,
// Token: 0x0400108C RID: 4236
ArrayOfPrimitiveType
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Indicates the method that will be used during deserialization for locating and loading assemblies.</summary>
// Token: 0x0200046E RID: 1134
[ComVisible(true)]
[Serializable]
public enum FormatterAssemblyStyle
{
/// <summary>In simple mode, the assembly used during deserialization need not match exactly the assembly used during serialization. Specifically, the version numbers need not match as the <see cref="Overload:System.Reflection.Assembly.LoadWithPartialName" /> method is used to load the assembly.</summary>
// Token: 0x040010E6 RID: 4326
Simple,
/// <summary>In full mode, the assembly used during deserialization must match exactly the assembly used during serialization. The <see cref="Overload:System.Reflection.Assembly.Load" /> method of the <see cref="T:System.Reflection.Assembly" /> class is used to load the assembly.</summary>
// Token: 0x040010E7 RID: 4327
Full
}
}
@@ -0,0 +1,22 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Indicates the format in which type descriptions are laid out in the serialized stream.</summary>
// Token: 0x0200046F RID: 1135
[ComVisible(true)]
[Serializable]
public enum FormatterTypeStyle
{
/// <summary>Indicates that types can be stated only for arrays of objects, object members of type <see cref="T:System.Object" />, and <see cref="T:System.Runtime.Serialization.ISerializable" /> non-primitive value types.</summary>
// Token: 0x040010E9 RID: 4329
TypesWhenNeeded,
/// <summary>Indicates that types can be given to all object members and <see cref="T:System.Runtime.Serialization.ISerializable" /> object members.</summary>
// Token: 0x040010EA RID: 4330
TypesAlways,
/// <summary>Indicates that strings can be given in the XSD format rather than SOAP. No string IDs are transmitted. </summary>
// Token: 0x040010EB RID: 4331
XsdString
}
}
@@ -0,0 +1,33 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Allows access to field names and field types of objects that support the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface.</summary>
// Token: 0x02000470 RID: 1136
[ComVisible(true)]
public interface IFieldInfo
{
/// <summary>Gets or sets the field names of serialized objects.</summary>
/// <returns>The field names of serialized objects.</returns>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x1700087F RID: 2175
// (get) Token: 0x06002B6C RID: 11116
// (set) Token: 0x06002B6D RID: 11117
string[] FieldNames { get; set; }
/// <summary>Gets or sets the field types of the serialized objects.</summary>
/// <returns>The field types of the serialized objects.</returns>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x17000880 RID: 2176
// (get) Token: 0x06002B6E RID: 11118
// (set) Token: 0x06002B6F RID: 11119
Type[] FieldTypes { get; set; }
}
}
@@ -0,0 +1,54 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Provides an interface for an object that contains the names and types of parameters required during serialization of a SOAP RPC (Remote Procedure Call).</summary>
// Token: 0x02000471 RID: 1137
[ComVisible(true)]
public interface ISoapMessage
{
/// <summary>Gets or sets the out-of-band data of the method call.</summary>
/// <returns>The out-of-band data of the method call.</returns>
// Token: 0x17000881 RID: 2177
// (get) Token: 0x06002B70 RID: 11120
// (set) Token: 0x06002B71 RID: 11121
Header[] Headers { get; set; }
/// <summary>Gets or sets the name of the called method.</summary>
/// <returns>The name of the called method.</returns>
// Token: 0x17000882 RID: 2178
// (get) Token: 0x06002B72 RID: 11122
// (set) Token: 0x06002B73 RID: 11123
string MethodName { get; set; }
/// <summary>Gets or sets the parameter names of the method call.</summary>
/// <returns>The parameter names of the method call.</returns>
// Token: 0x17000883 RID: 2179
// (get) Token: 0x06002B74 RID: 11124
// (set) Token: 0x06002B75 RID: 11125
string[] ParamNames { get; set; }
/// <summary>Gets or sets the parameter types of a method call.</summary>
/// <returns>The parameter types of a method call.</returns>
// Token: 0x17000884 RID: 2180
// (get) Token: 0x06002B76 RID: 11126
// (set) Token: 0x06002B77 RID: 11127
Type[] ParamTypes { get; set; }
/// <summary>Gets or sets the parameter values of a method call.</summary>
/// <returns>The parameter values of a method call.</returns>
// Token: 0x17000885 RID: 2181
// (get) Token: 0x06002B78 RID: 11128
// (set) Token: 0x06002B79 RID: 11129
object[] ParamValues { get; set; }
/// <summary>Gets or sets the XML namespace of the SOAP RPC (Remote Procedure Call) <see cref="P:System.Runtime.Serialization.Formatters.ISoapMessage.MethodName" /> element.</summary>
/// <returns>The XML namespace name where the object that contains the called method is located.</returns>
// Token: 0x17000886 RID: 2182
// (get) Token: 0x06002B7A RID: 11130
// (set) Token: 0x06002B7B RID: 11131
string XmlNameSpace { get; set; }
}
}
@@ -0,0 +1,35 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Logs tracing messages when the .NET Framework serialization infrastructure is compiled.</summary>
// Token: 0x02000472 RID: 1138
[ComVisible(true)]
public sealed class InternalRM
{
/// <summary>Prints SOAP trace messages.</summary>
/// <param name="messages"></param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="00000000000000000400000000000000" Name="System.Runtime.Remoting" />
/// </PermissionSet>
// Token: 0x06002B7D RID: 11133 RVA: 0x000900DC File Offset: 0x0008E2DC
[Conditional("_LOGGING")]
public static void InfoSoap(params object[] messages)
{
throw new NotImplementedException();
}
/// <summary>Checks if SOAP tracing is enabled.</summary>
/// <returns>true, if tracing is enabled; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="00000000000000000400000000000000" Name="System.Runtime.Remoting" />
/// </PermissionSet>
// Token: 0x06002B7E RID: 11134 RVA: 0x000900E4 File Offset: 0x0008E2E4
public static bool SoapCheckEnabled()
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,92 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Logs tracing messages when the .NET Framework serialization infrastructure is compiled.</summary>
// Token: 0x02000473 RID: 1139
[ComVisible(true)]
public sealed class InternalST
{
// Token: 0x06002B7F RID: 11135 RVA: 0x000900EC File Offset: 0x0008E2EC
private InternalST()
{
}
/// <summary>Prints SOAP trace messages.</summary>
/// <param name="messages">An array of trace messages to print.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293" Name="System.Runtime.Serialization.Formatters.Soap" />
/// </PermissionSet>
// Token: 0x06002B80 RID: 11136 RVA: 0x000900F4 File Offset: 0x0008E2F4
[Conditional("_LOGGING")]
public static void InfoSoap(params object[] messages)
{
throw new NotImplementedException();
}
/// <summary>Loads a specified assembly to debug.</summary>
/// <returns>The <see cref="T:System.Reflection.Assembly" /> to debug.</returns>
/// <param name="assemblyString">The name of the assembly to load.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293" Name="System.Runtime.Serialization.Formatters.Soap" />
/// </PermissionSet>
// Token: 0x06002B81 RID: 11137 RVA: 0x000900FC File Offset: 0x0008E2FC
public static Assembly LoadAssemblyFromString(string assemblyString)
{
throw new NotImplementedException();
}
/// <summary>Sets the value of a field.</summary>
/// <param name="fi">A <see cref="T:System.Reflection.FieldInfo" /> containing data about the target field.</param>
/// <param name="target">The field to change.</param>
/// <param name="value">The value to set.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293" Name="System.Runtime.Serialization.Formatters.Soap" />
/// </PermissionSet>
// Token: 0x06002B82 RID: 11138 RVA: 0x00090104 File Offset: 0x0008E304
public static void SerializationSetValue(FieldInfo fi, object target, object value)
{
throw new NotImplementedException();
}
/// <summary>Processes the specified array of messages.</summary>
/// <param name="messages">An array of messages to process.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293" Name="System.Runtime.Serialization.Formatters.Soap" />
/// </PermissionSet>
// Token: 0x06002B83 RID: 11139 RVA: 0x0009010C File Offset: 0x0008E30C
[Conditional("SER_LOGGING")]
public static void Soap(params object[] messages)
{
throw new NotImplementedException();
}
/// <summary>Asserts the specified message.</summary>
/// <param name="condition">A Boolean value to use when asserting.</param>
/// <param name="message">The message to use when asserting.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293" Name="System.Runtime.Serialization.Formatters.Soap" />
/// </PermissionSet>
// Token: 0x06002B84 RID: 11140 RVA: 0x00090114 File Offset: 0x0008E314
[Conditional("_DEBUG")]
public static void SoapAssert(bool condition, string message)
{
throw new NotImplementedException();
}
/// <summary>Checks if SOAP tracing is enabled.</summary>
/// <returns>true, if tracing is enabled; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293" Name="System.Runtime.Serialization.Formatters.Soap" />
/// </PermissionSet>
// Token: 0x06002B85 RID: 11141 RVA: 0x0009011C File Offset: 0x0008E31C
public static bool SoapCheckEnabled()
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,89 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Metadata;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Contains information for a server fault. This class cannot be inherited.</summary>
// Token: 0x02000474 RID: 1140
[SoapType]
[ComVisible(true)]
[Serializable]
public sealed class ServerFault
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Formatters.ServerFault" /> class.</summary>
/// <param name="exceptionType">The type of the exception that occurred on the server. </param>
/// <param name="message">The message that accompanied the exception. </param>
/// <param name="stackTrace">The stack trace of the thread that threw the exception on the server. </param>
// Token: 0x06002B86 RID: 11142 RVA: 0x00090124 File Offset: 0x0008E324
public ServerFault(string exceptionType, string message, string stackTrace)
{
this.exceptionType = exceptionType;
this.message = message;
this.stackTrace = stackTrace;
}
/// <summary>Gets or sets the type of exception that was thrown by the server.</summary>
/// <returns>The type of exception that was thrown by the server.</returns>
// Token: 0x17000887 RID: 2183
// (get) Token: 0x06002B87 RID: 11143 RVA: 0x00090144 File Offset: 0x0008E344
// (set) Token: 0x06002B88 RID: 11144 RVA: 0x0009014C File Offset: 0x0008E34C
public string ExceptionType
{
get
{
return this.exceptionType;
}
set
{
this.exceptionType = value;
}
}
/// <summary>Gets or sets the exception message that accompanied the exception thrown on the server.</summary>
/// <returns>The exception message that accompanied the exception thrown on the server.</returns>
// Token: 0x17000888 RID: 2184
// (get) Token: 0x06002B89 RID: 11145 RVA: 0x00090158 File Offset: 0x0008E358
// (set) Token: 0x06002B8A RID: 11146 RVA: 0x00090160 File Offset: 0x0008E360
public string ExceptionMessage
{
get
{
return this.message;
}
set
{
this.message = value;
}
}
/// <summary>Gets or sets the stack trace of the thread that threw the exception on the server.</summary>
/// <returns>The stack trace of the thread that threw the exception on the server.</returns>
// Token: 0x17000889 RID: 2185
// (get) Token: 0x06002B8B RID: 11147 RVA: 0x0009016C File Offset: 0x0008E36C
// (set) Token: 0x06002B8C RID: 11148 RVA: 0x00090174 File Offset: 0x0008E374
public string StackTrace
{
get
{
return this.stackTrace;
}
set
{
this.stackTrace = value;
}
}
// Token: 0x040010EC RID: 4332
private string exceptionType;
// Token: 0x040010ED RID: 4333
private string message;
// Token: 0x040010EE RID: 4334
private string stackTrace;
// Token: 0x040010EF RID: 4335
private Exception exception;
}
}
@@ -0,0 +1,133 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Metadata;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Carries error and status information within a SOAP message. This class cannot be inherited.</summary>
// Token: 0x02000475 RID: 1141
[SoapType]
[ComVisible(true)]
[Serializable]
public sealed class SoapFault : ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" /> class with default values.</summary>
// Token: 0x06002B8D RID: 11149 RVA: 0x00090180 File Offset: 0x0008E380
public SoapFault()
{
}
// Token: 0x06002B8E RID: 11150 RVA: 0x00090188 File Offset: 0x0008E388
private SoapFault(SerializationInfo info, StreamingContext context)
{
this.code = info.GetString("faultcode");
this.faultString = info.GetString("faultstring");
this.detail = info.GetValue("detail", typeof(object));
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" /> class, setting the properties to specified values.</summary>
/// <param name="faultCode">The fault code for the new instance of <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />. The fault code identifies the type of the fault that occurred. </param>
/// <param name="faultString">The fault string for the new instance of <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />. The fault string provides a human readable explanation of the fault. </param>
/// <param name="faultActor">The URI of the object that generated the fault. </param>
/// <param name="serverFault">The description of a common language runtime exception. This information is also present in the <see cref="P:System.Runtime.Serialization.Formatters.SoapFault.Detail" /> property. </param>
// Token: 0x06002B8F RID: 11151 RVA: 0x000901D8 File Offset: 0x0008E3D8
public SoapFault(string faultCode, string faultString, string faultActor, ServerFault serverFault)
{
this.code = faultCode;
this.actor = faultActor;
this.faultString = faultString;
this.detail = serverFault;
}
/// <summary>Gets or sets additional information required for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</summary>
/// <returns>Additional information required for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</returns>
// Token: 0x1700088A RID: 2186
// (get) Token: 0x06002B90 RID: 11152 RVA: 0x00090200 File Offset: 0x0008E400
// (set) Token: 0x06002B91 RID: 11153 RVA: 0x00090208 File Offset: 0x0008E408
public object Detail
{
get
{
return this.detail;
}
set
{
this.detail = value;
}
}
/// <summary>Gets or sets the fault actor for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</summary>
/// <returns>The fault actor for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</returns>
// Token: 0x1700088B RID: 2187
// (get) Token: 0x06002B92 RID: 11154 RVA: 0x00090214 File Offset: 0x0008E414
// (set) Token: 0x06002B93 RID: 11155 RVA: 0x0009021C File Offset: 0x0008E41C
public string FaultActor
{
get
{
return this.actor;
}
set
{
this.actor = value;
}
}
/// <summary>Gets or sets the fault code for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</summary>
/// <returns>The fault code for this <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</returns>
// Token: 0x1700088C RID: 2188
// (get) Token: 0x06002B94 RID: 11156 RVA: 0x00090228 File Offset: 0x0008E428
// (set) Token: 0x06002B95 RID: 11157 RVA: 0x00090230 File Offset: 0x0008E430
public string FaultCode
{
get
{
return this.code;
}
set
{
this.code = value;
}
}
/// <summary>Gets or sets the fault message for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</summary>
/// <returns>The fault message for the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" />.</returns>
// Token: 0x1700088D RID: 2189
// (get) Token: 0x06002B96 RID: 11158 RVA: 0x0009023C File Offset: 0x0008E43C
// (set) Token: 0x06002B97 RID: 11159 RVA: 0x00090244 File Offset: 0x0008E444
public string FaultString
{
get
{
return this.faultString;
}
set
{
this.faultString = value;
}
}
/// <summary>Populates the specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data to serialize the <see cref="T:System.Runtime.Serialization.Formatters.SoapFault" /> object.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for the current serialization. </param>
// Token: 0x06002B98 RID: 11160 RVA: 0x00090250 File Offset: 0x0008E450
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("faultcode", this.code, typeof(string));
info.AddValue("faultstring", this.faultString, typeof(string));
info.AddValue("detail", this.detail, typeof(object));
}
// Token: 0x040010F0 RID: 4336
private string code;
// Token: 0x040010F1 RID: 4337
private string actor;
// Token: 0x040010F2 RID: 4338
private string faultString;
// Token: 0x040010F3 RID: 4339
private object detail;
}
}
@@ -0,0 +1,133 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Holds the names and types of parameters required during serialization of a SOAP RPC (Remote Procedure Call).</summary>
// Token: 0x02000476 RID: 1142
[ComVisible(true)]
[Serializable]
public class SoapMessage : ISoapMessage
{
/// <summary>Gets or sets the out-of-band data of the called method.</summary>
/// <returns>The out-of-band data of the called method.</returns>
// Token: 0x1700088E RID: 2190
// (get) Token: 0x06002B9A RID: 11162 RVA: 0x000902B8 File Offset: 0x0008E4B8
// (set) Token: 0x06002B9B RID: 11163 RVA: 0x000902C0 File Offset: 0x0008E4C0
public Header[] Headers
{
get
{
return this.headers;
}
set
{
this.headers = value;
}
}
/// <summary>Gets or sets the name of the called method.</summary>
/// <returns>The name of the called method.</returns>
// Token: 0x1700088F RID: 2191
// (get) Token: 0x06002B9C RID: 11164 RVA: 0x000902CC File Offset: 0x0008E4CC
// (set) Token: 0x06002B9D RID: 11165 RVA: 0x000902D4 File Offset: 0x0008E4D4
public string MethodName
{
get
{
return this.methodName;
}
set
{
this.methodName = value;
}
}
/// <summary>Gets or sets the parameter names for the called method.</summary>
/// <returns>The parameter names for the called method.</returns>
// Token: 0x17000890 RID: 2192
// (get) Token: 0x06002B9E RID: 11166 RVA: 0x000902E0 File Offset: 0x0008E4E0
// (set) Token: 0x06002B9F RID: 11167 RVA: 0x000902E8 File Offset: 0x0008E4E8
public string[] ParamNames
{
get
{
return this.paramNames;
}
set
{
this.paramNames = value;
}
}
/// <summary>This property is reserved. Use the <see cref="P:System.Runtime.Serialization.Formatters.SoapMessage.ParamNames" /> and/or <see cref="P:System.Runtime.Serialization.Formatters.SoapMessage.ParamValues" /> properties instead.</summary>
/// <returns>Parameter types for the called method.</returns>
// Token: 0x17000891 RID: 2193
// (get) Token: 0x06002BA0 RID: 11168 RVA: 0x000902F4 File Offset: 0x0008E4F4
// (set) Token: 0x06002BA1 RID: 11169 RVA: 0x000902FC File Offset: 0x0008E4FC
public Type[] ParamTypes
{
get
{
return this.paramTypes;
}
set
{
this.paramTypes = value;
}
}
/// <summary>Gets or sets the parameter values for the called method.</summary>
/// <returns>Parameter values for the called method.</returns>
// Token: 0x17000892 RID: 2194
// (get) Token: 0x06002BA2 RID: 11170 RVA: 0x00090308 File Offset: 0x0008E508
// (set) Token: 0x06002BA3 RID: 11171 RVA: 0x00090310 File Offset: 0x0008E510
public object[] ParamValues
{
get
{
return this.paramValues;
}
set
{
this.paramValues = value;
}
}
/// <summary>Gets or sets the XML namespace name where the object that contains the called method is located.</summary>
/// <returns>The XML namespace name where the object that contains the called method is located.</returns>
// Token: 0x17000893 RID: 2195
// (get) Token: 0x06002BA4 RID: 11172 RVA: 0x0009031C File Offset: 0x0008E51C
// (set) Token: 0x06002BA5 RID: 11173 RVA: 0x00090324 File Offset: 0x0008E524
public string XmlNameSpace
{
get
{
return this.xmlNameSpace;
}
set
{
this.xmlNameSpace = value;
}
}
// Token: 0x040010F4 RID: 4340
private Header[] headers;
// Token: 0x040010F5 RID: 4341
private string methodName;
// Token: 0x040010F6 RID: 4342
private string[] paramNames;
// Token: 0x040010F7 RID: 4343
private Type[] paramTypes;
// Token: 0x040010F8 RID: 4344
private object[] paramValues;
// Token: 0x040010F9 RID: 4345
private string xmlNameSpace;
}
}
@@ -0,0 +1,18 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization.Formatters
{
/// <summary>Specifies the level of automatic deserialization for .NET Framework remoting.</summary>
// Token: 0x02000477 RID: 1143
[ComVisible(true)]
public enum TypeFilterLevel
{
/// <summary>The low deserialization level for .NET Framework remoting. It supports types associated with basic remoting functionality.</summary>
// Token: 0x040010FB RID: 4347
Low = 2,
/// <summary>The full deserialization level for .NET Framework remoting. It supports all types that remoting supports in all situations.</summary>
// Token: 0x040010FC RID: 4348
Full
}
}
@@ -0,0 +1,16 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Indicates that a class is to be notified when deserialization of the entire object graph has been completed.</summary>
// Token: 0x0200047B RID: 1147
[ComVisible(true)]
public interface IDeserializationCallback
{
/// <summary>Runs when the entire object graph has been deserialized.</summary>
/// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented. </param>
// Token: 0x06002BE1 RID: 11233
void OnDeserialization(object sender);
}
}
@@ -0,0 +1,45 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Provides functionality for formatting serialized objects.</summary>
// Token: 0x0200047C RID: 1148
[ComVisible(true)]
public interface IFormatter
{
/// <summary>Gets or sets the <see cref="T:System.Runtime.Serialization.SerializationBinder" /> that performs type lookups during deserialization.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.SerializationBinder" /> that performs type lookups during deserialization.</returns>
// Token: 0x17000897 RID: 2199
// (get) Token: 0x06002BE2 RID: 11234
// (set) Token: 0x06002BE3 RID: 11235
SerializationBinder Binder { get; set; }
/// <summary>Gets or sets the <see cref="T:System.Runtime.Serialization.StreamingContext" /> used for serialization and deserialization.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.StreamingContext" /> used for serialization and deserialization.</returns>
// Token: 0x17000898 RID: 2200
// (get) Token: 0x06002BE4 RID: 11236
// (set) Token: 0x06002BE5 RID: 11237
StreamingContext Context { get; set; }
/// <summary>Gets or sets the <see cref="T:System.Runtime.Serialization.SurrogateSelector" /> used by the current formatter.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.SurrogateSelector" /> used by this formatter.</returns>
// Token: 0x17000899 RID: 2201
// (get) Token: 0x06002BE6 RID: 11238
// (set) Token: 0x06002BE7 RID: 11239
ISurrogateSelector SurrogateSelector { get; set; }
/// <summary>Deserializes the data on the provided stream and reconstitutes the graph of objects.</summary>
/// <returns>The top object of the deserialized graph.</returns>
/// <param name="serializationStream">The stream that contains the data to deserialize. </param>
// Token: 0x06002BE8 RID: 11240
object Deserialize(Stream serializationStream);
/// <summary>Serializes an object, or graph of objects with the given root to the provided stream.</summary>
/// <param name="serializationStream">The stream where the formatter puts the serialized data. This stream can reference a variety of backing stores (such as files, network, memory, and so on). </param>
/// <param name="graph">The object, or root of the object graph, to serialize. All child objects of this root object are automatically serialized. </param>
// Token: 0x06002BE9 RID: 11241
void Serialize(Stream serializationStream, object graph);
}
}
@@ -0,0 +1,116 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Provides the connection between an instance of <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and the formatter-provided class best suited to parse the data inside the <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</summary>
// Token: 0x0200047D RID: 1149
[CLSCompliant(false)]
[ComVisible(true)]
public interface IFormatterConverter
{
/// <summary>Converts a value to the given <see cref="T:System.Type" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
/// <param name="type">The <see cref="T:System.Type" /> into which <paramref name="value" /> is to be converted. </param>
// Token: 0x06002BEA RID: 11242
object Convert(object value, Type type);
/// <summary>Converts a value to the given <see cref="T:System.TypeCode" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
/// <param name="typeCode">The <see cref="T:System.TypeCode" /> into which <paramref name="value" /> is to be converted. </param>
// Token: 0x06002BEB RID: 11243
object Convert(object value, TypeCode typeCode);
/// <summary>Converts a value to a <see cref="T:System.Boolean" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BEC RID: 11244
bool ToBoolean(object value);
/// <summary>Converts a value to an 8-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BED RID: 11245
byte ToByte(object value);
/// <summary>Converts a value to a Unicode character.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BEE RID: 11246
char ToChar(object value);
/// <summary>Converts a value to a <see cref="T:System.DateTime" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BEF RID: 11247
DateTime ToDateTime(object value);
/// <summary>Converts a value to a <see cref="T:System.Decimal" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF0 RID: 11248
decimal ToDecimal(object value);
/// <summary>Converts a value to a double-precision floating-point number.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF1 RID: 11249
double ToDouble(object value);
/// <summary>Converts a value to a 16-bit signed integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF2 RID: 11250
short ToInt16(object value);
/// <summary>Converts a value to a 32-bit signed integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF3 RID: 11251
int ToInt32(object value);
/// <summary>Converts a value to a 64-bit signed integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF4 RID: 11252
long ToInt64(object value);
/// <summary>Converts a value to a <see cref="T:System.SByte" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF5 RID: 11253
sbyte ToSByte(object value);
/// <summary>Converts a value to a single-precision floating-point number.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF6 RID: 11254
float ToSingle(object value);
/// <summary>Converts a value to a <see cref="T:System.String" />.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF7 RID: 11255
string ToString(object value);
/// <summary>Converts a value to a 16-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF8 RID: 11256
ushort ToUInt16(object value);
/// <summary>Converts a value to a 32-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BF9 RID: 11257
uint ToUInt32(object value);
/// <summary>Converts a value to a 64-bit unsigned integer.</summary>
/// <returns>The converted <paramref name="value" />.</returns>
/// <param name="value">The object to be converted. </param>
// Token: 0x06002BFA RID: 11258
ulong ToUInt64(object value);
}
}
@@ -0,0 +1,18 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Indicates that the current interface implementer is a reference to another object.</summary>
// Token: 0x0200047E RID: 1150
[ComVisible(true)]
public interface IObjectReference
{
/// <summary>Returns the real object that should be deserialized, rather than the object that the serialized stream specifies.</summary>
/// <returns>Returns the actual object that is put into the graph.</returns>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> from which the current object is deserialized. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. The call will not work on a medium trusted server.</exception>
// Token: 0x06002BFB RID: 11259
object GetRealObject(StreamingContext context);
}
}
@@ -0,0 +1,18 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Allows an object to control its own serialization and deserialization.</summary>
// Token: 0x02000024 RID: 36
[ComVisible(true)]
public interface ISerializable
{
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this serialization. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06000372 RID: 882
void GetObjectData(SerializationInfo info, StreamingContext context);
}
}
@@ -0,0 +1,29 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Implements a serialization surrogate selector that allows one object to perform serialization and deserialization of another.</summary>
// Token: 0x0200047F RID: 1151
[ComVisible(true)]
public interface ISerializationSurrogate
{
/// <summary>Populates the provided <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the object.</summary>
/// <param name="obj">The object to serialize. </param>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this serialization. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002BFC RID: 11260
void GetObjectData(object obj, SerializationInfo info, StreamingContext context);
/// <summary>Populates the object using the information in the <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</summary>
/// <returns>The populated deserialized object.</returns>
/// <param name="obj">The object to populate. </param>
/// <param name="info">The information to populate the object. </param>
/// <param name="context">The source from which the object is deserialized. </param>
/// <param name="selector">The surrogate selector where the search for a compatible surrogate begins. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002BFD RID: 11261
object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector);
}
}
@@ -0,0 +1,32 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Indicates a serialization surrogate selector class.</summary>
// Token: 0x02000480 RID: 1152
[ComVisible(true)]
public interface ISurrogateSelector
{
/// <summary>Specifies the next <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> for surrogates to examine if the current instance does not have a surrogate for the specified type and assembly in the specified context.</summary>
/// <param name="selector">The next surrogate selector to examine. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002BFE RID: 11262
void ChainSelector(ISurrogateSelector selector);
/// <summary>Returns the next surrogate selector in the chain.</summary>
/// <returns>The next surrogate selector in the chain or null.</returns>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002BFF RID: 11263
ISurrogateSelector GetNextSelector();
/// <summary>Finds the surrogate that represents the specified object's type, starting with the specified surrogate selector for the specified serialization context.</summary>
/// <returns>The appropriate surrogate for the given type in the given context.</returns>
/// <param name="type">The <see cref="T:System.Type" /> of object (class) that needs a surrogate. </param>
/// <param name="context">The source or destination context for the current serialization. </param>
/// <param name="selector">When this method returns, contains a <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> that holds a reference to the surrogate selector where the appropriate surrogate was found. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002C00 RID: 11264
ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector);
}
}
@@ -0,0 +1,24 @@
using System;
namespace System.Runtime.Serialization
{
// Token: 0x02000486 RID: 1158
internal class MultiArrayFixupRecord : BaseFixupRecord
{
// Token: 0x06002C1F RID: 11295 RVA: 0x000915A4 File Offset: 0x0008F7A4
public MultiArrayFixupRecord(ObjectRecord objectToBeFixed, int[] indices, ObjectRecord objectRequired)
: base(objectToBeFixed, objectRequired)
{
this._indices = indices;
}
// Token: 0x06002C20 RID: 11296 RVA: 0x000915B8 File Offset: 0x0008F7B8
protected override void FixupImpl(ObjectManager manager)
{
this.ObjectToBeFixed.SetArrayValue(manager, this.ObjectRequired.ObjectInstance, this._indices);
}
// Token: 0x04001111 RID: 4369
private int[] _indices;
}
}
@@ -0,0 +1,111 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Generates IDs for objects.</summary>
// Token: 0x02000481 RID: 1153
[ComVisible(true)]
[MonoTODO("Serialization format not compatible with.NET")]
[Serializable]
public class ObjectIDGenerator
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" /> class.</summary>
// Token: 0x06002C01 RID: 11265 RVA: 0x00090BB0 File Offset: 0x0008EDB0
public ObjectIDGenerator()
{
this.table = new Hashtable(ObjectIDGenerator.comparer, ObjectIDGenerator.comparer);
this.current = 1L;
}
/// <summary>Returns the ID for the specified object, generating a new ID if the specified object has not already been identified by the <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" />.</summary>
/// <returns>The object's ID is used for serialization. <paramref name="firstTime" /> is set to true if this is the first time the object has been identified; otherwise, it is set to false.</returns>
/// <param name="obj">The object you want an ID for. </param>
/// <param name="firstTime">true if <paramref name="obj" /> was not previously known to the <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" />; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" /> has been asked to keep track of too many objects. </exception>
// Token: 0x06002C03 RID: 11267 RVA: 0x00090BE4 File Offset: 0x0008EDE4
public virtual long GetId(object obj, out bool firstTime)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
object obj2 = this.table[obj];
if (obj2 != null)
{
firstTime = false;
return (long)obj2;
}
firstTime = true;
this.table.Add(obj, this.current);
long num;
this.current = (num = this.current) + 1L;
return num;
}
/// <summary>Determines whether an object has already been assigned an ID.</summary>
/// <returns>The object ID of <paramref name="obj" /> if previously known to the <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" />; otherwise, zero.</returns>
/// <param name="obj">The object you are asking for. </param>
/// <param name="firstTime">true if <paramref name="obj" /> was not previously known to the <see cref="T:System.Runtime.Serialization.ObjectIDGenerator" />; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
// Token: 0x06002C04 RID: 11268 RVA: 0x00090C4C File Offset: 0x0008EE4C
public virtual long HasId(object obj, out bool firstTime)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
object obj2 = this.table[obj];
if (obj2 != null)
{
firstTime = false;
return (long)obj2;
}
firstTime = true;
return 0L;
}
// Token: 0x1700089A RID: 2202
// (get) Token: 0x06002C05 RID: 11269 RVA: 0x00090C8C File Offset: 0x0008EE8C
internal long NextId
{
get
{
long num;
this.current = (num = this.current) + 1L;
return num;
}
}
// Token: 0x04001100 RID: 4352
private Hashtable table;
// Token: 0x04001101 RID: 4353
private long current;
// Token: 0x04001102 RID: 4354
private static ObjectIDGenerator.InstanceComparer comparer = new ObjectIDGenerator.InstanceComparer();
// Token: 0x02000482 RID: 1154
private class InstanceComparer : IComparer, IHashCodeProvider
{
// Token: 0x06002C07 RID: 11271 RVA: 0x00090CB4 File Offset: 0x0008EEB4
int IComparer.Compare(object o1, object o2)
{
if (o1 is string)
{
return (!o1.Equals(o2)) ? 1 : 0;
}
return (o1 != o2) ? 1 : 0;
}
// Token: 0x06002C08 RID: 11272 RVA: 0x00090CE4 File Offset: 0x0008EEE4
int IHashCodeProvider.GetHashCode(object o)
{
return object.InternalGetHashCode(o);
}
}
}
}
@@ -0,0 +1,451 @@
using System;
using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Keeps track of objects as they are deserialized.</summary>
// Token: 0x02000483 RID: 1155
[ComVisible(true)]
public class ObjectManager
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.ObjectManager" /> class.</summary>
/// <param name="selector">The surrogate selector to use. The <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> determines the correct surrogate to use when deserializing objects of a given type. At deserialization time, the surrogate selector creates a new instance of the object from the information transmitted on the stream. </param>
/// <param name="context">The streaming context. The <see cref="T:System.Runtime.Serialization.StreamingContext" /> is not used by ObjectManager, but is passed as a parameter to any objects implementing <see cref="T:System.Runtime.Serialization.ISerializable" /> or having a <see cref="T:System.Runtime.Serialization.ISerializationSurrogate" />. These objects can take specific actions depending on the source of the information to deserialize. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002C09 RID: 11273 RVA: 0x00090CEC File Offset: 0x0008EEEC
public ObjectManager(ISurrogateSelector selector, StreamingContext context)
{
this._selector = selector;
this._context = context;
}
/// <summary>Performs all the recorded fixups.</summary>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A fixup was not successfully completed. </exception>
// Token: 0x06002C0A RID: 11274 RVA: 0x00090D24 File Offset: 0x0008EF24
public virtual void DoFixups()
{
this._finalFixup = true;
try
{
if (this._registeredObjectsCount < this._objectRecords.Count)
{
throw new SerializationException("There are some fixups that refer to objects that have not been registered");
}
ObjectRecord lastObjectRecord = this._lastObjectRecord;
bool flag = true;
ObjectRecord objectRecord2;
for (ObjectRecord objectRecord = this._objectRecordChain; objectRecord != null; objectRecord = objectRecord2)
{
bool flag2 = !objectRecord.IsUnsolvedObjectReference || !flag;
if (flag2)
{
flag2 = objectRecord.DoFixups(true, this, true);
}
if (flag2)
{
flag2 = objectRecord.LoadData(this, this._selector, this._context);
}
if (flag2)
{
if (objectRecord.OriginalObject is IDeserializationCallback)
{
this._deserializedRecords.Add(objectRecord);
}
SerializationCallbacks serializationCallbacks = SerializationCallbacks.GetSerializationCallbacks(objectRecord.OriginalObject.GetType());
if (serializationCallbacks.HasDeserializedCallbacks)
{
this._onDeserializedCallbackRecords.Add(objectRecord);
}
objectRecord2 = objectRecord.Next;
}
else
{
if (objectRecord.ObjectInstance is IObjectReference && !flag)
{
if (objectRecord.Status == ObjectRecordStatus.ReferenceSolvingDelayed)
{
throw new SerializationException("The object with ID " + objectRecord.ObjectID + " could not be resolved");
}
objectRecord.Status = ObjectRecordStatus.ReferenceSolvingDelayed;
}
if (objectRecord != this._lastObjectRecord)
{
objectRecord2 = objectRecord.Next;
objectRecord.Next = null;
this._lastObjectRecord.Next = objectRecord;
this._lastObjectRecord = objectRecord;
}
else
{
objectRecord2 = objectRecord;
}
}
if (objectRecord == lastObjectRecord)
{
flag = false;
}
}
}
finally
{
this._finalFixup = false;
}
}
// Token: 0x06002C0B RID: 11275 RVA: 0x00090EC0 File Offset: 0x0008F0C0
internal ObjectRecord GetObjectRecord(long objectID)
{
ObjectRecord objectRecord = (ObjectRecord)this._objectRecords[objectID];
if (objectRecord == null)
{
if (this._finalFixup)
{
throw new SerializationException("The object with Id " + objectID + " has not been registered");
}
objectRecord = new ObjectRecord();
objectRecord.ObjectID = objectID;
this._objectRecords[objectID] = objectRecord;
}
if (!objectRecord.IsRegistered && this._finalFixup)
{
throw new SerializationException("The object with Id " + objectID + " has not been registered");
}
return objectRecord;
}
/// <summary>Returns the object with the specified object ID.</summary>
/// <returns>The object with the specified object ID if it has been previously stored or null if no such object has been registered.</returns>
/// <param name="objectID">The ID of the requested object. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="objectID" /> parameter is less than or equal to zero. </exception>
// Token: 0x06002C0C RID: 11276 RVA: 0x00090F64 File Offset: 0x0008F164
public virtual object GetObject(long objectID)
{
if (objectID <= 0L)
{
throw new ArgumentOutOfRangeException("objectID", "The objectID parameter is less than or equal to zero");
}
ObjectRecord objectRecord = (ObjectRecord)this._objectRecords[objectID];
if (objectRecord == null || !objectRecord.IsRegistered)
{
return null;
}
return objectRecord.ObjectInstance;
}
/// <summary>Raises the deserialization event to any registered object that implements <see cref="T:System.Runtime.Serialization.IDeserializationCallback" />.</summary>
// Token: 0x06002C0D RID: 11277 RVA: 0x00090FBC File Offset: 0x0008F1BC
public virtual void RaiseDeserializationEvent()
{
for (int i = this._onDeserializedCallbackRecords.Count - 1; i >= 0; i--)
{
ObjectRecord objectRecord = (ObjectRecord)this._onDeserializedCallbackRecords[i];
this.RaiseOnDeserializedEvent(objectRecord.OriginalObject);
}
for (int j = this._deserializedRecords.Count - 1; j >= 0; j--)
{
ObjectRecord objectRecord2 = (ObjectRecord)this._deserializedRecords[j];
IDeserializationCallback deserializationCallback = objectRecord2.OriginalObject as IDeserializationCallback;
if (deserializationCallback != null)
{
deserializationCallback.OnDeserialization(this);
}
}
}
/// <summary>Invokes the method marked with the <see cref="T:System.Runtime.Serialization.OnDeserializingAttribute" />.</summary>
/// <param name="obj">The instance of the type that contains the method to be invoked.</param>
// Token: 0x06002C0E RID: 11278 RVA: 0x00091054 File Offset: 0x0008F254
public void RaiseOnDeserializingEvent(object obj)
{
SerializationCallbacks serializationCallbacks = SerializationCallbacks.GetSerializationCallbacks(obj.GetType());
serializationCallbacks.RaiseOnDeserializing(obj, this._context);
}
// Token: 0x06002C0F RID: 11279 RVA: 0x0009107C File Offset: 0x0008F27C
private void RaiseOnDeserializedEvent(object obj)
{
SerializationCallbacks serializationCallbacks = SerializationCallbacks.GetSerializationCallbacks(obj.GetType());
serializationCallbacks.RaiseOnDeserialized(obj, this._context);
}
// Token: 0x06002C10 RID: 11280 RVA: 0x000910A4 File Offset: 0x0008F2A4
private void AddFixup(BaseFixupRecord record)
{
record.ObjectToBeFixed.ChainFixup(record, true);
record.ObjectRequired.ChainFixup(record, false);
}
/// <summary>Records a fixup for one element in an array.</summary>
/// <param name="arrayToBeFixed">The ID of the array used to record a fixup. </param>
/// <param name="index">The index within <paramref name="arrayFixup" /> that a fixup is requested for. </param>
/// <param name="objectRequired">The ID of the object that the current array element will point to after fixup is completed. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="arrayToBeFixed" /> or <paramref name="objectRequired" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="index" /> parameter is null. </exception>
// Token: 0x06002C11 RID: 11281 RVA: 0x000910C0 File Offset: 0x0008F2C0
public virtual void RecordArrayElementFixup(long arrayToBeFixed, int index, long objectRequired)
{
if (arrayToBeFixed <= 0L)
{
throw new ArgumentOutOfRangeException("arrayToBeFixed", "The arrayToBeFixed parameter is less than or equal to zero");
}
if (objectRequired <= 0L)
{
throw new ArgumentOutOfRangeException("objectRequired", "The objectRequired parameter is less than or equal to zero");
}
ArrayFixupRecord arrayFixupRecord = new ArrayFixupRecord(this.GetObjectRecord(arrayToBeFixed), index, this.GetObjectRecord(objectRequired));
this.AddFixup(arrayFixupRecord);
}
/// <summary>Records fixups for the specified elements in an array, to be executed later.</summary>
/// <param name="arrayToBeFixed">The ID of the array used to record a fixup. </param>
/// <param name="indices">The indexes within the multidimensional array that a fixup is requested for. </param>
/// <param name="objectRequired">The ID of the object the array elements will point to after fixup is completed. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="arrayToBeFixed" /> or <paramref name="objectRequired" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="indices" /> parameter is null. </exception>
// Token: 0x06002C12 RID: 11282 RVA: 0x0009111C File Offset: 0x0008F31C
public virtual void RecordArrayElementFixup(long arrayToBeFixed, int[] indices, long objectRequired)
{
if (arrayToBeFixed <= 0L)
{
throw new ArgumentOutOfRangeException("arrayToBeFixed", "The arrayToBeFixed parameter is less than or equal to zero");
}
if (objectRequired <= 0L)
{
throw new ArgumentOutOfRangeException("objectRequired", "The objectRequired parameter is less than or equal to zero");
}
if (indices == null)
{
throw new ArgumentNullException("indices");
}
MultiArrayFixupRecord multiArrayFixupRecord = new MultiArrayFixupRecord(this.GetObjectRecord(arrayToBeFixed), indices, this.GetObjectRecord(objectRequired));
this.AddFixup(multiArrayFixupRecord);
}
/// <summary>Records a fixup for an object member, to be executed later.</summary>
/// <param name="objectToBeFixed">The ID of the object that needs the reference to <paramref name="objectRequired" />. </param>
/// <param name="memberName">The member name of <paramref name="objectToBeFixed" /> where the fixup will be performed. </param>
/// <param name="objectRequired">The ID of the object required by <paramref name="objectToBeFixed" />. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="objectToBeFixed" /> or <paramref name="objectRequired" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="memberName" /> parameter is null. </exception>
// Token: 0x06002C13 RID: 11283 RVA: 0x00091188 File Offset: 0x0008F388
public virtual void RecordDelayedFixup(long objectToBeFixed, string memberName, long objectRequired)
{
if (objectToBeFixed <= 0L)
{
throw new ArgumentOutOfRangeException("objectToBeFixed", "The objectToBeFixed parameter is less than or equal to zero");
}
if (objectRequired <= 0L)
{
throw new ArgumentOutOfRangeException("objectRequired", "The objectRequired parameter is less than or equal to zero");
}
if (memberName == null)
{
throw new ArgumentNullException("memberName");
}
DelayedFixupRecord delayedFixupRecord = new DelayedFixupRecord(this.GetObjectRecord(objectToBeFixed), memberName, this.GetObjectRecord(objectRequired));
this.AddFixup(delayedFixupRecord);
}
/// <summary>Records a fixup for a member of an object, to be executed later.</summary>
/// <param name="objectToBeFixed">The ID of the object that needs the reference to the <paramref name="objectRequired" /> object. </param>
/// <param name="member">The member of <paramref name="objectToBeFixed" /> where the fixup will be performed. </param>
/// <param name="objectRequired">The ID of the object required by <paramref name="objectToBeFixed" />. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="objectToBeFixed" /> or <paramref name="objectRequired" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="member" /> parameter is null. </exception>
// Token: 0x06002C14 RID: 11284 RVA: 0x000911F4 File Offset: 0x0008F3F4
public virtual void RecordFixup(long objectToBeFixed, MemberInfo member, long objectRequired)
{
if (objectToBeFixed <= 0L)
{
throw new ArgumentOutOfRangeException("objectToBeFixed", "The objectToBeFixed parameter is less than or equal to zero");
}
if (objectRequired <= 0L)
{
throw new ArgumentOutOfRangeException("objectRequired", "The objectRequired parameter is less than or equal to zero");
}
if (member == null)
{
throw new ArgumentNullException("member");
}
FixupRecord fixupRecord = new FixupRecord(this.GetObjectRecord(objectToBeFixed), member, this.GetObjectRecord(objectRequired));
this.AddFixup(fixupRecord);
}
// Token: 0x06002C15 RID: 11285 RVA: 0x00091260 File Offset: 0x0008F460
private void RegisterObjectInternal(object obj, ObjectRecord record)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (!record.IsRegistered)
{
record.ObjectInstance = obj;
record.OriginalObject = obj;
if (obj is IObjectReference)
{
record.Status = ObjectRecordStatus.ReferenceUnsolved;
}
else
{
record.Status = ObjectRecordStatus.ReferenceSolved;
}
if (this._selector != null)
{
record.Surrogate = this._selector.GetSurrogate(obj.GetType(), this._context, out record.SurrogateSelector);
if (record.Surrogate != null)
{
record.Status = ObjectRecordStatus.ReferenceUnsolved;
}
}
record.DoFixups(true, this, false);
record.DoFixups(false, this, false);
this._registeredObjectsCount++;
if (this._objectRecordChain == null)
{
this._objectRecordChain = record;
this._lastObjectRecord = record;
}
else
{
this._lastObjectRecord.Next = record;
this._lastObjectRecord = record;
}
return;
}
if (record.OriginalObject != obj)
{
throw new SerializationException("An object with Id " + record.ObjectID + " has already been registered");
}
}
/// <summary>Registers an object as it is deserialized, associating it with <paramref name="objectID" />.</summary>
/// <param name="obj">The object to register. </param>
/// <param name="objectID">The ID of the object to register. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="objectID" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="objectID" /> has already been registered for an object other than <paramref name="obj" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// </PermissionSet>
// Token: 0x06002C16 RID: 11286 RVA: 0x00091378 File Offset: 0x0008F578
public virtual void RegisterObject(object obj, long objectID)
{
if (obj == null)
{
throw new ArgumentNullException("obj", "The obj parameter is null.");
}
if (objectID <= 0L)
{
throw new ArgumentOutOfRangeException("objectID", "The objectID parameter is less than or equal to zero");
}
this.RegisterObjectInternal(obj, this.GetObjectRecord(objectID));
}
/// <summary>Registers an object as it is deserialized, associating it with <paramref name="objectID" />, and recording the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> used with it.</summary>
/// <param name="obj">The object to register. </param>
/// <param name="objectID">The ID of the object to register. </param>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> used if <paramref name="obj" /> implements <see cref="T:System.Runtime.Serialization.ISerializable" /> or has a <see cref="T:System.Runtime.Serialization.ISerializationSurrogate" />. <paramref name="info" /> will be completed with any required fixup information and then passed to the required object when that object is completed. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="objectID" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="objectID" /> has already been registered for an object other than <paramref name="obj" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// </PermissionSet>
// Token: 0x06002C17 RID: 11287 RVA: 0x000913C4 File Offset: 0x0008F5C4
public void RegisterObject(object obj, long objectID, SerializationInfo info)
{
if (obj == null)
{
throw new ArgumentNullException("obj", "The obj parameter is null.");
}
if (objectID <= 0L)
{
throw new ArgumentOutOfRangeException("objectID", "The objectID parameter is less than or equal to zero");
}
ObjectRecord objectRecord = this.GetObjectRecord(objectID);
objectRecord.Info = info;
this.RegisterObjectInternal(obj, objectRecord);
}
/// <summary>Registers a member of an object as it is deserialized, associating it with <paramref name="objectID" />, and recording the <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</summary>
/// <param name="obj">The object to register. </param>
/// <param name="objectID">The ID of the object to register. </param>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> used if <paramref name="obj" /> implements <see cref="T:System.Runtime.Serialization.ISerializable" /> or has a <see cref="T:System.Runtime.Serialization.ISerializationSurrogate" />. <paramref name="info" /> will be completed with any required fixup information and then passed to the required object when that object is completed. </param>
/// <param name="idOfContainingObj">The ID of the object that contains <paramref name="obj" />. This parameter is required only if <paramref name="obj" /> is a value type. </param>
/// <param name="member">The field in the containing object where <paramref name="obj" /> exists. This parameter has meaning only if <paramref name="obj" /> is a value type. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="objectID" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="objectID" /> has already been registered for an object other than <paramref name="obj" />, or <paramref name="member" /> is not a <see cref="T:System.Reflection.FieldInfo" /> and <paramref name="member" /> is not null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// </PermissionSet>
// Token: 0x06002C18 RID: 11288 RVA: 0x00091418 File Offset: 0x0008F618
public void RegisterObject(object obj, long objectID, SerializationInfo info, long idOfContainingObj, MemberInfo member)
{
this.RegisterObject(obj, objectID, info, idOfContainingObj, member, null);
}
/// <summary>Registers a member of an array contained in an object while it is deserialized, associating it with <paramref name="objectID" />, and recording the <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</summary>
/// <param name="obj">The object to register. </param>
/// <param name="objectID">The ID of the object to register. </param>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> used if <paramref name="obj" /> implements <see cref="T:System.Runtime.Serialization.ISerializable" /> or has a <see cref="T:System.Runtime.Serialization.ISerializationSurrogate" />. <paramref name="info" /> will be completed with any required fixup information and then passed to the required object when that object is completed. </param>
/// <param name="idOfContainingObj">The ID of the object that contains <paramref name="obj" />. This parameter is required only if <paramref name="obj" /> is a value type. </param>
/// <param name="member">The field in the containing object where <paramref name="obj" /> exists. This parameter has meaning only if <paramref name="obj" /> is a value type. </param>
/// <param name="arrayIndex">If <paramref name="obj" /> is a <see cref="T:System.ValueType" /> and a member of an array, <paramref name="arrayIndex" /> contains the index within that array where <paramref name="obj" /> exists. <paramref name="arrayIndex" /> is ignored if <paramref name="obj" /> is not both a <see cref="T:System.ValueType" /> and a member of an array. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="objectID" /> parameter is less than or equal to zero. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The <paramref name="objectID" /> has already been registered for an object other than <paramref name="obj" />, or <paramref name="member" /> is not a <see cref="T:System.Reflection.FieldInfo" /> and <paramref name="member" /> isn't null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// </PermissionSet>
// Token: 0x06002C19 RID: 11289 RVA: 0x00091428 File Offset: 0x0008F628
public void RegisterObject(object obj, long objectID, SerializationInfo info, long idOfContainingObj, MemberInfo member, int[] arrayIndex)
{
if (obj == null)
{
throw new ArgumentNullException("obj", "The obj parameter is null.");
}
if (objectID <= 0L)
{
throw new ArgumentOutOfRangeException("objectID", "The objectID parameter is less than or equal to zero");
}
ObjectRecord objectRecord = this.GetObjectRecord(objectID);
objectRecord.Info = info;
objectRecord.IdOfContainingObj = idOfContainingObj;
objectRecord.Member = member;
objectRecord.ArrayIndex = arrayIndex;
this.RegisterObjectInternal(obj, objectRecord);
}
// Token: 0x04001103 RID: 4355
private ObjectRecord _objectRecordChain;
// Token: 0x04001104 RID: 4356
private ObjectRecord _lastObjectRecord;
// Token: 0x04001105 RID: 4357
private ArrayList _deserializedRecords = new ArrayList();
// Token: 0x04001106 RID: 4358
private ArrayList _onDeserializedCallbackRecords = new ArrayList();
// Token: 0x04001107 RID: 4359
private Hashtable _objectRecords = new Hashtable();
// Token: 0x04001108 RID: 4360
private bool _finalFixup;
// Token: 0x04001109 RID: 4361
private ISurrogateSelector _selector;
// Token: 0x0400110A RID: 4362
private StreamingContext _context;
// Token: 0x0400110B RID: 4363
private int _registeredObjectsCount;
}
}
@@ -0,0 +1,295 @@
using System;
using System.Reflection;
namespace System.Runtime.Serialization
{
// Token: 0x0200048A RID: 1162
internal class ObjectRecord
{
// Token: 0x06002C26 RID: 11302 RVA: 0x00091648 File Offset: 0x0008F848
public void SetMemberValue(ObjectManager manager, MemberInfo member, object value)
{
if (member is FieldInfo)
{
((FieldInfo)member).SetValue(this.ObjectInstance, value);
}
else
{
if (!(member is PropertyInfo))
{
throw new SerializationException("Cannot perform fixup");
}
((PropertyInfo)member).SetValue(this.ObjectInstance, value, null);
}
if (this.Member != null)
{
ObjectRecord objectRecord = manager.GetObjectRecord(this.IdOfContainingObj);
if (objectRecord.IsRegistered)
{
objectRecord.SetMemberValue(manager, this.Member, this.ObjectInstance);
}
}
else if (this.ArrayIndex != null)
{
ObjectRecord objectRecord2 = manager.GetObjectRecord(this.IdOfContainingObj);
if (objectRecord2.IsRegistered)
{
objectRecord2.SetArrayValue(manager, this.ObjectInstance, this.ArrayIndex);
}
}
}
// Token: 0x06002C27 RID: 11303 RVA: 0x00091718 File Offset: 0x0008F918
public void SetArrayValue(ObjectManager manager, object value, int[] indices)
{
((Array)this.ObjectInstance).SetValue(value, indices);
}
// Token: 0x06002C28 RID: 11304 RVA: 0x0009172C File Offset: 0x0008F92C
public void SetMemberValue(ObjectManager manager, string memberName, object value)
{
if (this.Info == null)
{
throw new SerializationException("Cannot perform fixup");
}
this.Info.AddValue(memberName, value, value.GetType());
}
// Token: 0x1700089B RID: 2203
// (get) Token: 0x06002C29 RID: 11305 RVA: 0x00091758 File Offset: 0x0008F958
public bool IsInstanceReady
{
get
{
return this.IsRegistered && !this.IsUnsolvedObjectReference && (!this.ObjectInstance.GetType().IsValueType || (!this.HasPendingFixups && this.Info == null));
}
}
// Token: 0x1700089C RID: 2204
// (get) Token: 0x06002C2A RID: 11306 RVA: 0x000917B0 File Offset: 0x0008F9B0
public bool IsUnsolvedObjectReference
{
get
{
return this.Status != ObjectRecordStatus.ReferenceSolved;
}
}
// Token: 0x1700089D RID: 2205
// (get) Token: 0x06002C2B RID: 11307 RVA: 0x000917C0 File Offset: 0x0008F9C0
public bool IsRegistered
{
get
{
return this.Status != ObjectRecordStatus.Unregistered;
}
}
// Token: 0x06002C2C RID: 11308 RVA: 0x000917D0 File Offset: 0x0008F9D0
public bool DoFixups(bool asContainer, ObjectManager manager, bool strict)
{
BaseFixupRecord baseFixupRecord = null;
BaseFixupRecord baseFixupRecord2 = ((!asContainer) ? this.FixupChainAsRequired : this.FixupChainAsContainer);
bool flag = true;
while (baseFixupRecord2 != null)
{
if (baseFixupRecord2.DoFixup(manager, strict))
{
this.UnchainFixup(baseFixupRecord2, baseFixupRecord, asContainer);
if (asContainer)
{
baseFixupRecord2.ObjectRequired.RemoveFixup(baseFixupRecord2, false);
}
else
{
baseFixupRecord2.ObjectToBeFixed.RemoveFixup(baseFixupRecord2, true);
}
}
else
{
baseFixupRecord = baseFixupRecord2;
flag = false;
}
baseFixupRecord2 = ((!asContainer) ? baseFixupRecord2.NextSameRequired : baseFixupRecord2.NextSameContainer);
}
return flag;
}
// Token: 0x06002C2D RID: 11309 RVA: 0x00091864 File Offset: 0x0008FA64
public void RemoveFixup(BaseFixupRecord fixupToRemove, bool asContainer)
{
BaseFixupRecord baseFixupRecord = null;
for (BaseFixupRecord baseFixupRecord2 = ((!asContainer) ? this.FixupChainAsRequired : this.FixupChainAsContainer); baseFixupRecord2 != null; baseFixupRecord2 = ((!asContainer) ? baseFixupRecord2.NextSameRequired : baseFixupRecord2.NextSameContainer))
{
if (baseFixupRecord2 == fixupToRemove)
{
this.UnchainFixup(baseFixupRecord2, baseFixupRecord, asContainer);
return;
}
baseFixupRecord = baseFixupRecord2;
}
}
// Token: 0x06002C2E RID: 11310 RVA: 0x000918C4 File Offset: 0x0008FAC4
private void UnchainFixup(BaseFixupRecord fixup, BaseFixupRecord prevFixup, bool asContainer)
{
if (prevFixup == null)
{
if (asContainer)
{
this.FixupChainAsContainer = fixup.NextSameContainer;
}
else
{
this.FixupChainAsRequired = fixup.NextSameRequired;
}
}
else if (asContainer)
{
prevFixup.NextSameContainer = fixup.NextSameContainer;
}
else
{
prevFixup.NextSameRequired = fixup.NextSameRequired;
}
}
// Token: 0x06002C2F RID: 11311 RVA: 0x00091924 File Offset: 0x0008FB24
public void ChainFixup(BaseFixupRecord fixup, bool asContainer)
{
if (asContainer)
{
fixup.NextSameContainer = this.FixupChainAsContainer;
this.FixupChainAsContainer = fixup;
}
else
{
fixup.NextSameRequired = this.FixupChainAsRequired;
this.FixupChainAsRequired = fixup;
}
}
// Token: 0x06002C30 RID: 11312 RVA: 0x00091958 File Offset: 0x0008FB58
public bool LoadData(ObjectManager manager, ISurrogateSelector selector, StreamingContext context)
{
if (this.Info != null)
{
if (this.Surrogate != null)
{
object obj = this.Surrogate.SetObjectData(this.ObjectInstance, this.Info, context, this.SurrogateSelector);
if (obj != null)
{
this.ObjectInstance = obj;
}
this.Status = ObjectRecordStatus.ReferenceSolved;
}
else
{
if (!(this.ObjectInstance is ISerializable))
{
throw new SerializationException("No surrogate selector was found for type " + this.ObjectInstance.GetType().FullName);
}
object[] array = new object[] { this.Info, context };
ConstructorInfo constructor = this.ObjectInstance.GetType().GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(SerializationInfo),
typeof(StreamingContext)
}, null);
if (constructor == null)
{
throw new SerializationException("The constructor to deserialize an object of type " + this.ObjectInstance.GetType().FullName + " was not found.");
}
constructor.Invoke(this.ObjectInstance, array);
}
this.Info = null;
}
if (this.ObjectInstance is IObjectReference && this.Status != ObjectRecordStatus.ReferenceSolved)
{
try
{
this.ObjectInstance = ((IObjectReference)this.ObjectInstance).GetRealObject(context);
int num = 100;
while (this.ObjectInstance is IObjectReference && num > 0)
{
object realObject = ((IObjectReference)this.ObjectInstance).GetRealObject(context);
if (realObject == this.ObjectInstance)
{
break;
}
this.ObjectInstance = realObject;
num--;
}
if (num == 0)
{
throw new SerializationException("The implementation of the IObjectReference interface returns too many nested references to other objects that implement IObjectReference.");
}
this.Status = ObjectRecordStatus.ReferenceSolved;
}
catch (NullReferenceException)
{
return false;
}
}
if (this.Member != null)
{
ObjectRecord objectRecord = manager.GetObjectRecord(this.IdOfContainingObj);
objectRecord.SetMemberValue(manager, this.Member, this.ObjectInstance);
}
else if (this.ArrayIndex != null)
{
ObjectRecord objectRecord2 = manager.GetObjectRecord(this.IdOfContainingObj);
objectRecord2.SetArrayValue(manager, this.ObjectInstance, this.ArrayIndex);
}
return true;
}
// Token: 0x1700089E RID: 2206
// (get) Token: 0x06002C31 RID: 11313 RVA: 0x00091BA4 File Offset: 0x0008FDA4
public bool HasPendingFixups
{
get
{
return this.FixupChainAsContainer != null;
}
}
// Token: 0x04001119 RID: 4377
public ObjectRecordStatus Status;
// Token: 0x0400111A RID: 4378
public object OriginalObject;
// Token: 0x0400111B RID: 4379
public object ObjectInstance;
// Token: 0x0400111C RID: 4380
public long ObjectID;
// Token: 0x0400111D RID: 4381
public SerializationInfo Info;
// Token: 0x0400111E RID: 4382
public long IdOfContainingObj;
// Token: 0x0400111F RID: 4383
public ISerializationSurrogate Surrogate;
// Token: 0x04001120 RID: 4384
public ISurrogateSelector SurrogateSelector;
// Token: 0x04001121 RID: 4385
public MemberInfo Member;
// Token: 0x04001122 RID: 4386
public int[] ArrayIndex;
// Token: 0x04001123 RID: 4387
public BaseFixupRecord FixupChainAsContainer;
// Token: 0x04001124 RID: 4388
public BaseFixupRecord FixupChainAsRequired;
// Token: 0x04001125 RID: 4389
public ObjectRecord Next;
}
}
@@ -0,0 +1,17 @@
using System;
namespace System.Runtime.Serialization
{
// Token: 0x02000489 RID: 1161
internal enum ObjectRecordStatus : byte
{
// Token: 0x04001115 RID: 4373
Unregistered,
// Token: 0x04001116 RID: 4374
ReferenceUnsolved,
// Token: 0x04001117 RID: 4375
ReferenceSolvingDelayed,
// Token: 0x04001118 RID: 4376
ReferenceSolved
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>When applied to a method, specifies that the method is called immediately after deserialization of the object.</summary>
// Token: 0x0200048B RID: 1163
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class OnDeserializedAttribute : Attribute
{
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>When applied to a method, specifies that the method is called during deserialization of an object.</summary>
// Token: 0x0200048C RID: 1164
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ComVisible(true)]
public sealed class OnDeserializingAttribute : Attribute
{
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>When applied to a method, specifies that the method is called after serialization of an object graph.</summary>
// Token: 0x0200048D RID: 1165
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class OnSerializedAttribute : Attribute
{
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>When applied to a method, specifies that the method is called before serialization of an object.</summary>
// Token: 0x0200048E RID: 1166
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class OnSerializingAttribute : Attribute
{
}
}
@@ -0,0 +1,32 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Specifies that a field can be missing from a serialization stream so that the <see cref="T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> and the <see cref="T:System.Runtime.Serialization.Formatters.Soap.SoapFormatter" /> does not throw an exception. </summary>
// Token: 0x0200048F RID: 1167
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Field, Inherited = false)]
public sealed class OptionalFieldAttribute : Attribute
{
/// <summary>This property is unused and is reserved.</summary>
/// <returns>This property is reserved.</returns>
// Token: 0x1700089F RID: 2207
// (get) Token: 0x06002C37 RID: 11319 RVA: 0x00091BDC File Offset: 0x0008FDDC
// (set) Token: 0x06002C38 RID: 11320 RVA: 0x00091BE4 File Offset: 0x0008FDE4
public int VersionAdded
{
get
{
return this.version_added;
}
set
{
this.version_added = value;
}
}
// Token: 0x04001126 RID: 4390
private int version_added;
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Allows users to control class loading and mandate what class to load.</summary>
// Token: 0x02000490 RID: 1168
[ComVisible(true)]
[Serializable]
public abstract class SerializationBinder
{
/// <summary>When overridden in a derived class, controls the binding of a serialized object to a type.</summary>
/// <returns>The type of the object the formatter creates a new instance of.</returns>
/// <param name="assemblyName">Specifies the <see cref="T:System.Reflection.Assembly" /> name of the serialized object. </param>
/// <param name="typeName">Specifies the <see cref="T:System.Type" /> name of the serialized object. </param>
// Token: 0x06002C3A RID: 11322
public abstract Type BindToType(string assemblyName, string typeName);
}
}
@@ -0,0 +1,172 @@
using System;
using System.Collections;
using System.Reflection;
namespace System.Runtime.Serialization
{
// Token: 0x02000491 RID: 1169
internal sealed class SerializationCallbacks
{
// Token: 0x06002C3B RID: 11323 RVA: 0x00091BF8 File Offset: 0x0008FDF8
public SerializationCallbacks(Type type)
{
this.onSerializingList = SerializationCallbacks.GetMethodsByAttribute(type, typeof(OnSerializingAttribute));
this.onSerializedList = SerializationCallbacks.GetMethodsByAttribute(type, typeof(OnSerializedAttribute));
this.onDeserializingList = SerializationCallbacks.GetMethodsByAttribute(type, typeof(OnDeserializingAttribute));
this.onDeserializedList = SerializationCallbacks.GetMethodsByAttribute(type, typeof(OnDeserializedAttribute));
}
// Token: 0x170008A0 RID: 2208
// (get) Token: 0x06002C3D RID: 11325 RVA: 0x00091C7C File Offset: 0x0008FE7C
public bool HasSerializingCallbacks
{
get
{
return this.onSerializingList != null;
}
}
// Token: 0x170008A1 RID: 2209
// (get) Token: 0x06002C3E RID: 11326 RVA: 0x00091C8C File Offset: 0x0008FE8C
public bool HasSerializedCallbacks
{
get
{
return this.onSerializedList != null;
}
}
// Token: 0x170008A2 RID: 2210
// (get) Token: 0x06002C3F RID: 11327 RVA: 0x00091C9C File Offset: 0x0008FE9C
public bool HasDeserializingCallbacks
{
get
{
return this.onDeserializingList != null;
}
}
// Token: 0x170008A3 RID: 2211
// (get) Token: 0x06002C40 RID: 11328 RVA: 0x00091CAC File Offset: 0x0008FEAC
public bool HasDeserializedCallbacks
{
get
{
return this.onDeserializedList != null;
}
}
// Token: 0x06002C41 RID: 11329 RVA: 0x00091CBC File Offset: 0x0008FEBC
private static ArrayList GetMethodsByAttribute(Type type, Type attr)
{
ArrayList arrayList = new ArrayList();
for (Type type2 = type; type2 != typeof(object); type2 = type2.BaseType)
{
int num = 0;
foreach (MethodInfo methodInfo in type2.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
{
if (methodInfo.IsDefined(attr, false))
{
arrayList.Add(methodInfo);
num++;
}
}
if (num > 1)
{
throw new TypeLoadException(string.Format("Type '{0}' has more than one method with the following attribute: '{1}'.", type.AssemblyQualifiedName, attr.FullName));
}
}
return (arrayList.Count != 0) ? arrayList : null;
}
// Token: 0x06002C42 RID: 11330 RVA: 0x00091D68 File Offset: 0x0008FF68
private static void Invoke(ArrayList list, object target, StreamingContext context)
{
if (list == null)
{
return;
}
SerializationCallbacks.CallbackHandler callbackHandler = null;
foreach (object obj in list)
{
MethodInfo methodInfo = (MethodInfo)obj;
callbackHandler = (SerializationCallbacks.CallbackHandler)Delegate.Combine(Delegate.CreateDelegate(typeof(SerializationCallbacks.CallbackHandler), target, methodInfo), callbackHandler);
}
callbackHandler(context);
}
// Token: 0x06002C43 RID: 11331 RVA: 0x00091DF8 File Offset: 0x0008FFF8
public void RaiseOnSerializing(object target, StreamingContext contex)
{
SerializationCallbacks.Invoke(this.onSerializingList, target, contex);
}
// Token: 0x06002C44 RID: 11332 RVA: 0x00091E08 File Offset: 0x00090008
public void RaiseOnSerialized(object target, StreamingContext contex)
{
SerializationCallbacks.Invoke(this.onSerializedList, target, contex);
}
// Token: 0x06002C45 RID: 11333 RVA: 0x00091E18 File Offset: 0x00090018
public void RaiseOnDeserializing(object target, StreamingContext contex)
{
SerializationCallbacks.Invoke(this.onDeserializingList, target, contex);
}
// Token: 0x06002C46 RID: 11334 RVA: 0x00091E28 File Offset: 0x00090028
public void RaiseOnDeserialized(object target, StreamingContext contex)
{
SerializationCallbacks.Invoke(this.onDeserializedList, target, contex);
}
// Token: 0x06002C47 RID: 11335 RVA: 0x00091E38 File Offset: 0x00090038
public static SerializationCallbacks GetSerializationCallbacks(Type t)
{
SerializationCallbacks serializationCallbacks = (SerializationCallbacks)SerializationCallbacks.cache[t];
if (serializationCallbacks != null)
{
return serializationCallbacks;
}
object obj = SerializationCallbacks.cache_lock;
SerializationCallbacks serializationCallbacks2;
lock (obj)
{
serializationCallbacks = (SerializationCallbacks)SerializationCallbacks.cache[t];
if (serializationCallbacks == null)
{
Hashtable hashtable = (Hashtable)SerializationCallbacks.cache.Clone();
serializationCallbacks = new SerializationCallbacks(t);
hashtable[t] = serializationCallbacks;
SerializationCallbacks.cache = hashtable;
}
serializationCallbacks2 = serializationCallbacks;
}
return serializationCallbacks2;
}
// Token: 0x04001127 RID: 4391
private const BindingFlags DefaultBindingFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
// Token: 0x04001128 RID: 4392
private readonly ArrayList onSerializingList;
// Token: 0x04001129 RID: 4393
private readonly ArrayList onSerializedList;
// Token: 0x0400112A RID: 4394
private readonly ArrayList onDeserializingList;
// Token: 0x0400112B RID: 4395
private readonly ArrayList onDeserializedList;
// Token: 0x0400112C RID: 4396
private static Hashtable cache = new Hashtable();
// Token: 0x0400112D RID: 4397
private static object cache_lock = new object();
// Token: 0x020006D0 RID: 1744
// (Invoke) Token: 0x060041C8 RID: 16840
public delegate void CallbackHandler(StreamingContext context);
}
}
@@ -0,0 +1,64 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Holds the value, <see cref="T:System.Type" />, and name of a serialized object. </summary>
// Token: 0x02000492 RID: 1170
[ComVisible(true)]
public struct SerializationEntry
{
// Token: 0x06002C48 RID: 11336 RVA: 0x00091ED8 File Offset: 0x000900D8
internal SerializationEntry(string name, Type type, object value)
{
this.name = name;
this.objectType = type;
this.value = value;
}
/// <summary>Gets the name of the object.</summary>
/// <returns>The name of the object.</returns>
// Token: 0x170008A4 RID: 2212
// (get) Token: 0x06002C49 RID: 11337 RVA: 0x00091EF0 File Offset: 0x000900F0
public string Name
{
get
{
return this.name;
}
}
/// <summary>Gets the <see cref="T:System.Type" /> of the object.</summary>
/// <returns>The <see cref="T:System.Type" /> of the object.</returns>
// Token: 0x170008A5 RID: 2213
// (get) Token: 0x06002C4A RID: 11338 RVA: 0x00091EF8 File Offset: 0x000900F8
public Type ObjectType
{
get
{
return this.objectType;
}
}
/// <summary>Gets the value contained in the object.</summary>
/// <returns>The value contained in the object.</returns>
// Token: 0x170008A6 RID: 2214
// (get) Token: 0x06002C4B RID: 11339 RVA: 0x00091F00 File Offset: 0x00090100
public object Value
{
get
{
return this.value;
}
}
// Token: 0x0400112E RID: 4398
private string name;
// Token: 0x0400112F RID: 4399
private Type objectType;
// Token: 0x04001130 RID: 4400
private object value;
}
}
@@ -0,0 +1,46 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>The exception thrown when an error occurs during serialization or deserialization.</summary>
// Token: 0x02000493 RID: 1171
[ComVisible(true)]
[Serializable]
public class SerializationException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.SerializationException" /> class with default properties.</summary>
// Token: 0x06002C4C RID: 11340 RVA: 0x00091F08 File Offset: 0x00090108
public SerializationException()
: base("An error occurred during (de)serialization")
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.SerializationException" /> class with a specified message.</summary>
/// <param name="message">Indicates the reason why the exception occurred. </param>
// Token: 0x06002C4D RID: 11341 RVA: 0x00091F18 File Offset: 0x00090118
public SerializationException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.SerializationException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
// Token: 0x06002C4E RID: 11342 RVA: 0x00091F24 File Offset: 0x00090124
public SerializationException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.SerializationException" /> class from serialized data.</summary>
/// <param name="info">The serialization information object holding the serialized object data in the name-value form. </param>
/// <param name="context">The contextual information about the source or destination of the exception. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception>
// Token: 0x06002C4F RID: 11343 RVA: 0x00091F30 File Offset: 0x00090130
protected SerializationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
@@ -0,0 +1,613 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.</summary>
// Token: 0x02000494 RID: 1172
[ComVisible(true)]
public sealed class SerializationInfo
{
// Token: 0x06002C50 RID: 11344 RVA: 0x00091F3C File Offset: 0x0009013C
private SerializationInfo(Type type)
{
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
this.converter = new FormatterConverter();
}
// Token: 0x06002C51 RID: 11345 RVA: 0x00091F90 File Offset: 0x00090190
private SerializationInfo(Type type, SerializationEntry[] data)
{
int num = data.Length;
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
this.converter = new FormatterConverter();
for (int i = 0; i < num; i++)
{
this.serialized.Add(data[i].Name, data[i]);
this.values.Add(data[i]);
}
}
/// <summary>Creates a new instance of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> class.</summary>
/// <param name="type">The <see cref="T:System.Type" /> of the object to serialize. </param>
/// <param name="converter">The <see cref="T:System.Runtime.Serialization.IFormatterConverter" /> used during deserialization. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> or <paramref name="converter" /> is null. </exception>
// Token: 0x06002C52 RID: 11346 RVA: 0x0009203C File Offset: 0x0009023C
[CLSCompliant(false)]
public SerializationInfo(Type type, IFormatterConverter converter)
{
if (type == null)
{
throw new ArgumentNullException("type", "Null argument");
}
if (converter == null)
{
throw new ArgumentNullException("converter", "Null argument");
}
this.converter = converter;
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
}
/// <summary>Gets or sets the assembly name of the type to serialize during serialization only.</summary>
/// <returns>The full name of the assembly of the type to serialize.</returns>
/// <exception cref="T:System.ArgumentNullException">The value the property is set to is null. </exception>
// Token: 0x170008A7 RID: 2215
// (get) Token: 0x06002C53 RID: 11347 RVA: 0x000920B8 File Offset: 0x000902B8
// (set) Token: 0x06002C54 RID: 11348 RVA: 0x000920C0 File Offset: 0x000902C0
public string AssemblyName
{
get
{
return this.assemblyName;
}
set
{
if (value == null)
{
throw new ArgumentNullException("Argument is null.");
}
this.assemblyName = value;
}
}
/// <summary>Gets or sets the full name of the <see cref="T:System.Type" /> to serialize.</summary>
/// <returns>The full name of the type to serialize.</returns>
/// <exception cref="T:System.ArgumentNullException">The value this property is set to is null. </exception>
// Token: 0x170008A8 RID: 2216
// (get) Token: 0x06002C55 RID: 11349 RVA: 0x000920DC File Offset: 0x000902DC
// (set) Token: 0x06002C56 RID: 11350 RVA: 0x000920E4 File Offset: 0x000902E4
public string FullTypeName
{
get
{
return this.fullTypeName;
}
set
{
if (value == null)
{
throw new ArgumentNullException("Argument is null.");
}
this.fullTypeName = value;
}
}
/// <summary>Gets the number of members that have been added to the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The number of members that have been added to the current <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</returns>
// Token: 0x170008A9 RID: 2217
// (get) Token: 0x06002C57 RID: 11351 RVA: 0x00092100 File Offset: 0x00090300
public int MemberCount
{
get
{
return this.serialized.Count;
}
}
/// <summary>Adds a value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store, where <paramref name="value" /> is associated with <paramref name="name" /> and is serialized as being of <see cref="T:System.Type" /><paramref name="type" />.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The value to be serialized. Any children of this object will automatically be serialized. </param>
/// <param name="type">The <see cref="T:System.Type" /> to associate with the current object. This parameter must always be the type of the object itself or of one of its base classes. </param>
/// <exception cref="T:System.ArgumentNullException">If <paramref name="name" /> or <paramref name="type" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C58 RID: 11352 RVA: 0x00092110 File Offset: 0x00090310
public void AddValue(string name, object value, Type type)
{
if (name == null)
{
throw new ArgumentNullException("name is null");
}
if (type == null)
{
throw new ArgumentNullException("type is null");
}
if (this.serialized.ContainsKey(name))
{
throw new SerializationException("Value has been serialized already.");
}
SerializationEntry serializationEntry = new SerializationEntry(name, type, value);
this.serialized.Add(name, serializationEntry);
this.values.Add(serializationEntry);
}
/// <summary>Retrieves a value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The object of the specified <see cref="T:System.Type" /> associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <param name="type">The <see cref="T:System.Type" /> of the value to retrieve. If the stored value cannot be converted to this type, the system will throw a <see cref="T:System.InvalidCastException" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> or <paramref name="type" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to <paramref name="type" />. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C59 RID: 11353 RVA: 0x0009218C File Offset: 0x0009038C
public object GetValue(string name, Type type)
{
if (name == null)
{
throw new ArgumentNullException("name is null.");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
if (!this.serialized.ContainsKey(name))
{
throw new SerializationException("No element named " + name + " could be found.");
}
SerializationEntry serializationEntry = (SerializationEntry)this.serialized[name];
if (serializationEntry.Value != null && !type.IsInstanceOfType(serializationEntry.Value))
{
return this.converter.Convert(serializationEntry.Value, type);
}
return serializationEntry.Value;
}
/// <summary>Sets the <see cref="T:System.Type" /> of the object to serialize.</summary>
/// <param name="type">The <see cref="T:System.Type" /> of the object to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
// Token: 0x06002C5A RID: 11354 RVA: 0x00092230 File Offset: 0x00090430
public void SetType(Type type)
{
if (type == null)
{
throw new ArgumentNullException("type is null.");
}
this.fullTypeName = type.FullName;
this.assemblyName = type.Assembly.FullName;
}
/// <summary>Returns a <see cref="T:System.Runtime.Serialization.SerializationInfoEnumerator" /> used to iterate through the name-value pairs in the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>A <see cref="T:System.Runtime.Serialization.SerializationInfoEnumerator" /> for parsing the name-value pairs contained in the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</returns>
// Token: 0x06002C5B RID: 11355 RVA: 0x0009226C File Offset: 0x0009046C
public SerializationInfoEnumerator GetEnumerator()
{
return new SerializationInfoEnumerator(this.values);
}
/// <summary>Adds a 16-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The Int16 value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C5C RID: 11356 RVA: 0x0009227C File Offset: 0x0009047C
public void AddValue(string name, short value)
{
this.AddValue(name, value, typeof(short));
}
/// <summary>Adds a 16-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The UInt16 value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C5D RID: 11357 RVA: 0x00092298 File Offset: 0x00090498
[CLSCompliant(false)]
public void AddValue(string name, ushort value)
{
this.AddValue(name, value, typeof(ushort));
}
/// <summary>Adds a 32-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The Int32 value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C5E RID: 11358 RVA: 0x000922B4 File Offset: 0x000904B4
public void AddValue(string name, int value)
{
this.AddValue(name, value, typeof(int));
}
/// <summary>Adds an 8-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The byte value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C5F RID: 11359 RVA: 0x000922D0 File Offset: 0x000904D0
public void AddValue(string name, byte value)
{
this.AddValue(name, value, typeof(byte));
}
/// <summary>Adds a Boolean value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The Boolean value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C60 RID: 11360 RVA: 0x000922EC File Offset: 0x000904EC
public void AddValue(string name, bool value)
{
this.AddValue(name, value, typeof(bool));
}
/// <summary>Adds a Unicode character value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The character value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C61 RID: 11361 RVA: 0x00092308 File Offset: 0x00090508
public void AddValue(string name, char value)
{
this.AddValue(name, value, typeof(char));
}
/// <summary>Adds an 8-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The Sbyte value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C62 RID: 11362 RVA: 0x00092324 File Offset: 0x00090524
[CLSCompliant(false)]
public void AddValue(string name, sbyte value)
{
this.AddValue(name, value, typeof(sbyte));
}
/// <summary>Adds a double-precision floating-point value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The double value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C63 RID: 11363 RVA: 0x00092340 File Offset: 0x00090540
public void AddValue(string name, double value)
{
this.AddValue(name, value, typeof(double));
}
/// <summary>Adds a decimal value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The decimal value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">If The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">If a value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C64 RID: 11364 RVA: 0x0009235C File Offset: 0x0009055C
public void AddValue(string name, decimal value)
{
this.AddValue(name, value, typeof(decimal));
}
/// <summary>Adds a <see cref="T:System.DateTime" /> value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The <see cref="T:System.DateTime" /> value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C65 RID: 11365 RVA: 0x00092378 File Offset: 0x00090578
public void AddValue(string name, DateTime value)
{
this.AddValue(name, value, typeof(DateTime));
}
/// <summary>Adds a single-precision floating-point value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The single value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C66 RID: 11366 RVA: 0x00092394 File Offset: 0x00090594
public void AddValue(string name, float value)
{
this.AddValue(name, value, typeof(float));
}
/// <summary>Adds a 32-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The UInt32 value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C67 RID: 11367 RVA: 0x000923B0 File Offset: 0x000905B0
[CLSCompliant(false)]
public void AddValue(string name, uint value)
{
this.AddValue(name, value, typeof(uint));
}
/// <summary>Adds a 64-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The Int64 value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C68 RID: 11368 RVA: 0x000923CC File Offset: 0x000905CC
public void AddValue(string name, long value)
{
this.AddValue(name, value, typeof(long));
}
/// <summary>Adds a 64-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The UInt64 value to serialize. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C69 RID: 11369 RVA: 0x000923E8 File Offset: 0x000905E8
[CLSCompliant(false)]
public void AddValue(string name, ulong value)
{
this.AddValue(name, value, typeof(ulong));
}
/// <summary>Adds the specified object into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store, where it is associated with a specified name.</summary>
/// <param name="name">The name to associate with the value, so it can be deserialized later. </param>
/// <param name="value">The value to be serialized. Any children of this object will automatically be serialized. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">A value has already been associated with <paramref name="name" />. </exception>
// Token: 0x06002C6A RID: 11370 RVA: 0x00092404 File Offset: 0x00090604
public void AddValue(string name, object value)
{
if (value == null)
{
this.AddValue(name, value, typeof(object));
}
else
{
this.AddValue(name, value, value.GetType());
}
}
/// <summary>Retrieves a Boolean value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The Boolean value associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a Boolean value. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C6B RID: 11371 RVA: 0x0009243C File Offset: 0x0009063C
public bool GetBoolean(string name)
{
object value = this.GetValue(name, typeof(bool));
return this.converter.ToBoolean(value);
}
/// <summary>Retrieves an 8-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 8-bit unsigned integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to an 8-bit unsigned integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C6C RID: 11372 RVA: 0x00092468 File Offset: 0x00090668
public byte GetByte(string name)
{
object value = this.GetValue(name, typeof(byte));
return this.converter.ToByte(value);
}
/// <summary>Retrieves a Unicode character value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The Unicode character associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a Unicode character. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C6D RID: 11373 RVA: 0x00092494 File Offset: 0x00090694
public char GetChar(string name)
{
object value = this.GetValue(name, typeof(char));
return this.converter.ToChar(value);
}
/// <summary>Retrieves a <see cref="T:System.DateTime" /> value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The <see cref="T:System.DateTime" /> value associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a <see cref="T:System.DateTime" /> value. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C6E RID: 11374 RVA: 0x000924C0 File Offset: 0x000906C0
public DateTime GetDateTime(string name)
{
object value = this.GetValue(name, typeof(DateTime));
return this.converter.ToDateTime(value);
}
/// <summary>Retrieves a decimal value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>A decimal value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</returns>
/// <param name="name">The name associated with the value to retrieve. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a decimal. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C6F RID: 11375 RVA: 0x000924EC File Offset: 0x000906EC
public decimal GetDecimal(string name)
{
object value = this.GetValue(name, typeof(decimal));
return this.converter.ToDecimal(value);
}
/// <summary>Retrieves a double-precision floating-point value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The double-precision floating-point value associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a double-precision floating-point value. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C70 RID: 11376 RVA: 0x00092518 File Offset: 0x00090718
public double GetDouble(string name)
{
object value = this.GetValue(name, typeof(double));
return this.converter.ToDouble(value);
}
/// <summary>Retrieves a 16-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 16-bit signed integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a 16-bit signed integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C71 RID: 11377 RVA: 0x00092544 File Offset: 0x00090744
public short GetInt16(string name)
{
object value = this.GetValue(name, typeof(short));
return this.converter.ToInt16(value);
}
/// <summary>Retrieves a 32-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 32-bit signed integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name of the value to retrieve. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a 32-bit signed integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C72 RID: 11378 RVA: 0x00092570 File Offset: 0x00090770
public int GetInt32(string name)
{
object value = this.GetValue(name, typeof(int));
return this.converter.ToInt32(value);
}
/// <summary>Retrieves a 64-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 64-bit signed integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a 64-bit signed integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C73 RID: 11379 RVA: 0x0009259C File Offset: 0x0009079C
public long GetInt64(string name)
{
object value = this.GetValue(name, typeof(long));
return this.converter.ToInt64(value);
}
/// <summary>Retrieves an 8-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 8-bit signed integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to an 8-bit signed integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C74 RID: 11380 RVA: 0x000925C8 File Offset: 0x000907C8
[CLSCompliant(false)]
public sbyte GetSByte(string name)
{
object value = this.GetValue(name, typeof(sbyte));
return this.converter.ToSByte(value);
}
/// <summary>Retrieves a single-precision floating-point value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The single-precision floating-point value associated with <paramref name="name" />.</returns>
/// <param name="name">The name of the value to retrieve. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a single-precision floating-point value. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C75 RID: 11381 RVA: 0x000925F4 File Offset: 0x000907F4
public float GetSingle(string name)
{
object value = this.GetValue(name, typeof(float));
return this.converter.ToSingle(value);
}
/// <summary>Retrieves a <see cref="T:System.String" /> value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The <see cref="T:System.String" /> associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a <see cref="T:System.String" />. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C76 RID: 11382 RVA: 0x00092620 File Offset: 0x00090820
public string GetString(string name)
{
object value = this.GetValue(name, typeof(string));
if (value == null)
{
return null;
}
return this.converter.ToString(value);
}
/// <summary>Retrieves a 16-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 16-bit unsigned integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a 16-bit unsigned integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C77 RID: 11383 RVA: 0x00092654 File Offset: 0x00090854
[CLSCompliant(false)]
public ushort GetUInt16(string name)
{
object value = this.GetValue(name, typeof(ushort));
return this.converter.ToUInt16(value);
}
/// <summary>Retrieves a 32-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 32-bit unsigned integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a 32-bit unsigned integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C78 RID: 11384 RVA: 0x00092680 File Offset: 0x00090880
[CLSCompliant(false)]
public uint GetUInt32(string name)
{
object value = this.GetValue(name, typeof(uint));
return this.converter.ToUInt32(value);
}
/// <summary>Retrieves a 64-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.</summary>
/// <returns>The 64-bit unsigned integer associated with <paramref name="name" />.</returns>
/// <param name="name">The name associated with the value to retrieve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
/// <exception cref="T:System.InvalidCastException">The value associated with <paramref name="name" /> cannot be converted to a 64-bit unsigned integer. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An element with the specified name is not found in the current instance. </exception>
// Token: 0x06002C79 RID: 11385 RVA: 0x000926AC File Offset: 0x000908AC
[CLSCompliant(false)]
public ulong GetUInt64(string name)
{
object value = this.GetValue(name, typeof(ulong));
return this.converter.ToUInt64(value);
}
// Token: 0x06002C7A RID: 11386 RVA: 0x000926D8 File Offset: 0x000908D8
private SerializationEntry[] get_entries()
{
SerializationEntry[] array = new SerializationEntry[this.MemberCount];
int num = 0;
foreach (SerializationEntry serializationEntry in this)
{
array[num++] = serializationEntry;
}
return array;
}
// Token: 0x04001131 RID: 4401
private Hashtable serialized = new Hashtable();
// Token: 0x04001132 RID: 4402
private ArrayList values = new ArrayList();
// Token: 0x04001133 RID: 4403
private string assemblyName;
// Token: 0x04001134 RID: 4404
private string fullTypeName;
// Token: 0x04001135 RID: 4405
private IFormatterConverter converter;
}
}
@@ -0,0 +1,104 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Provides a formatter-friendly mechanism for parsing the data in <see cref="T:System.Runtime.Serialization.SerializationInfo" />. This class cannot be inherited.</summary>
// Token: 0x02000495 RID: 1173
[ComVisible(true)]
public sealed class SerializationInfoEnumerator : IEnumerator
{
// Token: 0x06002C7B RID: 11387 RVA: 0x00092724 File Offset: 0x00090924
internal SerializationInfoEnumerator(ArrayList list)
{
this.enumerator = list.GetEnumerator();
}
/// <summary>Gets the current item in the collection.</summary>
/// <returns>A <see cref="T:System.Runtime.Serialization.SerializationEntry" /> that contains the current serialization data.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumeration has not started or has already ended. </exception>
// Token: 0x170008AA RID: 2218
// (get) Token: 0x06002C7C RID: 11388 RVA: 0x00092738 File Offset: 0x00090938
object IEnumerator.Current
{
get
{
return this.enumerator.Current;
}
}
/// <summary>Gets the item currently being examined.</summary>
/// <returns>The item currently being examined.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator has not started enumerating items or has reached the end of the enumeration. </exception>
// Token: 0x170008AB RID: 2219
// (get) Token: 0x06002C7D RID: 11389 RVA: 0x00092748 File Offset: 0x00090948
public SerializationEntry Current
{
get
{
return (SerializationEntry)this.enumerator.Current;
}
}
/// <summary>Gets the name for the item currently being examined.</summary>
/// <returns>The item name.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator has not started enumerating items or has reached the end of the enumeration. </exception>
// Token: 0x170008AC RID: 2220
// (get) Token: 0x06002C7E RID: 11390 RVA: 0x0009275C File Offset: 0x0009095C
public string Name
{
get
{
SerializationEntry serializationEntry = this.Current;
return serializationEntry.Name;
}
}
/// <summary>Gets the type of the item currently being examined.</summary>
/// <returns>The type of the item currently being examined.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator has not started enumerating items or has reached the end of the enumeration. </exception>
// Token: 0x170008AD RID: 2221
// (get) Token: 0x06002C7F RID: 11391 RVA: 0x00092778 File Offset: 0x00090978
public Type ObjectType
{
get
{
SerializationEntry serializationEntry = this.Current;
return serializationEntry.ObjectType;
}
}
/// <summary>Gets the value of the item currently being examined.</summary>
/// <returns>The value of the item currently being examined.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator has not started enumerating items or has reached the end of the enumeration. </exception>
// Token: 0x170008AE RID: 2222
// (get) Token: 0x06002C80 RID: 11392 RVA: 0x00092794 File Offset: 0x00090994
public object Value
{
get
{
SerializationEntry serializationEntry = this.Current;
return serializationEntry.Value;
}
}
/// <summary>Updates the enumerator to the next item.</summary>
/// <returns>true if a new element is found; otherwise, false.</returns>
// Token: 0x06002C81 RID: 11393 RVA: 0x000927B0 File Offset: 0x000909B0
public bool MoveNext()
{
return this.enumerator.MoveNext();
}
/// <summary>Resets the enumerator to the first item.</summary>
// Token: 0x06002C82 RID: 11394 RVA: 0x000927C0 File Offset: 0x000909C0
public void Reset()
{
this.enumerator.Reset();
}
// Token: 0x04001136 RID: 4406
private IEnumerator enumerator;
}
}
@@ -0,0 +1,60 @@
using System;
using System.Collections;
namespace System.Runtime.Serialization
{
/// <summary>Manages serialization processes at run time. This class cannot be inherited.</summary>
// Token: 0x02000496 RID: 1174
public sealed class SerializationObjectManager
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.SerializationObjectManager" /> class. </summary>
/// <param name="context">An instance of the <see cref="T:System.Runtime.Serialization.StreamingContext" /> class that contains information about the current serialization operation.</param>
// Token: 0x06002C83 RID: 11395 RVA: 0x000927D0 File Offset: 0x000909D0
public SerializationObjectManager(StreamingContext context)
{
this.context = context;
}
// Token: 0x14000007 RID: 7
// (add) Token: 0x06002C84 RID: 11396 RVA: 0x000927EC File Offset: 0x000909EC
// (remove) Token: 0x06002C85 RID: 11397 RVA: 0x00092808 File Offset: 0x00090A08
private event SerializationCallbacks.CallbackHandler callbacks;
/// <summary>Registers the object upon which events will be raised.</summary>
/// <param name="obj">The object to register.</param>
// Token: 0x06002C86 RID: 11398 RVA: 0x00092824 File Offset: 0x00090A24
public void RegisterObject(object obj)
{
if (this.seen.Contains(obj))
{
return;
}
SerializationCallbacks sc = SerializationCallbacks.GetSerializationCallbacks(obj.GetType());
this.seen[obj] = 1;
sc.RaiseOnSerializing(obj, this.context);
if (sc.HasSerializedCallbacks)
{
this.callbacks = (SerializationCallbacks.CallbackHandler)Delegate.Combine(this.callbacks, new SerializationCallbacks.CallbackHandler(delegate(StreamingContext ctx)
{
sc.RaiseOnSerialized(obj, ctx);
}));
}
}
/// <summary>Invokes the OnSerializing callback event if the type of the object has one; and registers the object for raising the OnSerialized event if the type of the object has one.</summary>
// Token: 0x06002C87 RID: 11399 RVA: 0x000928CC File Offset: 0x00090ACC
public void RaiseOnSerializedEvent()
{
if (this.callbacks != null)
{
this.callbacks(this.context);
}
}
// Token: 0x04001137 RID: 4407
private readonly StreamingContext context;
// Token: 0x04001138 RID: 4408
private readonly Hashtable seen = new Hashtable();
}
}
@@ -0,0 +1,83 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Describes the source and destination of a given serialized stream, and provides an additional caller-defined context.</summary>
// Token: 0x02000497 RID: 1175
[ComVisible(true)]
[Serializable]
public struct StreamingContext
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.StreamingContext" /> class with a given context state.</summary>
/// <param name="state">A bitwise combination of the <see cref="T:System.Runtime.Serialization.StreamingContextStates" /> values that specify the source or destination context for this <see cref="T:System.Runtime.Serialization.StreamingContext" />. </param>
// Token: 0x06002C88 RID: 11400 RVA: 0x000928EC File Offset: 0x00090AEC
public StreamingContext(StreamingContextStates state)
{
this.state = state;
this.additional = null;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Serialization.StreamingContext" /> class with a given context state, and some additional information.</summary>
/// <param name="state">A bitwise combination of the <see cref="T:System.Runtime.Serialization.StreamingContextStates" /> values that specify the source or destination context for this <see cref="T:System.Runtime.Serialization.StreamingContext" />. </param>
/// <param name="additional">Any additional information to be associated with the <see cref="T:System.Runtime.Serialization.StreamingContext" />. This information is available to any object that implements <see cref="T:System.Runtime.Serialization.ISerializable" /> or any serialization surrogate. Most users do not need to set this parameter. </param>
// Token: 0x06002C89 RID: 11401 RVA: 0x000928FC File Offset: 0x00090AFC
public StreamingContext(StreamingContextStates state, object additional)
{
this.state = state;
this.additional = additional;
}
/// <summary>Gets context specified as part of the additional context.</summary>
/// <returns>The context specified as part of the additional context.</returns>
// Token: 0x170008AF RID: 2223
// (get) Token: 0x06002C8A RID: 11402 RVA: 0x0009290C File Offset: 0x00090B0C
public object Context
{
get
{
return this.additional;
}
}
/// <summary>Gets the source or destination of the transmitted data.</summary>
/// <returns>During serialization, the destination of the transmitted data. During deserialization, the source of the data.</returns>
// Token: 0x170008B0 RID: 2224
// (get) Token: 0x06002C8B RID: 11403 RVA: 0x00092914 File Offset: 0x00090B14
public StreamingContextStates State
{
get
{
return this.state;
}
}
/// <summary>Determines whether two <see cref="T:System.Runtime.Serialization.StreamingContext" /> instances contain the same values.</summary>
/// <returns>true if the specified object is an instance of <see cref="T:System.Runtime.Serialization.StreamingContext" /> and equals the value of the current instance; otherwise, false.</returns>
/// <param name="obj">An object to compare with the current instance. </param>
// Token: 0x06002C8C RID: 11404 RVA: 0x0009291C File Offset: 0x00090B1C
public override bool Equals(object obj)
{
if (!(obj is StreamingContext))
{
return false;
}
StreamingContext streamingContext = (StreamingContext)obj;
return streamingContext.state == this.state && streamingContext.additional == this.additional;
}
/// <summary>Returns a hash code of this object.</summary>
/// <returns>The <see cref="T:System.Runtime.Serialization.StreamingContextStates" /> value that contains the source or destination of the serialization for this <see cref="T:System.Runtime.Serialization.StreamingContext" />.</returns>
// Token: 0x06002C8D RID: 11405 RVA: 0x00092964 File Offset: 0x00090B64
public override int GetHashCode()
{
return (int)this.state;
}
// Token: 0x0400113A RID: 4410
private StreamingContextStates state;
// Token: 0x0400113B RID: 4411
private object additional;
}
}
@@ -0,0 +1,41 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Defines a set of flags that specifies the source or destination context for the stream during serialization.</summary>
// Token: 0x02000498 RID: 1176
[ComVisible(true)]
[Flags]
[Serializable]
public enum StreamingContextStates
{
/// <summary>Specifies that the source or destination context is a different process on the same computer.</summary>
// Token: 0x0400113D RID: 4413
CrossProcess = 1,
/// <summary>Specifies that the source or destination context is a different computer.</summary>
// Token: 0x0400113E RID: 4414
CrossMachine = 2,
/// <summary>Specifies that the source or destination context is a file. Users can assume that files will last longer than the process that created them and not serialize objects in such a way that deserialization will require accessing any data from the current process.</summary>
// Token: 0x0400113F RID: 4415
File = 4,
/// <summary>Specifies that the source or destination context is a persisted store, which could include databases, files, or other backing stores. Users can assume that persisted data will last longer than the process that created the data and not serialize objects so that deserialization will require accessing any data from the current process.</summary>
// Token: 0x04001140 RID: 4416
Persistence = 8,
/// <summary>Specifies that the data is remoted to a context in an unknown location. Users cannot make any assumptions whether this is on the same computer.</summary>
// Token: 0x04001141 RID: 4417
Remoting = 16,
/// <summary>Specifies that the serialization context is unknown.</summary>
// Token: 0x04001142 RID: 4418
Other = 32,
/// <summary>Specifies that the object graph is being cloned. Users can assume that the cloned graph will continue to exist within the same process and be safe to access handles or other references to unmanaged resources.</summary>
// Token: 0x04001143 RID: 4419
Clone = 64,
/// <summary>Specifies that the source or destination context is a different AppDomain. (For a description of AppDomains, see Application Domains).</summary>
// Token: 0x04001144 RID: 4420
CrossAppDomain = 128,
/// <summary>Specifies that the serialized data can be transmitted to or received from any of the other contexts.</summary>
// Token: 0x04001145 RID: 4421
All = 255
}
}
@@ -0,0 +1,114 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// <summary>Assists formatters in selection of the serialization surrogate to delegate the serialization or deserialization process to.</summary>
// Token: 0x02000499 RID: 1177
[ComVisible(true)]
public class SurrogateSelector : ISurrogateSelector
{
/// <summary>Adds a surrogate to the list of checked surrogates.</summary>
/// <param name="type">The <see cref="T:System.Type" /> for which the surrogate is required.</param>
/// <param name="context">The context-specific data. </param>
/// <param name="surrogate">The surrogate to call for this type. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> or <paramref name="surrogate" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">A surrogate already exists for this type and context. </exception>
// Token: 0x06002C8F RID: 11407 RVA: 0x00092980 File Offset: 0x00090B80
public virtual void AddSurrogate(Type type, StreamingContext context, ISerializationSurrogate surrogate)
{
if (type == null || surrogate == null)
{
throw new ArgumentNullException("Null reference.");
}
string text = type.FullName + "#" + context.ToString();
if (this.Surrogates.ContainsKey(text))
{
throw new ArgumentException("A surrogate for " + type.FullName + " already exists.");
}
this.Surrogates.Add(text, surrogate);
}
/// <summary>Adds the specified <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> that can handle a particular object type to the list of surrogates.</summary>
/// <param name="selector">The surrogate selector to add. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="selector" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The selector is already on the list of selectors. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002C90 RID: 11408 RVA: 0x000929FC File Offset: 0x00090BFC
public virtual void ChainSelector(ISurrogateSelector selector)
{
if (selector == null)
{
throw new ArgumentNullException("Selector is null.");
}
if (this.nextSelector != null)
{
selector.ChainSelector(this.nextSelector);
}
this.nextSelector = selector;
}
/// <summary>Returns the next selector on the chain of selectors.</summary>
/// <returns>The next <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> on the chain of selectors.</returns>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
// Token: 0x06002C91 RID: 11409 RVA: 0x00092A30 File Offset: 0x00090C30
public virtual ISurrogateSelector GetNextSelector()
{
return this.nextSelector;
}
/// <summary>Returns the surrogate for a particular type.</summary>
/// <returns>The surrogate for a particular type.</returns>
/// <param name="type">The <see cref="T:System.Type" /> for which the surrogate is requested. </param>
/// <param name="context">The streaming context. </param>
/// <param name="selector">The surrogate to use. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x06002C92 RID: 11410 RVA: 0x00092A38 File Offset: 0x00090C38
public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
{
if (type == null)
{
throw new ArgumentNullException("type is null.");
}
string text = type.FullName + "#" + context.ToString();
ISerializationSurrogate serializationSurrogate = (ISerializationSurrogate)this.Surrogates[text];
if (serializationSurrogate != null)
{
selector = this;
return serializationSurrogate;
}
if (this.nextSelector != null)
{
return this.nextSelector.GetSurrogate(type, context, out selector);
}
selector = null;
return null;
}
/// <summary>Removes the surrogate associated with a given type.</summary>
/// <param name="type">The <see cref="T:System.Type" /> for which to remove the surrogate. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> for the current surrogate. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="type" /> parameter is null. </exception>
// Token: 0x06002C93 RID: 11411 RVA: 0x00092AB0 File Offset: 0x00090CB0
public virtual void RemoveSurrogate(Type type, StreamingContext context)
{
if (type == null)
{
throw new ArgumentNullException("type is null.");
}
string text = type.FullName + "#" + context.ToString();
this.Surrogates.Remove(text);
}
// Token: 0x04001146 RID: 4422
private Hashtable Surrogates = new Hashtable();
// Token: 0x04001147 RID: 4423
private ISurrogateSelector nextSelector;
}
}