static private SoapCoerceArg ( Object value, Type pt, Hashtable keyToNamespaceTable ) : Object | ||
value | Object | |
pt | Type | |
keyToNamespaceTable | Hashtable | |
Результат | Object |
internal void SetObjectFromSoapData(SerializationInfo info) { Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable)); ArrayList list = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList)); SoapFault fault = (SoapFault)info.GetValue("__fault", typeof(SoapFault)); if (fault != null) { ServerFault detail = fault.Detail as ServerFault; if (detail != null) { if (detail.Exception != null) { this.fault = detail.Exception; } else { Type type = Type.GetType(detail.ExceptionType, false, false); if (type == null) { StringBuilder builder = new StringBuilder(); builder.Append("\nException Type: "); builder.Append(detail.ExceptionType); builder.Append("\n"); builder.Append("Exception Message: "); builder.Append(detail.ExceptionMessage); builder.Append("\n"); builder.Append(detail.StackTrace); this.fault = new ServerException(builder.ToString()); } else { object[] args = new object[] { detail.ExceptionMessage }; this.fault = (System.Exception)Activator.CreateInstance(type, BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, args, null, null); } } } else if (((fault.Detail != null) && (fault.Detail.GetType() == typeof(string))) && (((string)fault.Detail).Length != 0)) { this.fault = new ServerException((string)fault.Detail); } else { this.fault = new ServerException(fault.FaultString); } } else { MethodInfo mI = this.MI as MethodInfo; int num = 0; if (mI != null) { Type returnType = mI.ReturnType; if (returnType != typeof(void)) { num++; object obj2 = info.GetValue((string)list[0], typeof(object)); if (obj2 is string) { this.retVal = Message.SoapCoerceArg(obj2, returnType, keyToNamespaceTable); } else { this.retVal = obj2; } } } ParameterInfo[] parameters = this._methodCache.Parameters; object obj3 = (this.InternalProperties == null) ? null : this.InternalProperties["__UnorderedParams"]; if (((obj3 != null) && (obj3 is bool)) && ((bool)obj3)) { for (int i = num; i < list.Count; i++) { string name = (string)list[i]; int index = -1; for (int j = 0; j < parameters.Length; j++) { if (name.Equals(parameters[j].Name)) { index = parameters[j].Position; } } if (index == -1) { if (!name.StartsWith("__param", StringComparison.Ordinal)) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } index = int.Parse(name.Substring(7), CultureInfo.InvariantCulture); } if (index >= this.argCount) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } if (this.outArgs == null) { this.outArgs = new object[this.argCount]; } this.outArgs[index] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[index].ParameterType, keyToNamespaceTable); } } else { if (this.argMapper == null) { this.argMapper = new ArgMapper(this, true); } for (int k = num; k < list.Count; k++) { string str2 = (string)list[k]; if (this.outArgs == null) { this.outArgs = new object[this.argCount]; } int num6 = this.argMapper.Map[k - num]; this.outArgs[num6] = Message.SoapCoerceArg(info.GetValue(str2, typeof(object)), parameters[num6].ParameterType, keyToNamespaceTable); } } } }
internal void SetObjectFromSoapData(SerializationInfo info) { this.methodName = info.GetString("__methodName"); ArrayList list = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList)); Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable)); if (this.MI == null) { ArrayList argValues = new ArrayList(); ArrayList argNames = list; for (int i = 0; i < argNames.Count; i++) { argValues.Add(info.GetValue((string)argNames[i], typeof(object))); } RuntimeType t = this.ResolveType() as RuntimeType; if (t == null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"), new object[] { this.typeName })); } this.ResolveOverloadedMethod(t, this.methodName, argNames, argValues); if (this.MI == null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), new object[] { this.methodName, this.typeName })); } } RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(this.MI); ParameterInfo[] parameters = reflectionCachedData.Parameters; int[] marshalRequestArgMap = reflectionCachedData.MarshalRequestArgMap; object obj2 = (this.InternalProperties == null) ? null : this.InternalProperties["__UnorderedParams"]; this.args = new object[parameters.Length]; if (((obj2 != null) && (obj2 is bool)) && ((bool)obj2)) { for (int j = 0; j < list.Count; j++) { string name = (string)list[j]; int index = -1; for (int k = 0; k < parameters.Length; k++) { if (name.Equals(parameters[k].Name)) { index = parameters[k].Position; break; } } if (index == -1) { if (!name.StartsWith("__param", StringComparison.Ordinal)) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } index = int.Parse(name.Substring(7), CultureInfo.InvariantCulture); } if (index >= this.args.Length) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } this.args[index] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[index].ParameterType, keyToNamespaceTable); } } else { for (int m = 0; m < list.Count; m++) { string str2 = (string)list[m]; this.args[marshalRequestArgMap[m]] = Message.SoapCoerceArg(info.GetValue(str2, typeof(object)), parameters[marshalRequestArgMap[m]].ParameterType, keyToNamespaceTable); } this.PopulateOutArguments(reflectionCachedData); } }
internal void SetObjectFromSoapData(SerializationInfo info) { Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable)); ArrayList arrayList = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList)); SoapFault soapFault = (SoapFault)info.GetValue("__fault", typeof(SoapFault)); if (soapFault != null) { ServerFault serverFault = soapFault.Detail as ServerFault; if (serverFault != null) { if (serverFault.Exception != null) { this.fault = serverFault.Exception; } else { Type type = Type.GetType(serverFault.ExceptionType, false, false); if (type == (Type)null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("\nException Type: "); stringBuilder.Append(serverFault.ExceptionType); stringBuilder.Append("\n"); stringBuilder.Append("Exception Message: "); stringBuilder.Append(serverFault.ExceptionMessage); stringBuilder.Append("\n"); stringBuilder.Append(serverFault.StackTrace); this.fault = (Exception) new ServerException(stringBuilder.ToString()); } else { object[] args = new object[1] { (object)serverFault.ExceptionMessage }; this.fault = (Exception)Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, (Binder)null, args, (CultureInfo)null, (object[])null); } } } else if (soapFault.Detail != null && soapFault.Detail.GetType() == typeof(string) && ((string)soapFault.Detail).Length != 0) { this.fault = (Exception) new ServerException((string)soapFault.Detail); } else { this.fault = (Exception) new ServerException(soapFault.FaultString); } } else { MethodInfo methodInfo = this.MI as MethodInfo; int num = 0; if (methodInfo != (MethodInfo)null) { Type returnType = methodInfo.ReturnType; if (returnType != typeof(void)) { ++num; object obj = info.GetValue((string)arrayList[0], typeof(object)); this.retVal = !(obj is string) ? obj : Message.SoapCoerceArg(obj, returnType, keyToNamespaceTable); } } ParameterInfo[] parameters = this._methodCache.Parameters; object obj1 = this.InternalProperties == null ? (object)null : this.InternalProperties[(object)"__UnorderedParams"]; if (obj1 != null && obj1 is bool && (bool)obj1) { for (int index1 = num; index1 < arrayList.Count; ++index1) { string name = (string)arrayList[index1]; int index2 = -1; for (int index3 = 0; index3 < parameters.Length; ++index3) { if (name.Equals(parameters[index3].Name)) { index2 = parameters[index3].Position; } } if (index2 == -1) { if (!name.StartsWith("__param", StringComparison.Ordinal)) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } index2 = int.Parse(name.Substring(7), (IFormatProvider)CultureInfo.InvariantCulture); } if (index2 >= this.argCount) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } if (this.outArgs == null) { this.outArgs = new object[this.argCount]; } this.outArgs[index2] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[index2].ParameterType, keyToNamespaceTable); } } else { if (this.argMapper == null) { this.argMapper = new ArgMapper((IMethodMessage)this, true); } for (int index1 = num; index1 < arrayList.Count; ++index1) { string name = (string)arrayList[index1]; if (this.outArgs == null) { this.outArgs = new object[this.argCount]; } int index2 = this.argMapper.Map[index1 - num]; this.outArgs[index2] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[index2].ParameterType, keyToNamespaceTable); } } } }
// Token: 0x06005A89 RID: 23177 RVA: 0x0013CEA8 File Offset: 0x0013B0A8 internal void SetObjectFromSoapData(SerializationInfo info) { Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable)); ArrayList arrayList = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList)); SoapFault soapFault = (SoapFault)info.GetValue("__fault", typeof(SoapFault)); if (soapFault != null) { ServerFault serverFault = soapFault.Detail as ServerFault; if (serverFault != null) { if (serverFault.Exception != null) { this.fault = serverFault.Exception; return; } Type type = Type.GetType(serverFault.ExceptionType, false, false); if (type == null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("\nException Type: "); stringBuilder.Append(serverFault.ExceptionType); stringBuilder.Append("\n"); stringBuilder.Append("Exception Message: "); stringBuilder.Append(serverFault.ExceptionMessage); stringBuilder.Append("\n"); stringBuilder.Append(serverFault.StackTrace); this.fault = new ServerException(stringBuilder.ToString()); return; } object[] args = new object[] { serverFault.ExceptionMessage }; this.fault = (Exception)Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, args, null, null); return; } else { if (soapFault.Detail != null && soapFault.Detail.GetType() == typeof(string) && ((string)soapFault.Detail).Length != 0) { this.fault = new ServerException((string)soapFault.Detail); return; } this.fault = new ServerException(soapFault.FaultString); return; } } else { MethodInfo methodInfo = this.MI as MethodInfo; int num = 0; if (methodInfo != null) { Type returnType = methodInfo.ReturnType; if (returnType != typeof(void)) { num++; object value = info.GetValue((string)arrayList[0], typeof(object)); if (value is string) { this.retVal = Message.SoapCoerceArg(value, returnType, keyToNamespaceTable); } else { this.retVal = value; } } } ParameterInfo[] parameters = this._methodCache.Parameters; object obj = (this.InternalProperties == null) ? null : this.InternalProperties["__UnorderedParams"]; if (obj != null && obj is bool && (bool)obj) { for (int i = num; i < arrayList.Count; i++) { string text = (string)arrayList[i]; int num2 = -1; for (int j = 0; j < parameters.Length; j++) { if (text.Equals(parameters[j].Name)) { num2 = parameters[j].Position; } } if (num2 == -1) { if (!text.StartsWith("__param", StringComparison.Ordinal)) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } num2 = int.Parse(text.Substring(7), CultureInfo.InvariantCulture); } if (num2 >= this.argCount) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } if (this.outArgs == null) { this.outArgs = new object[this.argCount]; } this.outArgs[num2] = Message.SoapCoerceArg(info.GetValue(text, typeof(object)), parameters[num2].ParameterType, keyToNamespaceTable); } return; } if (this.argMapper == null) { this.argMapper = new ArgMapper(this, true); } for (int k = num; k < arrayList.Count; k++) { string name = (string)arrayList[k]; if (this.outArgs == null) { this.outArgs = new object[this.argCount]; } int num3 = this.argMapper.Map[k - num]; this.outArgs[num3] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[num3].ParameterType, keyToNamespaceTable); } return; } }
internal void SetObjectFromSoapData(SerializationInfo info) { this.methodName = info.GetString("__methodName"); ArrayList arrayList = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList)); Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable)); if (this.MI == null) { ArrayList arrayList2 = new ArrayList(); ArrayList arrayList3 = arrayList; for (int i = 0; i < arrayList3.Count; i++) { arrayList2.Add(info.GetValue((string)arrayList3[i], typeof(object))); } RuntimeType runtimeType = this.ResolveType() as RuntimeType; if (runtimeType == null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"), this.typeName)); } this.ResolveOverloadedMethod(runtimeType, this.methodName, arrayList3, arrayList2); if (this.MI == null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), this.methodName, this.typeName)); } } RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(this.MI); ParameterInfo[] parameters = reflectionCachedData.Parameters; int[] marshalRequestArgMap = reflectionCachedData.MarshalRequestArgMap; object obj = (this.InternalProperties == null) ? null : this.InternalProperties["__UnorderedParams"]; this.args = new object[parameters.Length]; if (obj != null && obj is bool && (bool)obj) { for (int j = 0; j < arrayList.Count; j++) { string text = (string)arrayList[j]; int num = -1; for (int k = 0; k < parameters.Length; k++) { if (text.Equals(parameters[k].Name)) { num = parameters[k].Position; break; } } if (num == -1) { if (!text.StartsWith("__param", StringComparison.Ordinal)) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } num = int.Parse(text.Substring(7), CultureInfo.InvariantCulture); } if (num >= this.args.Length) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } this.args[num] = Message.SoapCoerceArg(info.GetValue(text, typeof(object)), parameters[num].ParameterType, keyToNamespaceTable); } return; } for (int l = 0; l < arrayList.Count; l++) { string name = (string)arrayList[l]; this.args[marshalRequestArgMap[l]] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[marshalRequestArgMap[l]].ParameterType, keyToNamespaceTable); } this.PopulateOutArguments(reflectionCachedData); }
internal void SetObjectFromSoapData(SerializationInfo info) { this.methodName = info.GetString("__methodName"); ArrayList arrayList = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList)); Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable)); if (this.MI == (MethodBase)null) { ArrayList argValues = new ArrayList(); ArrayList argNames = arrayList; for (int index = 0; index < argNames.Count; ++index) { argValues.Add(info.GetValue((string)argNames[index], typeof(object))); } RuntimeType t = this.ResolveType() as RuntimeType; if (t == (RuntimeType)null) { throw new RemotingException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"), (object)this.typeName)); } this.ResolveOverloadedMethod(t, this.methodName, argNames, argValues); if (this.MI == (MethodBase)null) { throw new RemotingException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), (object)this.methodName, (object)this.typeName)); } } RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(this.MI); ParameterInfo[] parameters = reflectionCachedData.Parameters; int[] marshalRequestArgMap = reflectionCachedData.MarshalRequestArgMap; object obj = this.InternalProperties == null ? (object)null : this.InternalProperties[(object)"__UnorderedParams"]; this.args = new object[parameters.Length]; if (obj != null && obj is bool && (bool)obj) { for (int index1 = 0; index1 < arrayList.Count; ++index1) { string name = (string)arrayList[index1]; int index2 = -1; for (int index3 = 0; index3 < parameters.Length; ++index3) { if (name.Equals(parameters[index3].Name)) { index2 = parameters[index3].Position; break; } } if (index2 == -1) { if (!name.StartsWith("__param", StringComparison.Ordinal)) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } index2 = int.Parse(name.Substring(7), (IFormatProvider)CultureInfo.InvariantCulture); } if (index2 >= this.args.Length) { throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization")); } this.args[index2] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[index2].ParameterType, keyToNamespaceTable); } } else { for (int index = 0; index < arrayList.Count; ++index) { string name = (string)arrayList[index]; this.args[marshalRequestArgMap[index]] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[marshalRequestArgMap[index]].ParameterType, keyToNamespaceTable); } this.PopulateOutArguments(reflectionCachedData); } }