static private ToCode ( |
||
type | ||
리턴 | InternalPrimitiveTypeE |
internal InternalPrimitiveTypeE ToCode(Type type) { if (object.ReferenceEquals(this.previousType, type)) { return(this.previousCode); } InternalPrimitiveTypeE ee = Converter.ToCode(type); if (ee != InternalPrimitiveTypeE.Invalid) { this.previousType = type; this.previousCode = ee; } return(ee); }
internal InternalPrimitiveTypeE ToCode(Type type) { if (this.previousType == type) { return(this.previousCode); } InternalPrimitiveTypeE code = Converter.ToCode(type); if (code != InternalPrimitiveTypeE.Invalid) { this.previousType = type; this.previousCode = code; } return(code); }
// Token: 0x06005387 RID: 21383 RVA: 0x0012798C File Offset: 0x00125B8C internal InternalPrimitiveTypeE ToCode(Type type) { if (this.previousType == type) { return(this.previousCode); } InternalPrimitiveTypeE internalPrimitiveTypeE = Converter.ToCode(type); if (internalPrimitiveTypeE != InternalPrimitiveTypeE.Invalid) { this.previousType = type; this.previousCode = internalPrimitiveTypeE; } return(internalPrimitiveTypeE); }
// Token: 0x06005296 RID: 21142 RVA: 0x00121FEC File Offset: 0x001201EC internal static BinaryTypeEnum GetParserBinaryTypeInfo(Type type, out object typeInformation) { typeInformation = null; BinaryTypeEnum result; if (type == Converter.typeofString) { result = BinaryTypeEnum.String; } else if (type == Converter.typeofObject) { result = BinaryTypeEnum.Object; } else if (type == Converter.typeofObjectArray) { result = BinaryTypeEnum.ObjectArray; } else if (type == Converter.typeofStringArray) { result = BinaryTypeEnum.StringArray; } else if (Converter.IsPrimitiveArray(type, out typeInformation)) { result = BinaryTypeEnum.PrimitiveArray; } else { InternalPrimitiveTypeE internalPrimitiveTypeE = Converter.ToCode(type); if (internalPrimitiveTypeE == InternalPrimitiveTypeE.Invalid) { if (Assembly.GetAssembly(type) == Converter.urtAssembly) { result = BinaryTypeEnum.ObjectUrt; } else { result = BinaryTypeEnum.ObjectUser; } typeInformation = type.FullName; } else { result = BinaryTypeEnum.Primitive; typeInformation = internalPrimitiveTypeE; } } return(result); }
// Used for non Si types when Parsing internal static BinaryTypeEnum GetParserBinaryTypeInfo(Type type, out object?typeInformation) { BinaryTypeEnum binaryTypeEnum; typeInformation = null; if (ReferenceEquals(type, Converter.s_typeofString)) { binaryTypeEnum = BinaryTypeEnum.String; } else if (ReferenceEquals(type, Converter.s_typeofObject)) { binaryTypeEnum = BinaryTypeEnum.Object; } else if (ReferenceEquals(type, Converter.s_typeofObjectArray)) { binaryTypeEnum = BinaryTypeEnum.ObjectArray; } else if (ReferenceEquals(type, Converter.s_typeofStringArray)) { binaryTypeEnum = BinaryTypeEnum.StringArray; } else if (Converter.IsPrimitiveArray(type, out typeInformation)) { binaryTypeEnum = BinaryTypeEnum.PrimitiveArray; } else { InternalPrimitiveTypeE primitiveTypeEnum = Converter.ToCode(type); switch (primitiveTypeEnum) { case InternalPrimitiveTypeE.Invalid: binaryTypeEnum = type.Assembly == Converter.s_urtAssembly ? BinaryTypeEnum.ObjectUrt : BinaryTypeEnum.ObjectUser; typeInformation = type.FullName; break; default: binaryTypeEnum = BinaryTypeEnum.Primitive; typeInformation = primitiveTypeEnum; break; } } return(binaryTypeEnum); }
internal InternalPrimitiveTypeE ToCode(Type type) { if (ReferenceEquals(_previousType, type)) { return(_previousCode); } else { InternalPrimitiveTypeE code = Converter.ToCode(type); if (code != InternalPrimitiveTypeE.Invalid) { _previousType = type; _previousCode = code; } return(code); } }
// Token: 0x0600529C RID: 21148 RVA: 0x0012229C File Offset: 0x0012049C internal static void WriteWithCode(Type type, object value, __BinaryWriter sout) { if (type == null) { sout.WriteByte(17); return; } if (type == Converter.typeofString) { IOUtil.WriteStringWithCode((string)value, sout); return; } InternalPrimitiveTypeE internalPrimitiveTypeE = Converter.ToCode(type); sout.WriteByte((byte)internalPrimitiveTypeE); sout.WriteValue(internalPrimitiveTypeE, value); }
internal static void WriteWithCode(Type type, object value, __BinaryWriter sout) { if (type == null) { sout.WriteByte(0x11); } else if (object.ReferenceEquals(type, Converter.typeofString)) { WriteStringWithCode((string)value, sout); } else { InternalPrimitiveTypeE code = Converter.ToCode(type); sout.WriteByte((byte)code); sout.WriteValue(code, value); } }
internal static BinaryTypeEnum GetParserBinaryTypeInfo(Type type, out object typeInformation) { BinaryTypeEnum primitive; typeInformation = null; if (object.ReferenceEquals(type, Converter.typeofString)) { return(BinaryTypeEnum.String); } if (object.ReferenceEquals(type, Converter.typeofObject)) { return(BinaryTypeEnum.Object); } if (object.ReferenceEquals(type, Converter.typeofObjectArray)) { return(BinaryTypeEnum.ObjectArray); } if (object.ReferenceEquals(type, Converter.typeofStringArray)) { return(BinaryTypeEnum.StringArray); } if (Converter.IsPrimitiveArray(type, out typeInformation)) { return(BinaryTypeEnum.PrimitiveArray); } InternalPrimitiveTypeE ee = Converter.ToCode(type); switch (ee) { case InternalPrimitiveTypeE.Invalid: if (Assembly.GetAssembly(type) == Converter.urtAssembly) { primitive = BinaryTypeEnum.ObjectUrt; } else { primitive = BinaryTypeEnum.ObjectUser; } typeInformation = type.FullName; return(primitive); } primitive = BinaryTypeEnum.Primitive; typeInformation = ee; return(primitive); }
internal static BinaryTypeEnum GetParserBinaryTypeInfo(Type type, out object typeInformation) { typeInformation = (object)null; BinaryTypeEnum binaryTypeEnum; if (type == Converter.typeofString) { binaryTypeEnum = BinaryTypeEnum.String; } else if (type == Converter.typeofObject) { binaryTypeEnum = BinaryTypeEnum.Object; } else if (type == Converter.typeofObjectArray) { binaryTypeEnum = BinaryTypeEnum.ObjectArray; } else if (type == Converter.typeofStringArray) { binaryTypeEnum = BinaryTypeEnum.StringArray; } else if (Converter.IsPrimitiveArray(type, out typeInformation)) { binaryTypeEnum = BinaryTypeEnum.PrimitiveArray; } else { InternalPrimitiveTypeE code = Converter.ToCode(type); if (code == InternalPrimitiveTypeE.Invalid) { binaryTypeEnum = !(Assembly.GetAssembly(type) == Converter.urtAssembly) ? BinaryTypeEnum.ObjectUser : BinaryTypeEnum.ObjectUrt; typeInformation = (object)type.FullName; } else { binaryTypeEnum = BinaryTypeEnum.Primitive; typeInformation = (object)code; } } return(binaryTypeEnum); }
// Token: 0x060052C7 RID: 21191 RVA: 0x00122BFC File Offset: 0x00120DFC internal object[] WriteArray(object returnValue, object[] args, Exception exception, object callContext, object[] properties) { this.returnValue = returnValue; this.args = args; this.exception = exception; this.callContext = callContext; this.properties = properties; int num = 0; if (args == null || args.Length == 0) { this.messageEnum = MessageEnum.NoArgs; } else { this.argTypes = new Type[args.Length]; this.bArgsPrimitive = true; for (int i = 0; i < args.Length; i++) { if (args[i] != null) { this.argTypes[i] = args[i].GetType(); if (Converter.ToCode(this.argTypes[i]) <= InternalPrimitiveTypeE.Invalid && this.argTypes[i] != Converter.typeofString) { this.bArgsPrimitive = false; break; } } } if (this.bArgsPrimitive) { this.messageEnum = MessageEnum.ArgsInline; } else { num++; this.messageEnum = MessageEnum.ArgsInArray; } } if (returnValue == null) { this.messageEnum |= MessageEnum.NoReturnValue; } else if (returnValue.GetType() == typeof(void)) { this.messageEnum |= MessageEnum.ReturnValueVoid; } else { this.returnType = returnValue.GetType(); if (Converter.ToCode(this.returnType) > InternalPrimitiveTypeE.Invalid || this.returnType == Converter.typeofString) { this.messageEnum |= MessageEnum.ReturnValueInline; } else { num++; this.messageEnum |= MessageEnum.ReturnValueInArray; } } if (exception != null) { num++; this.messageEnum |= MessageEnum.ExceptionInArray; } if (callContext == null) { this.messageEnum |= MessageEnum.NoContext; } else if (callContext is string) { this.messageEnum |= MessageEnum.ContextInline; } else { num++; this.messageEnum |= MessageEnum.ContextInArray; } if (properties != null) { num++; this.messageEnum |= MessageEnum.PropertyInArray; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray) && num == 1) { this.messageEnum ^= MessageEnum.ArgsInArray; this.messageEnum |= MessageEnum.ArgsIsArray; return(args); } if (num > 0) { int num2 = 0; this.callA = new object[num]; if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray)) { this.callA[num2++] = args; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInArray)) { this.callA[num2++] = returnValue; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ExceptionInArray)) { this.callA[num2++] = exception; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInArray)) { this.callA[num2++] = callContext; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.PropertyInArray)) { this.callA[num2] = properties; } return(this.callA); } return(null); }
// Token: 0x060052BE RID: 21182 RVA: 0x00122664 File Offset: 0x00120864 internal object[] WriteArray(string uri, string methodName, string typeName, Type[] instArgs, object[] args, object methodSignature, object callContext, object[] properties) { this.uri = uri; this.methodName = methodName; this.typeName = typeName; this.instArgs = instArgs; this.args = args; this.methodSignature = methodSignature; this.callContext = callContext; this.properties = properties; int num = 0; if (args == null || args.Length == 0) { this.messageEnum = MessageEnum.NoArgs; } else { this.argTypes = new Type[args.Length]; this.bArgsPrimitive = true; for (int i = 0; i < args.Length; i++) { if (args[i] != null) { this.argTypes[i] = args[i].GetType(); if ((Converter.ToCode(this.argTypes[i]) <= InternalPrimitiveTypeE.Invalid && this.argTypes[i] != Converter.typeofString) || args[i] is ISerializable) { this.bArgsPrimitive = false; break; } } } if (this.bArgsPrimitive) { this.messageEnum = MessageEnum.ArgsInline; } else { num++; this.messageEnum = MessageEnum.ArgsInArray; } } if (instArgs != null) { num++; this.messageEnum |= MessageEnum.GenericMethod; } if (methodSignature != null) { num++; this.messageEnum |= MessageEnum.MethodSignatureInArray; } if (callContext == null) { this.messageEnum |= MessageEnum.NoContext; } else if (callContext is string) { this.messageEnum |= MessageEnum.ContextInline; } else { num++; this.messageEnum |= MessageEnum.ContextInArray; } if (properties != null) { num++; this.messageEnum |= MessageEnum.PropertyInArray; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray) && num == 1) { this.messageEnum ^= MessageEnum.ArgsInArray; this.messageEnum |= MessageEnum.ArgsIsArray; return(args); } if (num > 0) { int num2 = 0; this.callA = new object[num]; if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray)) { this.callA[num2++] = args; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.GenericMethod)) { this.callA[num2++] = instArgs; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.MethodSignatureInArray)) { this.callA[num2++] = methodSignature; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInArray)) { this.callA[num2++] = callContext; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.PropertyInArray)) { this.callA[num2] = properties; } return(this.callA); } return(null); }
private void ParseMember(ParseRecord pr) { ParseRecord parentPr = (ParseRecord)this.stack.Peek(); if (parentPr != null) { string pRname = parentPr.PRname; } switch (pr.PRmemberTypeEnum) { case InternalMemberTypeE.Item: this.ParseArrayMember(pr); return; } if ((pr.PRdtType == null) && parentPr.PRobjectInfo.isTyped) { pr.PRdtType = parentPr.PRobjectInfo.GetType(pr.PRname); if (pr.PRdtType != null) { pr.PRdtTypeCode = Converter.ToCode(pr.PRdtType); } } if (pr.PRmemberValueEnum == InternalMemberValueE.Null) { parentPr.PRobjectInfo.AddValue(pr.PRname, null, ref parentPr.PRsi, ref parentPr.PRmemberData); } else if (pr.PRmemberValueEnum == InternalMemberValueE.Nested) { this.ParseObject(pr); this.stack.Push(pr); if (((pr.PRobjectInfo != null) && (pr.PRobjectInfo.objectType != null)) && pr.PRobjectInfo.objectType.IsValueType) { pr.PRisValueTypeFixup = true; this.ValueFixupStack.Push(new ValueFixup(parentPr.PRnewObj, pr.PRname, parentPr.PRobjectInfo)); } else { parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRnewObj, ref parentPr.PRsi, ref parentPr.PRmemberData); } } else if (pr.PRmemberValueEnum == InternalMemberValueE.Reference) { object obj2 = this.m_objectManager.GetObject(pr.PRidRef); if (obj2 == null) { parentPr.PRobjectInfo.AddValue(pr.PRname, null, ref parentPr.PRsi, ref parentPr.PRmemberData); parentPr.PRobjectInfo.RecordFixup(parentPr.PRobjectId, pr.PRname, pr.PRidRef); } else { parentPr.PRobjectInfo.AddValue(pr.PRname, obj2, ref parentPr.PRsi, ref parentPr.PRmemberData); } } else if (pr.PRmemberValueEnum == InternalMemberValueE.InlineValue) { if (object.ReferenceEquals(pr.PRdtType, Converter.typeofString)) { this.ParseString(pr, parentPr); parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvalue, ref parentPr.PRsi, ref parentPr.PRmemberData); } else if (pr.PRdtTypeCode != InternalPrimitiveTypeE.Invalid) { object pRvarValue = null; if (pr.PRvarValue != null) { pRvarValue = pr.PRvarValue; } else { pRvarValue = Converter.FromString(pr.PRvalue, pr.PRdtTypeCode); } parentPr.PRobjectInfo.AddValue(pr.PRname, pRvarValue, ref parentPr.PRsi, ref parentPr.PRmemberData); } else if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64) { parentPr.PRobjectInfo.AddValue(pr.PRname, Convert.FromBase64String(pr.PRvalue), ref parentPr.PRsi, ref parentPr.PRmemberData); } else { if (object.ReferenceEquals(pr.PRdtType, Converter.typeofObject)) { throw new SerializationException(Environment.GetResourceString("Serialization_TypeMissing", new object[] { pr.PRname })); } this.ParseString(pr, parentPr); if (object.ReferenceEquals(pr.PRdtType, Converter.typeofSystemVoid)) { parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRdtType, ref parentPr.PRsi, ref parentPr.PRmemberData); } else if (parentPr.PRobjectInfo.isSi) { parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvalue, ref parentPr.PRsi, ref parentPr.PRmemberData); } } } else { this.ParseError(pr, parentPr); } }
internal object[] WriteArray(object returnValue, object[] args, Exception exception, object callContext, object[] properties) { this.returnValue = returnValue; this.args = args; this.exception = exception; this.callContext = callContext; this.properties = (object)properties; int length = 0; if (args == null || args.Length == 0) { this.messageEnum = MessageEnum.NoArgs; } else { this.argTypes = new Type[args.Length]; this.bArgsPrimitive = true; for (int index = 0; index < args.Length; ++index) { if (args[index] != null) { this.argTypes[index] = args[index].GetType(); if ((uint)Converter.ToCode(this.argTypes[index]) <= 0U && this.argTypes[index] != Converter.typeofString) { this.bArgsPrimitive = false; break; } } } if (this.bArgsPrimitive) { this.messageEnum = MessageEnum.ArgsInline; } else { ++length; this.messageEnum = MessageEnum.ArgsInArray; } } if (returnValue == null) { this.messageEnum = this.messageEnum | MessageEnum.NoReturnValue; } else if (returnValue.GetType() == typeof(void)) { this.messageEnum = this.messageEnum | MessageEnum.ReturnValueVoid; } else { this.returnType = returnValue.GetType(); if ((uint)Converter.ToCode(this.returnType) > 0U || this.returnType == Converter.typeofString) { this.messageEnum = this.messageEnum | MessageEnum.ReturnValueInline; } else { ++length; this.messageEnum = this.messageEnum | MessageEnum.ReturnValueInArray; } } if (exception != null) { ++length; this.messageEnum = this.messageEnum | MessageEnum.ExceptionInArray; } if (callContext == null) { this.messageEnum = this.messageEnum | MessageEnum.NoContext; } else if (callContext is string) { this.messageEnum = this.messageEnum | MessageEnum.ContextInline; } else { ++length; this.messageEnum = this.messageEnum | MessageEnum.ContextInArray; } if (properties != null) { ++length; this.messageEnum = this.messageEnum | MessageEnum.PropertyInArray; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray) && length == 1) { this.messageEnum = this.messageEnum ^ MessageEnum.ArgsInArray; this.messageEnum = this.messageEnum | MessageEnum.ArgsIsArray; return(args); } if (length <= 0) { return((object[])null); } int index1 = 0; this.callA = new object[length]; if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray)) { this.callA[index1++] = (object)args; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInArray)) { this.callA[index1++] = returnValue; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ExceptionInArray)) { this.callA[index1++] = (object)exception; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInArray)) { this.callA[index1++] = callContext; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.PropertyInArray)) { this.callA[index1] = (object)properties; } return(this.callA); }
private void ParseMember(ParseRecord pr) { ParseRecord parseRecord = (ParseRecord)this.stack.Peek(); if (parseRecord != null) { string str = parseRecord.PRname; } switch (pr.PRmemberTypeEnum) { case InternalMemberTypeE.Item: this.ParseArrayMember(pr); break; default: if (pr.PRdtType == null && parseRecord.PRobjectInfo.isTyped) { pr.PRdtType = parseRecord.PRobjectInfo.GetType(pr.PRname); if (pr.PRdtType != null) { pr.PRdtTypeCode = Converter.ToCode(pr.PRdtType); } } if (pr.PRmemberValueEnum == InternalMemberValueE.Null) { parseRecord.PRobjectInfo.AddValue(pr.PRname, (object)null, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } if (pr.PRmemberValueEnum == InternalMemberValueE.Nested) { this.ParseObject(pr); this.stack.Push((object)pr); if (pr.PRobjectInfo != null && pr.PRobjectInfo.objectType != null && pr.PRobjectInfo.objectType.IsValueType) { pr.PRisValueTypeFixup = true; this.ValueFixupStack.Push((object)new ValueFixup(parseRecord.PRnewObj, pr.PRname, parseRecord.PRobjectInfo)); break; } parseRecord.PRobjectInfo.AddValue(pr.PRname, pr.PRnewObj, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } if (pr.PRmemberValueEnum == InternalMemberValueE.Reference) { object @object = this.m_objectManager.GetObject(pr.PRidRef); if (@object == null) { parseRecord.PRobjectInfo.AddValue(pr.PRname, (object)null, ref parseRecord.PRsi, ref parseRecord.PRmemberData); parseRecord.PRobjectInfo.RecordFixup(parseRecord.PRobjectId, pr.PRname, pr.PRidRef); break; } parseRecord.PRobjectInfo.AddValue(pr.PRname, @object, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } if (pr.PRmemberValueEnum == InternalMemberValueE.InlineValue) { if (pr.PRdtType == Converter.typeofString) { this.ParseString(pr, parseRecord); parseRecord.PRobjectInfo.AddValue(pr.PRname, (object)pr.PRvalue, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } if (pr.PRdtTypeCode == InternalPrimitiveTypeE.Invalid) { if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64) { parseRecord.PRobjectInfo.AddValue(pr.PRname, (object)Convert.FromBase64String(pr.PRvalue), ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } if (pr.PRdtType == Converter.typeofObject) { throw new SerializationException(Environment.GetResourceString("Serialization_TypeMissing", (object)pr.PRname)); } this.ParseString(pr, parseRecord); if (pr.PRdtType == Converter.typeofSystemVoid) { parseRecord.PRobjectInfo.AddValue(pr.PRname, (object)pr.PRdtType, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } if (!parseRecord.PRobjectInfo.isSi) { break; } parseRecord.PRobjectInfo.AddValue(pr.PRname, (object)pr.PRvalue, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } object obj = pr.PRvarValue == null?Converter.FromString(pr.PRvalue, pr.PRdtTypeCode) : pr.PRvarValue; parseRecord.PRobjectInfo.AddValue(pr.PRname, obj, ref parseRecord.PRsi, ref parseRecord.PRmemberData); break; } this.ParseError(pr, parseRecord); break; } }
private void ParseMember(ParseRecord pr) { Debug.Assert(_stack != null); ParseRecord?objectPr = (ParseRecord?)_stack.Peek(); switch (pr._memberTypeEnum) { case InternalMemberTypeE.Item: ParseArrayMember(pr); return; case InternalMemberTypeE.Field: break; } Debug.Assert(objectPr != null && objectPr._objectInfo != null && pr._name != null); //if ((pr.PRdtType == null) && !objectPr.PRobjectInfo.isSi) if (pr._dtType == null && objectPr._objectInfo._isTyped) { pr._dtType = objectPr._objectInfo.GetType(pr._name); if (pr._dtType != null) { pr._dtTypeCode = Converter.ToCode(pr._dtType); } } if (pr._memberValueEnum == InternalMemberValueE.Null) { // Value is Null objectPr._objectInfo.AddValue(pr._name, null, ref objectPr._si, ref objectPr._memberData); } else if (pr._memberValueEnum == InternalMemberValueE.Nested) { ParseObject(pr); _stack.Push(pr); if ((pr._objectInfo != null) && pr._objectInfo._objectType != null && (pr._objectInfo._objectType.IsValueType)) { pr._isValueTypeFixup = true; //Valuefixup ValueFixupStack.Push(new ValueFixup(objectPr._newObj, pr._name, objectPr._objectInfo)); //valuefixup } else { objectPr._objectInfo.AddValue(pr._name, pr._newObj, ref objectPr._si, ref objectPr._memberData); } } else if (pr._memberValueEnum == InternalMemberValueE.Reference) { Debug.Assert(_objectManager != null); // See if object has already been instantiated object?refObj = _objectManager.GetObject(pr._idRef); if (refObj == null) { objectPr._objectInfo.AddValue(pr._name, null, ref objectPr._si, ref objectPr._memberData); objectPr._objectInfo.RecordFixup(objectPr._objectId, pr._name, pr._idRef); // Object not instantiated } else { objectPr._objectInfo.AddValue(pr._name, refObj, ref objectPr._si, ref objectPr._memberData); } } else if (pr._memberValueEnum == InternalMemberValueE.InlineValue) { // Primitive type or String if (ReferenceEquals(pr._dtType, Converter.s_typeofString)) { ParseString(pr, objectPr); objectPr._objectInfo.AddValue(pr._name, pr._value, ref objectPr._si, ref objectPr._memberData); } else if (pr._dtTypeCode == InternalPrimitiveTypeE.Invalid) { // The member field was an object put the value is Inline either bin.Base64 or invalid if (pr._arrayTypeEnum == InternalArrayTypeE.Base64) { Debug.Assert(pr._value != null); objectPr._objectInfo.AddValue(pr._name, Convert.FromBase64String(pr._value), ref objectPr._si, ref objectPr._memberData); } else if (ReferenceEquals(pr._dtType, Converter.s_typeofObject)) { throw new SerializationException(SR.Format(SR.Serialization_TypeMissing, pr._name)); } else { ParseString(pr, objectPr); // Register the object if it has an objectId // Object Class with no memberInfo data // only special case where AddValue is needed? if (ReferenceEquals(pr._dtType, Converter.s_typeofSystemVoid)) { objectPr._objectInfo.AddValue(pr._name, pr._dtType, ref objectPr._si, ref objectPr._memberData); } else if (objectPr._objectInfo._isSi) { // ISerializable are added as strings, the conversion to type is done by the // ISerializable object objectPr._objectInfo.AddValue(pr._name, pr._value, ref objectPr._si, ref objectPr._memberData); } } } else { object?var = pr._varValue ?? Converter.FromString(pr._value, pr._dtTypeCode); objectPr._objectInfo.AddValue(pr._name, var, ref objectPr._si, ref objectPr._memberData); } } else { ParseError(pr, objectPr); } }
internal object[] WriteArray(string uri, string methodName, string typeName, Type[] instArgs, object[] args, object methodSignature, object callContext, object[] properties) { this.uri = uri; this.methodName = methodName; this.typeName = typeName; this.instArgs = instArgs; this.args = args; this.methodSignature = methodSignature; this.callContext = callContext; this.properties = (object)properties; int length = 0; if (args == null || args.Length == 0) { this.messageEnum = MessageEnum.NoArgs; } else { this.argTypes = new Type[args.Length]; this.bArgsPrimitive = true; for (int index = 0; index < args.Length; ++index) { if (args[index] != null) { this.argTypes[index] = args[index].GetType(); if ((uint)Converter.ToCode(this.argTypes[index]) <= 0U && this.argTypes[index] != Converter.typeofString || args[index] is ISerializable) { this.bArgsPrimitive = false; break; } } } if (this.bArgsPrimitive) { this.messageEnum = MessageEnum.ArgsInline; } else { ++length; this.messageEnum = MessageEnum.ArgsInArray; } } if (instArgs != null) { ++length; this.messageEnum = this.messageEnum | MessageEnum.GenericMethod; } if (methodSignature != null) { ++length; this.messageEnum = this.messageEnum | MessageEnum.MethodSignatureInArray; } if (callContext == null) { this.messageEnum = this.messageEnum | MessageEnum.NoContext; } else if (callContext is string) { this.messageEnum = this.messageEnum | MessageEnum.ContextInline; } else { ++length; this.messageEnum = this.messageEnum | MessageEnum.ContextInArray; } if (properties != null) { ++length; this.messageEnum = this.messageEnum | MessageEnum.PropertyInArray; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray) && length == 1) { this.messageEnum = this.messageEnum ^ MessageEnum.ArgsInArray; this.messageEnum = this.messageEnum | MessageEnum.ArgsIsArray; return(args); } if (length <= 0) { return((object[])null); } int index1 = 0; this.callA = new object[length]; if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInArray)) { this.callA[index1++] = (object)args; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.GenericMethod)) { this.callA[index1++] = (object)instArgs; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.MethodSignatureInArray)) { this.callA[index1++] = methodSignature; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInArray)) { this.callA[index1++] = callContext; } if (IOUtil.FlagTest(this.messageEnum, MessageEnum.PropertyInArray)) { this.callA[index1] = (object)properties; } return(this.callA); }