Ejemplo n.º 1
0
 private void DumpBlocks(string tapefile)
 {
     //TODO Print more information about each tape block
     using (var tape = new CasTape(new FileStream(tapefile, FileMode.Open, FileAccess.Read)))
     {
         try
         {
             while (true)
             {
                 var block = DragonTapeBlock.ReadBlock(tape, 1);
                 Console.WriteLine(block.ToString());
             }
         }
         catch (EndOfTapeException)
         {
             return;
         }
     }
 }
Ejemplo n.º 2
0
        public void ReadBlock_NotSynchronized()
        {
            var tapedata = new byte[] { 0xbc, 0x45, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x3c, 0x00, 0x0f, 0x46, 0x4f, 0x4f, 0x42, 0x41, 0x52, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x55, 0x00 };
            var tapefile = new MemoryStream(tapedata, false);
            var tape     = new CasTape(tapefile);

            var block = DragonTapeBlock.ReadBlock(tape, 5);

            Assert.Equal(DragonTapeBlockType.Header, block.BlockType);
            Assert.Equal(15, block.Length);
            Assert.Equal(0x08, block.Checksum);

            var headerblock = (DragonTapeHeaderBlock)block;

            Assert.Equal("FOOBAR", headerblock.Filename);
            Assert.Equal(DragonFileType.Basic, headerblock.FileType);
            Assert.False(headerblock.IsAscii);
            Assert.False(headerblock.IsGapped);

            block.Validate();
        }