scripts
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
|
||||
namespace System.Runtime.Remoting.Messaging
|
||||
{
|
||||
// Token: 0x020003DC RID: 988
|
||||
internal class CADMethodCallMessage : CADMessageBase
|
||||
{
|
||||
// Token: 0x060026B6 RID: 9910 RVA: 0x0007FA3C File Offset: 0x0007DC3C
|
||||
internal CADMethodCallMessage(IMethodCallMessage callMsg)
|
||||
{
|
||||
this._uri = callMsg.Uri;
|
||||
this.MethodHandle = callMsg.MethodBase.MethodHandle;
|
||||
this.FullTypeName = callMsg.MethodBase.DeclaringType.AssemblyQualifiedName;
|
||||
ArrayList arrayList = null;
|
||||
this._propertyCount = CADMessageBase.MarshalProperties(callMsg.Properties, ref arrayList);
|
||||
this._args = base.MarshalArguments(callMsg.Args, ref arrayList);
|
||||
base.SaveLogicalCallContext(callMsg, ref arrayList);
|
||||
if (arrayList != null)
|
||||
{
|
||||
MemoryStream memoryStream = CADSerializer.SerializeObject(arrayList.ToArray());
|
||||
this._serializedArgs = memoryStream.GetBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000744 RID: 1860
|
||||
// (get) Token: 0x060026B7 RID: 9911 RVA: 0x0007FAD4 File Offset: 0x0007DCD4
|
||||
internal string Uri
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._uri;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060026B8 RID: 9912 RVA: 0x0007FADC File Offset: 0x0007DCDC
|
||||
internal static CADMethodCallMessage Create(IMessage callMsg)
|
||||
{
|
||||
IMethodCallMessage methodCallMessage = callMsg as IMethodCallMessage;
|
||||
if (methodCallMessage == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new CADMethodCallMessage(methodCallMessage);
|
||||
}
|
||||
|
||||
// Token: 0x060026B9 RID: 9913 RVA: 0x0007FB00 File Offset: 0x0007DD00
|
||||
internal ArrayList GetArguments()
|
||||
{
|
||||
ArrayList arrayList = null;
|
||||
if (this._serializedArgs != null)
|
||||
{
|
||||
object[] array = (object[])CADSerializer.DeserializeObject(new MemoryStream(this._serializedArgs));
|
||||
arrayList = new ArrayList(array);
|
||||
this._serializedArgs = null;
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
// Token: 0x060026BA RID: 9914 RVA: 0x0007FB40 File Offset: 0x0007DD40
|
||||
internal object[] GetArgs(ArrayList args)
|
||||
{
|
||||
return base.UnmarshalArguments(this._args, args);
|
||||
}
|
||||
|
||||
// Token: 0x17000745 RID: 1861
|
||||
// (get) Token: 0x060026BB RID: 9915 RVA: 0x0007FB50 File Offset: 0x0007DD50
|
||||
internal int PropertiesCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._propertyCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060026BC RID: 9916 RVA: 0x0007FB58 File Offset: 0x0007DD58
|
||||
private static Type[] GetSignature(MethodBase methodBase, bool load)
|
||||
{
|
||||
ParameterInfo[] parameters = methodBase.GetParameters();
|
||||
Type[] array = new Type[parameters.Length];
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
array[i] = Type.GetType(parameters[i].ParameterType.AssemblyQualifiedName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = parameters[i].ParameterType;
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060026BD RID: 9917 RVA: 0x0007FBB8 File Offset: 0x0007DDB8
|
||||
internal MethodBase GetMethod()
|
||||
{
|
||||
Type type = Type.GetType(this.FullTypeName);
|
||||
MethodBase methodBase;
|
||||
if (type.IsGenericType || type.IsGenericTypeDefinition)
|
||||
{
|
||||
methodBase = MethodBase.GetMethodFromHandleNoGenericCheck(this.MethodHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
methodBase = MethodBase.GetMethodFromHandle(this.MethodHandle);
|
||||
}
|
||||
if (type == methodBase.DeclaringType)
|
||||
{
|
||||
return methodBase;
|
||||
}
|
||||
Type[] signature = CADMethodCallMessage.GetSignature(methodBase, true);
|
||||
if (methodBase.IsGenericMethod)
|
||||
{
|
||||
MethodBase[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
Type[] genericArguments = methodBase.GetGenericArguments();
|
||||
foreach (MethodBase methodBase2 in methods)
|
||||
{
|
||||
if (methodBase2.IsGenericMethod && !(methodBase2.Name != methodBase.Name))
|
||||
{
|
||||
Type[] genericArguments2 = methodBase2.GetGenericArguments();
|
||||
if (genericArguments.Length == genericArguments2.Length)
|
||||
{
|
||||
MethodInfo methodInfo = ((MethodInfo)methodBase2).MakeGenericMethod(genericArguments);
|
||||
Type[] signature2 = CADMethodCallMessage.GetSignature(methodInfo, false);
|
||||
if (signature2.Length == signature.Length)
|
||||
{
|
||||
bool flag = false;
|
||||
for (int j = signature2.Length - 1; j >= 0; j--)
|
||||
{
|
||||
if (signature2[j] != signature[j])
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return methodInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return methodBase;
|
||||
}
|
||||
MethodBase method = type.GetMethod(methodBase.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, signature, null);
|
||||
if (method == null)
|
||||
{
|
||||
throw new RemotingException(string.Concat(new object[] { "Method '", methodBase.Name, "' not found in type '", type, "'" }));
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
// Token: 0x04000F27 RID: 3879
|
||||
private string _uri;
|
||||
|
||||
// Token: 0x04000F28 RID: 3880
|
||||
internal RuntimeMethodHandle MethodHandle;
|
||||
|
||||
// Token: 0x04000F29 RID: 3881
|
||||
internal string FullTypeName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user