Esempio n. 1
0
        /// <summary>
        /// Gets data from the page
        /// If the page is compressed, it will uncompress it and return it.
        /// </summary>
        /// <returns></returns>
        private byte[] GetData()
        {
            //set our Randomaccess to the start of this page
            RandomAccess ra = RandomAccess.GetInstance();

            byte[] pageData;
            ra.jumpAbs(addr);

            ra.jumpRelative(13);             //skip the header

            //pull the page data
            //This really shouldn't be very big.. on my files it was about 8kb
            //If the file is using compression... uncompress it

            if ((pageSize != pageSizeUncompressed) && (flags == 0))
            {
                try {
                    pageData = ra.deRle(pageSize - 13);
                } catch (Exception ex) {
                    throw new Exception("Bad RLE DataBlock ( compressed: " + pageSize + " uncompressed: " + pageSizeUncompressed + " Page Address: " + addr + "Record Count: " + recordCount.ToString() + "): ", ex);
                }
            }
            else
            {
                pageData = ra.leBytes(pageSize - 13);
            }

            return(pageData);
        }