Esempio n. 1
0
        public RzxBlock ReadBlock()
        {
            CheckEof();
            if (IsEndOfFile)
            {
                return(null);
            }
            int blockId = m_stream.ReadByte();

            if (blockId < 0 || blockId > 255)
            {
                RaiseUnexpectedEndException();
            }
            byte[] dataBuf = new byte[4];
            if (m_stream.Read(dataBuf, 0, dataBuf.Length) != dataBuf.Length)
            {
                RaiseUnexpectedEndException();
            }
            Int32 blockLength = BitConverter.ToInt32(dataBuf, 0) - 5;

            if (blockLength < 0)
            {
                throw new InvalidDataException(string.Format("Invalid block length={0}", blockLength));
            }
            byte[] blockData = new byte[blockLength];
            if (m_stream.Read(blockData, 0, blockData.Length) != blockData.Length)
            {
                RaiseUnexpectedEndException();
            }
            return(RzxBlock.Create(blockId, blockData));
        }
Esempio n. 2
0
 public RzxFrame[] GetNextFrameArray()
 {
     while (true)
     {
         RzxBlock block = ReadBlock();
         if (block == null)
         {
             return(null);
         }
         RzxBlockRecording rzxRec = block as RzxBlockRecording;
         if (rzxRec != null)
         {
             return(loadRec(rzxRec));
         }
         RzxBlockSnapshot rzxSnap = block as RzxBlockSnapshot;
         if (rzxSnap != null)
         {
             loadSnap(rzxSnap);
         }
     }
 }