Type ResolveGenericArguments(PainlessBinaryReader reader, Type baseType, int numGenericParameters)
        {
            Type[] genericArguments = new Type[numGenericParameters];

            for (int index = 0; index < numGenericParameters; ++index)
            {
                genericArguments[index] = reader.ReadNextType();
            }

            return(baseType.MakeGenericType(genericArguments));
        }
        public Type Read(PainlessBinaryReader reader)
        {
            Type elementType = reader.ReadNextType();
            int  rank        = reader.ReadInt32();

            if (rank == 1)
            {
                return(elementType.MakeArrayType());
            }

            return(elementType.MakeArrayType(rank));
        }
Exemple #3
0
        static T DeserializeFilePayload <T>(PainlessBinaryReader reader)
        {
            Type fileType = reader.ReadNextType();

            if (fileType != typeof(T))
            {
                throw new DifferentFileTypeException(typeof(T), fileType);
            }

            object deserializedObject = reader.ReadPainlessBinaryObject(typeof(T));

            return((T)deserializedObject);
        }