public int ReadFrom(byte[] buffer, int offset)
        {
            Count4Bytes = buffer[offset];
            Count8Bytes = buffer[offset + 0x1];
            byte count = Count4Bytes;

            _useShortInode = Count8Bytes == 0;
            offset        += 0x2;
            if (_useShortInode)
            {
                Parent  = EndianUtilities.ToUInt32BigEndian(buffer, offset);
                offset += 0x4;
            }
            else
            {
                Parent  = EndianUtilities.ToUInt64BigEndian(buffer, offset);
                offset += 0x8;
            }
            Entries = new ShortformDirectoryEntry[count];
            for (int i = 0; i < count; i++)
            {
                var entry = new ShortformDirectoryEntry(_useShortInode, _context);
                entry.ReadFrom(buffer, offset);
                offset    += entry.Size;
                Entries[i] = entry;
            }
            return(Size);
        }
        public int ReadFrom(byte[] buffer, int offset)
        {
            Count4Bytes = buffer[offset];
            Count8Bytes = buffer[offset + 0x1];
            byte count;

            _useShortInode = false;
            Parent         = EndianUtilities.ToUInt32BigEndian(buffer, offset + 0x2);
            offset         = offset + 0x6;
            if (Count4Bytes != 0)
            {
                _useShortInode = true;
                count          = Count4Bytes;
            }
            else if (Count8Bytes != 0)
            {
                count = Count8Bytes;
            }
            else
            {
                count = 0;
            }
            Entries = new ShortformDirectoryEntry[count];
            for (int i = 0; i < count; i++)
            {
                var entry = new ShortformDirectoryEntry(_useShortInode);
                entry.ReadFrom(buffer, offset);
                offset    += entry.Size;
                Entries[i] = entry;
            }
            return(Size);
        }
예제 #3
0
        public int ReadFrom(byte[] buffer, int offset)
        {
            Count4Bytes = buffer[offset];
            Count8Bytes = buffer[offset + 0x1];
            byte count;

            _useShortInode = true;
            Parent         = EndianUtilities.ToUInt32BigEndian(buffer, offset + 0x2);

            if (Count8Bytes != 0)
            {
                _useShortInode = false;
                count          = Count8Bytes;
            }
            else if (Count4Bytes != 0)
            {
                count = Count4Bytes;
            }
            else
            {
                count = 0;
            }

            offset  = offset + 10 - (_useShortInode?4:0);//sizeof(struct xfs_dir2_sf_hdr) - (i8count == 0) * (XFS_INO64_SIZE - XFS_INO32_SIZE);
            Entries = new ShortformDirectoryEntry[count];
            for (int i = 0; i < count; i++)
            {
                var entry = new ShortformDirectoryEntry(_useShortInode, has_ftype);
                entry.ReadFrom(buffer, offset);
                offset    += entry.Size;
                Entries[i] = entry;
            }
            return(Size);
        }