예제 #1
0
        public AllocationTable(IStorage storage, IStorage header)
        {
            BaseStorage   = storage;
            HeaderStorage = header;
            Header        = new AllocationTableHeader(HeaderStorage);

            Stream tableStream = storage.AsStream();

            // The first entry in the table is reserved. Block 0 is at table index 1
            int blockCount = (int)(Header.AllocationTableBlockCount) + 1;

            Entries = new AllocationTableEntry[blockCount];
            tableStream.Position = 0;
            var reader = new BinaryReader(tableStream);

            for (int i = 0; i < blockCount; i++)
            {
                int parent = reader.ReadInt32();
                int child  = reader.ReadInt32();

                Entries[i] = new AllocationTableEntry {
                    Next = child, Prev = parent
                };
            }
        }
예제 #2
0
 public AllocationTable(IStorage storage, IStorage header)
 {
     BaseStorage   = storage;
     HeaderStorage = header;
     Header        = new AllocationTableHeader(HeaderStorage);
 }