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,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
}
}