public Type GetObjectType(DeserializationContext context) { if (mTag == BinaryTypeTag.PrimitiveType) { return(BinaryValueReader.GetPrimitiveType(mPrimitiveType)); } else if (mTag == BinaryTypeTag.RuntimeType) { return(Type.GetType(mClassName, true)); } else { Assembly assembly = context.GetAssembly(mAssembly); return(assembly.GetType(mClassName, true)); } }
public bool Read(DeserializationContext context, out Object outVal, bool external) { uint id = context.Reader.ReadUInt32(); String name = context.Reader.ReadString(); uint fieldCount = context.Reader.ReadUInt32(); // collect the names of the fields String[] fieldNames = new String[fieldCount]; for (int i = 0; i < fieldCount; i++) { fieldNames[i] = context.Reader.ReadString(); } // collect the type-tags of the fields BinaryTypeTag[] typeTags = new BinaryTypeTag[fieldCount]; for (int i = 0; i < fieldCount; i++) { typeTags[i] = (BinaryTypeTag)context.Reader.ReadByte(); } // collect the type-specifications of the fields if necessary TypeSpecification[] typeSpecs = new TypeSpecification[fieldCount]; for (int i = 0; i < fieldCount; i++) { typeSpecs[i] = ReadTypeSpec(context, typeTags[i]); } // read assembly-id if this is no runtime object Assembly assembly = null; if (external) { assembly = context.GetAssembly(context.Reader.ReadUInt32()); } // store type-information for later usage TypeInfo typeInfo = new TypeInfo(context, name, fieldNames, typeTags, typeSpecs, assembly); context.SetTypeInfo(id, typeInfo); // let our parent read the inlined values return(Read(context, out outVal, id, typeInfo)); }
public Type GetObjectType(DeserializationContext context) { if(mTag == BinaryTypeTag.PrimitiveType) { return BinaryValueReader.GetPrimitiveType(mPrimitiveType); } else if(mTag == BinaryTypeTag.RuntimeType) { return Type.GetType(mClassName, true); } else { Assembly assembly = context.GetAssembly(mAssembly); return assembly.GetType(mClassName, true); } }
public bool Read(DeserializationContext context, out Object outVal, bool external) { uint id = context.Reader.ReadUInt32(); String name = context.Reader.ReadString(); uint fieldCount = context.Reader.ReadUInt32(); // collect the names of the fields String[] fieldNames = new String[fieldCount]; for(int i = 0; i < fieldCount; i++) { fieldNames[i] = context.Reader.ReadString(); } // collect the type-tags of the fields BinaryTypeTag[] typeTags = new BinaryTypeTag[fieldCount]; for(int i = 0; i < fieldCount; i++) { typeTags[i] = (BinaryTypeTag) context.Reader.ReadByte(); } // collect the type-specifications of the fields if necessary TypeSpecification[] typeSpecs = new TypeSpecification[fieldCount]; for(int i = 0; i < fieldCount; i++) { typeSpecs[i] = ReadTypeSpec(context, typeTags[i]); } // read assembly-id if this is no runtime object Assembly assembly = null; if(external) { assembly = context.GetAssembly(context.Reader.ReadUInt32()); } // store type-information for later usage TypeInfo typeInfo = new TypeInfo(context, name, fieldNames, typeTags, typeSpecs, assembly); context.SetTypeInfo(id, typeInfo); // let our parent read the inlined values return Read(context, out outVal, id, typeInfo); }