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,274 @@
using System;
using System.Collections;
using System.Runtime.Remoting.Channels;
using System.Threading;
namespace System.Runtime.Remoting.Messaging
{
// Token: 0x020003DB RID: 987
internal class CADMessageBase
{
// Token: 0x060026AD RID: 9901 RVA: 0x0007F364 File Offset: 0x0007D564
internal static int MarshalProperties(IDictionary dict, ref ArrayList args)
{
int num = 0;
MethodDictionary methodDictionary = dict as MethodDictionary;
if (methodDictionary != null)
{
if (methodDictionary.HasInternalProperties)
{
IDictionary internalProperties = methodDictionary.InternalProperties;
if (internalProperties != null)
{
foreach (object obj in internalProperties)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
if (args == null)
{
args = new ArrayList();
}
args.Add(dictionaryEntry);
num++;
}
}
}
}
else if (dict != null)
{
foreach (object obj2 in dict)
{
DictionaryEntry dictionaryEntry2 = (DictionaryEntry)obj2;
if (args == null)
{
args = new ArrayList();
}
args.Add(dictionaryEntry2);
num++;
}
}
return num;
}
// Token: 0x060026AE RID: 9902 RVA: 0x0007F4A0 File Offset: 0x0007D6A0
internal static void UnmarshalProperties(IDictionary dict, int count, ArrayList args)
{
for (int i = 0; i < count; i++)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)args[i];
dict[dictionaryEntry.Key] = dictionaryEntry.Value;
}
}
// Token: 0x060026AF RID: 9903 RVA: 0x0007F4E0 File Offset: 0x0007D6E0
private static bool IsPossibleToIgnoreMarshal(object obj)
{
Type type = obj.GetType();
return type.IsPrimitive || type == typeof(void) || (type.IsArray && type.GetElementType().IsPrimitive && ((Array)obj).Rank == 1) || (obj is string || obj is DateTime || obj is TimeSpan);
}
// Token: 0x060026B0 RID: 9904 RVA: 0x0007F564 File Offset: 0x0007D764
protected object MarshalArgument(object arg, ref ArrayList args)
{
if (arg == null)
{
return null;
}
if (CADMessageBase.IsPossibleToIgnoreMarshal(arg))
{
return arg;
}
MarshalByRefObject marshalByRefObject = arg as MarshalByRefObject;
if (marshalByRefObject != null)
{
if (!RemotingServices.IsTransparentProxy(marshalByRefObject))
{
ObjRef objRef = RemotingServices.Marshal(marshalByRefObject);
return new CADObjRef(objRef, Thread.GetDomainID());
}
}
if (args == null)
{
args = new ArrayList();
}
args.Add(arg);
return new CADArgHolder(args.Count - 1);
}
// Token: 0x060026B1 RID: 9905 RVA: 0x0007F5DC File Offset: 0x0007D7DC
protected object UnmarshalArgument(object arg, ArrayList args)
{
if (arg == null)
{
return null;
}
CADArgHolder cadargHolder = arg as CADArgHolder;
if (cadargHolder != null)
{
return args[cadargHolder.index];
}
CADObjRef cadobjRef = arg as CADObjRef;
if (cadobjRef != null)
{
string text = string.Copy(cadobjRef.TypeName);
string text2 = string.Copy(cadobjRef.URI);
int sourceDomain = cadobjRef.SourceDomain;
ChannelInfo channelInfo = new ChannelInfo(new CrossAppDomainData(sourceDomain));
ObjRef objRef = new ObjRef(text, text2, channelInfo);
return RemotingServices.Unmarshal(objRef);
}
if (arg is Array)
{
Array array = (Array)arg;
Array array2;
switch (Type.GetTypeCode(arg.GetType().GetElementType()))
{
case TypeCode.Boolean:
array2 = new bool[array.Length];
break;
case TypeCode.Char:
array2 = new char[array.Length];
break;
case TypeCode.SByte:
array2 = new sbyte[array.Length];
break;
case TypeCode.Byte:
array2 = new byte[array.Length];
break;
case TypeCode.Int16:
array2 = new short[array.Length];
break;
case TypeCode.UInt16:
array2 = new ushort[array.Length];
break;
case TypeCode.Int32:
array2 = new int[array.Length];
break;
case TypeCode.UInt32:
array2 = new uint[array.Length];
break;
case TypeCode.Int64:
array2 = new long[array.Length];
break;
case TypeCode.UInt64:
array2 = new ulong[array.Length];
break;
case TypeCode.Single:
array2 = new float[array.Length];
break;
case TypeCode.Double:
array2 = new double[array.Length];
break;
case TypeCode.Decimal:
array2 = new decimal[array.Length];
break;
default:
throw new NotSupportedException();
}
array.CopyTo(array2, 0);
return array2;
}
switch (Type.GetTypeCode(arg.GetType()))
{
case TypeCode.Boolean:
return (bool)arg;
case TypeCode.Char:
return (char)arg;
case TypeCode.SByte:
return (sbyte)arg;
case TypeCode.Byte:
return (byte)arg;
case TypeCode.Int16:
return (short)arg;
case TypeCode.UInt16:
return (ushort)arg;
case TypeCode.Int32:
return (int)arg;
case TypeCode.UInt32:
return (uint)arg;
case TypeCode.Int64:
return (long)arg;
case TypeCode.UInt64:
return (ulong)arg;
case TypeCode.Single:
return (float)arg;
case TypeCode.Double:
return (double)arg;
case TypeCode.Decimal:
return (decimal)arg;
case TypeCode.DateTime:
return new DateTime(((DateTime)arg).Ticks);
case TypeCode.String:
return string.Copy((string)arg);
}
if (arg is TimeSpan)
{
return new TimeSpan(((TimeSpan)arg).Ticks);
}
if (arg is IntPtr)
{
return (IntPtr)arg;
}
throw new NotSupportedException("Parameter of type " + arg.GetType() + " cannot be unmarshalled");
}
// Token: 0x060026B2 RID: 9906 RVA: 0x0007F944 File Offset: 0x0007DB44
internal object[] MarshalArguments(object[] arguments, ref ArrayList args)
{
object[] array = new object[arguments.Length];
int num = arguments.Length;
for (int i = 0; i < num; i++)
{
array[i] = this.MarshalArgument(arguments[i], ref args);
}
return array;
}
// Token: 0x060026B3 RID: 9907 RVA: 0x0007F980 File Offset: 0x0007DB80
internal object[] UnmarshalArguments(object[] arguments, ArrayList args)
{
object[] array = new object[arguments.Length];
int num = arguments.Length;
for (int i = 0; i < num; i++)
{
array[i] = this.UnmarshalArgument(arguments[i], args);
}
return array;
}
// Token: 0x060026B4 RID: 9908 RVA: 0x0007F9BC File Offset: 0x0007DBBC
protected void SaveLogicalCallContext(IMethodMessage msg, ref ArrayList serializeList)
{
if (msg.LogicalCallContext != null && msg.LogicalCallContext.HasInfo)
{
if (serializeList == null)
{
serializeList = new ArrayList();
}
this._callContext = new CADArgHolder(serializeList.Count);
serializeList.Add(msg.LogicalCallContext);
}
}
// Token: 0x060026B5 RID: 9909 RVA: 0x0007FA14 File Offset: 0x0007DC14
internal LogicalCallContext GetLogicalCallContext(ArrayList args)
{
if (this._callContext == null)
{
return null;
}
return (LogicalCallContext)args[this._callContext.index];
}
// Token: 0x04000F23 RID: 3875
protected object[] _args;
// Token: 0x04000F24 RID: 3876
protected byte[] _serializedArgs;
// Token: 0x04000F25 RID: 3877
protected int _propertyCount;
// Token: 0x04000F26 RID: 3878
protected CADArgHolder _callContext;
}
}