コード例 #1
0
ファイル: ArrayValue.cs プロジェクト: ahlec/PainlessBinary
        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));
        }
コード例 #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));
        }
コード例 #3
0
        public Type Read(PainlessBinaryReader reader)
        {
            Type elementType = reader.ReadNextType();
            int  rank        = reader.ReadInt32();

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

            return(elementType.MakeArrayType(rank));
        }
コード例 #4
0
        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);
            }
        }