示例#1
0
        public void Read(BinaryParser input)
        {
            // binaryHeaderEnum has already been read
            _objectId         = input.ReadInt32();
            _name             = input.ReadString();
            _numMembers       = input.ReadInt32();
            _memberNames      = new string[_numMembers];
            _binaryTypeEnumA  = new BinaryTypeEnum[_numMembers];
            _typeInformationA = new object[_numMembers];
            _memberAssemIds   = new int[_numMembers];
            for (int i = 0; i < _numMembers; i++)
            {
                _memberNames[i] = input.ReadString();
            }
            for (int i = 0; i < _numMembers; i++)
            {
                _binaryTypeEnumA[i] = (BinaryTypeEnum)input.ReadByte();
            }
            for (int i = 0; i < _numMembers; i++)
            {
                if (_binaryTypeEnumA[i] != BinaryTypeEnum.ObjectUrt && _binaryTypeEnumA[i] != BinaryTypeEnum.ObjectUser)
                {
                    _typeInformationA[i] = BinaryTypeConverter.ReadTypeInfo(_binaryTypeEnumA[i], input, out _memberAssemIds[i]);
                }
                else
                {
                    BinaryTypeConverter.ReadTypeInfo(_binaryTypeEnumA[i], input, out _memberAssemIds[i]);
                }
            }

            if (_binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapTypedAssemId)
            {
                _assemId = input.ReadInt32();
            }
        }
示例#2
0
        public void Read(BinaryParser input)
        {
            switch (_binaryHeaderEnum)
            {
            case BinaryHeaderEnum.ArraySinglePrimitive:
                _objectId            = input.ReadInt32();
                _lengthA             = new int[1];
                _lengthA[0]          = input.ReadInt32();
                _binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                _rank            = 1;
                _lowerBoundA     = new int[_rank];
                _binaryTypeEnum  = BinaryTypeEnum.Primitive;
                _typeInformation = (InternalPrimitiveTypeE)input.ReadByte();
                break;

            case BinaryHeaderEnum.ArraySingleString:
                _objectId            = input.ReadInt32();
                _lengthA             = new int[1];
                _lengthA[0]          = input.ReadInt32();
                _binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                _rank            = 1;
                _lowerBoundA     = new int[_rank];
                _binaryTypeEnum  = BinaryTypeEnum.String;
                _typeInformation = null;
                break;

            case BinaryHeaderEnum.ArraySingleObject:
                _objectId            = input.ReadInt32();
                _lengthA             = new int[1];
                _lengthA[0]          = input.ReadInt32();
                _binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                _rank            = 1;
                _lowerBoundA     = new int[_rank];
                _binaryTypeEnum  = BinaryTypeEnum.Object;
                _typeInformation = null;
                break;

            default:
                _objectId            = input.ReadInt32();
                _binaryArrayTypeEnum = (BinaryArrayTypeEnum)input.ReadByte();
                _rank        = input.ReadInt32();
                _lengthA     = new int[_rank];
                _lowerBoundA = new int[_rank];
                for (int i = 0; i < _rank; i++)
                {
                    _lengthA[i] = input.ReadInt32();
                }
                if ((_binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) ||
                    (_binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset) ||
                    (_binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
                {
                    for (int i = 0; i < _rank; i++)
                    {
                        _lowerBoundA[i] = input.ReadInt32();
                    }
                }
                _binaryTypeEnum  = (BinaryTypeEnum)input.ReadByte();
                _typeInformation = BinaryTypeConverter.ReadTypeInfo(_binaryTypeEnum, input, out _assemId);
                break;
            }
        }