Inheritance: Disk_Reader.absNode
Exemplo n.º 1
0
        protected byte[] buildMap(forkStream fs)
        {
            List <byte[]> mapContent = new List <byte[]>();

            mapContent.Add(header.map.bitmapComponent);
            uint fLink = this.header.BTNodeDescriptor.fLink;

            uint mapSize = (uint)header.map.bitmapComponent.Length;

            // if fLink > 0, there are more map nodes with map data to be read
            while (fLink > 0)
            {
                byte[] nodeRawData = new byte[this.nodeSize];
                fs.Seek(fLink * this.nodeSize, System.IO.SeekOrigin.Begin);
                fs.Read(nodeRawData, 0, this.nodeSize);
                mapNode currentMap = new mapNode(ref nodeRawData);
                mapContent.Add(currentMap.bitmapComponent);

                mapSize += (uint)currentMap.bitmapComponent.Length;

                fLink = currentMap.BTNodeDescriptor.fLink;
            }

            byte[] mapData = new byte[mapSize];

            int position = 0;

            foreach (byte[] component in mapContent)
            {
                Array.Copy(component, 0, mapData, position, component.Length);
                position += component.Length;
            }

            return(mapData);
        }
Exemplo n.º 2
0
        protected byte[] buildMap(forkStream fs)
        {
            List<byte[]> mapContent = new List<byte[]>();

            mapContent.Add(header.map.bitmapComponent);
            uint fLink = this.header.BTNodeDescriptor.fLink;

            uint mapSize = (uint)header.map.bitmapComponent.Length;

            // if fLink > 0, there are more map nodes with map data to be read
            while (fLink > 0)
            {
                byte[] nodeRawData = new byte[this.nodeSize];
                fs.Seek(fLink * this.nodeSize, System.IO.SeekOrigin.Begin);
                fs.Read(nodeRawData, 0, this.nodeSize);
                mapNode currentMap = new mapNode(ref nodeRawData);
                mapContent.Add(currentMap.bitmapComponent);

                mapSize += (uint)currentMap.bitmapComponent.Length;

                fLink = currentMap.BTNodeDescriptor.fLink;
            }

            byte[] mapData = new byte[mapSize];

            int position = 0;
            foreach (byte[] component in mapContent)
            {
                Array.Copy(component, 0, mapData, position, component.Length);
                position += component.Length;
            }

            return mapData;
        }