示例#1
0
        protected int TokenOffset;   // the binaryTokens are offset by this amount, ie for binary world files

        public override SBR ReadSubBlock()
        {
            BinaryBlockReader block = new BinaryBlockReader
            {
                FileName    = FileName,
                InputStream = InputStream,
                TokenOffset = TokenOffset
            };

            int MSTSToken = InputStream.ReadUInt16();

            block.ID             = (TokenID)(MSTSToken + TokenOffset);
            block.Flags          = InputStream.ReadUInt16();
            block.RemainingBytes = InputStream.ReadUInt32(); // record length

            uint blockSize = block.RemainingBytes + 8;       //for the header

            RemainingBytes -= blockSize;

            int labelLength = InputStream.ReadByte();

            block.RemainingBytes -= 1;
            if (labelLength > 0)
            {
                byte[] buffer = InputStream.ReadBytes(labelLength * 2);
                block.Label           = System.Text.Encoding.Unicode.GetString(buffer, 0, labelLength * 2);
                block.RemainingBytes -= (uint)labelLength * 2;
            }
            return(block);
        }
示例#2
0
 public SBRException(BinaryBlockReader sbr, string message)
     : base($"{message} in {sbr.FileName}:byte {((sbr.InputStream.BaseStream is DeflateStream deflateStream) ? deflateStream.BaseStream.Position : sbr.InputStream.BaseStream.Position)}\n")
示例#3
0
        public static void TraceInformation(BinaryBlockReader sbr, string message)
        {
            long position = (sbr.InputStream.BaseStream is DeflateStream deflateStream) ? deflateStream.BaseStream.Position : sbr.InputStream.BaseStream.Position;

            Trace.TraceInformation("{2} in {0}:byte {1}", sbr.FileName, position, message);
        }
示例#4
0
        public static void TraceInformation(BinaryBlockReader sbr, string message)
        {
            long position = (sbr?.InputStream.BaseStream is DeflateStream deflateStream) ? deflateStream.BaseStream.Position : sbr.InputStream.BaseStream.Position;

            Trace.TraceInformation($"{message} in {sbr.FileName}:byte {position}");
        }