Example #1
0
        public static bool ReadValue(DeserializationContext context, out Object outVal)
        {
            BinaryElementType element = (BinaryElementType)context.Reader.ReadByte();
            BinaryValueReader reader  = GetReader(element);

            return(reader.Read(context, out outVal));
        }
	public static BinaryValueReader GetReader(BinaryElementType type) 
	{
		switch(type) 
		{
			case BinaryElementType.Header:
				return sHeaderReader;
			case BinaryElementType.RefTypeObject:
				return sRefObjectReader;
			case BinaryElementType.RuntimeObject:
				return sRuntimeObjectReader;
			case BinaryElementType.ExternalObject:
				return sExternalObjectReader;
			case BinaryElementType.String:
				return sStringReader;
			case BinaryElementType.GenericArray:
				return sGenericArrayReader;
			case BinaryElementType.BoxedPrimitiveTypeValue:
				return sBoxedPrimitiveTypeValue;
			case BinaryElementType.ObjectReference:
				return sObjectReferenceReader;
			case BinaryElementType.NullValue:
				return sNullReader;
			case BinaryElementType.End:
				return sEndReader;
			case BinaryElementType.Assembly:
				return sAssemblyReader;
			case BinaryElementType.ArrayFiller8b:
				return sArrayFiller8bReader;
			case BinaryElementType.ArrayFiller32b:
				return sArrayFiller32bReader;
			case BinaryElementType.ArrayOfPrimitiveType:
				return sPrimitiveArrayReader;
			case BinaryElementType.ArrayOfObject:
				return sObjectArrayReader;
			case BinaryElementType.ArrayOfString:
				return sStringArrayReader;
			case BinaryElementType.MethodCall:
				throw new SerializationException("NYI element type:"+type);
			case BinaryElementType.MethodResponse:
				throw new SerializationException("NYI element type:"+type);

			default:
				throw new SerializationException("NYI element type:"+type);
		}
	}
Example #3
0
        public static BinaryValueReader GetReader(BinaryElementType type)
        {
            switch (type)
            {
            case BinaryElementType.Header:
                return(sHeaderReader);

            case BinaryElementType.RefTypeObject:
                return(sRefObjectReader);

            case BinaryElementType.RuntimeObject:
                return(sRuntimeObjectReader);

            case BinaryElementType.ExternalObject:
                return(sExternalObjectReader);

            case BinaryElementType.String:
                return(sStringReader);

            case BinaryElementType.GenericArray:
                return(sGenericArrayReader);

            case BinaryElementType.BoxedPrimitiveTypeValue:
                return(sBoxedPrimitiveTypeValue);

            case BinaryElementType.ObjectReference:
                return(sObjectReferenceReader);

            case BinaryElementType.NullValue:
                return(sNullReader);

            case BinaryElementType.End:
                return(sEndReader);

            case BinaryElementType.Assembly:
                return(sAssemblyReader);

            case BinaryElementType.ArrayFiller8b:
                return(sArrayFiller8bReader);

            case BinaryElementType.ArrayFiller32b:
                return(sArrayFiller32bReader);

            case BinaryElementType.ArrayOfPrimitiveType:
                return(sPrimitiveArrayReader);

            case BinaryElementType.ArrayOfObject:
                return(sObjectArrayReader);

            case BinaryElementType.ArrayOfString:
                return(sStringArrayReader);

            case BinaryElementType.MethodCall:
                throw new SerializationException("NYI element type:" + type);

            case BinaryElementType.MethodResponse:
                throw new SerializationException("NYI element type:" + type);

            default:
                throw new SerializationException("NYI element type:" + type);
            }
        }