Beispiel #1
0
        public static ArrayValue Instantiate(TypeManager typeManager, Type fullType, PainlessBinaryReader reader)
        {
            int   arrayLength = reader.ReadInt32();
            IList array       = (IList)Activator.CreateInstance(fullType, arrayLength);

            return(new ArrayValue(fullType, array, arrayLength));
        }
Beispiel #2
0
        public static ListValue Instantiate(TypeManager typeManager, Type fullType, PainlessBinaryReader reader)
        {
            int   listLength = reader.ReadInt32();
            IList list       = (IList)Activator.CreateInstance(fullType, listLength);

            return(new ListValue(fullType, list, listLength));
        }
        public Type Read(PainlessBinaryReader reader)
        {
            Type elementType = reader.ReadNextType();
            int  rank        = reader.ReadInt32();

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

            return(elementType.MakeArrayType(rank));
        }
        public void Read(PainlessBinaryReader reader)
        {
            reader.PushCompoundingHash();

            foreach (SerializedMember member in _members)
            {
                object memberValue = reader.ReadPainlessBinaryObject(member.Type);
                member.SetValue(Value, memberValue);
            }

            int computedHash = reader.PopCompoundingHash();
            int readHash     = reader.ReadInt32();

            if (computedHash != readHash)
            {
                throw new DataIntegrityQuestionableException(computedHash, readHash);
            }
        }