public MultiDriverInfo(H5BinaryReader reader) : base(reader)
        {
            // member mapping
            this.MemberMapping1 = (MemberMapping)reader.ReadByte();
            this.MemberMapping2 = (MemberMapping)reader.ReadByte();
            this.MemberMapping3 = (MemberMapping)reader.ReadByte();
            this.MemberMapping4 = (MemberMapping)reader.ReadByte();
            this.MemberMapping5 = (MemberMapping)reader.ReadByte();
            this.MemberMapping6 = (MemberMapping)reader.ReadByte();

            // reserved
            reader.ReadBytes(3);

            // member count
            var memberCount = new MemberMapping[] { this.MemberMapping1, this.MemberMapping2, this.MemberMapping3,
                                                    this.MemberMapping4, this.MemberMapping5, this.MemberMapping6 }.Distinct().Count();

            // member start and end addresses
            this.MemberFileStartAddresses = new List <ulong>(memberCount);
            this.MemberFileEndAddresses   = new List <ulong>(memberCount);

            for (int i = 0; i < memberCount; i++)
            {
                this.MemberFileStartAddresses[i] = reader.ReadUInt64();
                this.MemberFileEndAddresses[i]   = reader.ReadUInt64();
            }

            // member names
            this.MemberNames = new List <string>(memberCount);

            for (int i = 0; i < memberCount; i++)
            {
                this.MemberNames[i] = H5Utils.ReadNullTerminatedString(reader, pad: true);
            }
        }
示例#2
0
        public LinkInfoMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

            // version
            this.Version = reader.ReadByte();

            // flags
            this.Flags = (CreationOrderFlags)reader.ReadByte();

            // maximum creation index
            if (this.Flags.HasFlag(CreationOrderFlags.TrackCreationOrder))
            {
                this.MaximumCreationIndex = reader.ReadUInt64();
            }

            // fractal heap address
            this.FractalHeapAddress = superblock.ReadOffset(reader);

            // BTree2 name index address
            this.BTree2NameIndexAddress = superblock.ReadOffset(reader);

            // BTree2 creation order index address
            if (this.Flags.HasFlag(CreationOrderFlags.IndexCreationOrder))
            {
                this.BTree2CreationOrderIndexAddress = superblock.ReadOffset(reader);
            }
        }
示例#3
0
        public LinkMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // flags
            this.Flags = reader.ReadByte();

            // link type
            var isLinkTypeFieldPresent = (this.Flags & (1 << 3)) > 0;

            if (isLinkTypeFieldPresent)
            {
                this.LinkType = (LinkType)reader.ReadByte();
            }

            // creation order
            var isCreationOrderFieldPresent = (this.Flags & (1 << 2)) > 0;

            if (isCreationOrderFieldPresent)
            {
                this.CreationOrder = reader.ReadUInt64();
            }

            // link name encoding
            var isLinkNameEncodingFieldPresent = (this.Flags & (1 << 4)) > 0;

            if (isLinkNameEncodingFieldPresent)
            {
                this.LinkNameEncoding = (CharacterSetEncoding)reader.ReadByte();
            }

            // link length
            var linkLengthFieldLength = (ulong)(1 << (this.Flags & 0x03));
            var linkNameLength        = H5Utils.ReadUlong(this.Reader, linkLengthFieldLength);

            // link name
            this.LinkName = H5Utils.ReadFixedLengthString(reader, (int)linkNameLength, this.LinkNameEncoding);

            // link info
            this.LinkInfo = this.LinkType switch
            {
                LinkType.Hard => new HardLinkInfo(reader, superblock),
                LinkType.Soft => new SoftLinkInfo(reader),
                LinkType.External => new ExternalLinkInfo(reader),
                _ when(65 <= (byte)this.LinkType && (byte)this.LinkType <= 255) => new UserDefinedLinkInfo(reader),
                _ => throw new NotSupportedException($"The link message link type '{this.LinkType}' is not supported.")
            };
        }