Exemplo n.º 1
0
        private void hfzWriteHeader(ref EndianBinaryWriter writer, HfzHeader fh)
        {
            // copy header into buffer
            writer.Write(Util.StringToByteArray("HF2", 4));
            writer.Write(fh.FileVersionNo);
            writer.Write(fh.nx);
            writer.Write(fh.ny);
            writer.Write(fh.TileSize);
            writer.Write(fh.Precis);
            writer.Write(fh.HorizScale);
            writer.Write(fh.countExtLength());

            // put extended header into a buffer
            hfzHeader_EncodeExtHeaderBuf(fh, ref writer);
        }
Exemplo n.º 2
0
        private void hfzHeader_EncodeExtHeaderBuf(HfzHeader fh, ref EndianBinaryWriter writer)
        {
            if (fh.nExtHeaderBlocks == 0)
            {
                return;
            }

            if (fh.countExtLength() == 0)
            {
                // can't have zero length
                throw new Exception("Can't have a extended header of zero size");
            }

            HfzExtHeaderBlock pBlock;
            for (int i = 0; i < fh.nExtHeaderBlocks; i++)
            {
                pBlock = fh.pExtHeaderBlocks.ElementAt(i);

                writer.Write(Util.StringToByteArray(pBlock.BlockType, 4));
                writer.Write(Util.StringToByteArray(pBlock.BlockName, 16));
                writer.Write(pBlock.BlockLength);

                if (pBlock.BlockLength > 0)
                {
                    writer.Write(pBlock.pBlockData);
                }
            }
        }