/// <summary>
        /// Convert an array of blocks into a Set of integer indices
        /// </summary>
        /// <param name="blocks">the array of blocks containing the indices</param>
        /// <param name="raw_blocks">the list of blocks being managed. Unused
        /// blocks will be eliminated from the list</param>
        private void SetEntries(ListManagedBlock[] blocks,
                                BlockList raw_blocks)
        {
            int limit = BATBlock.EntriesPerBlock;

            for (int block_index = 0; block_index < blocks.Length; block_index++)
            {
                byte[] data   = blocks[block_index].Data;
                int    offset = 0;

                for (int k = 0; k < limit; k++)
                {
                    int entry = LittleEndian.GetInt(data, offset);

                    if (entry == POIFSConstants.UNUSED_BLOCK)
                    {
                        raw_blocks.Zap(_entries.Count);
                    }
                    _entries.Add(entry);
                    offset += LittleEndianConstants.INT_SIZE;
                }

                // discard block
                blocks[block_index] = null;
            }
            raw_blocks.BAT = this;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Convert an array of blocks into a Set of integer indices
        /// </summary>
        /// <param name="blocks">the array of blocks containing the indices</param>
        /// <param name="raw_blocks">the list of blocks being managed. Unused
        /// blocks will be eliminated from the list</param>
        private void SetEntries(ListManagedBlock[] blocks,
                                BlockList raw_blocks)
        {

            int limit = bigBlockSize.GetBATEntriesPerBlock();

            for (int block_index = 0; block_index < blocks.Length; block_index++)
            {
                byte[] data = blocks[block_index].Data;
                int offset = 0;

                for (int k = 0; k < limit; k++)
                {
                    int entry = LittleEndian.GetInt(data, offset);

                    if (entry == POIFSConstants.UNUSED_BLOCK)
                    {
                        raw_blocks.Zap(_entries.Count);
                    }
                    _entries.Add(entry);
                    offset += LittleEndianConsts.INT_SIZE;
                }

                // discard block
                blocks[block_index] = null;
            }
            raw_blocks.BAT = this;
        }