コード例 #1
0
ファイル: D64LoaderTests.cs プロジェクト: nemerle/reko
 public void D64_EmptyImage()
 {
     var image = CreateD64Image(
         "CBM.COM",
         0, 0,
         new Dictionary<int, byte[]>());
     var loader = new D64Loader(sc, "CBM.COM", image);
     var items = loader.LoadDiskDirectory();
     Assert.AreEqual(0, items.Count);
 }
コード例 #2
0
        public IArchive LoadDiskDirectory()
        {
            var  entries = new List <ArchiveDirectoryEntry>();
            var  rdr     = new ByteImageReader(RawImage, (uint)SectorOffset(18, 0));
            byte track   = rdr.ReadByte();
            var  archive = new D64Archive(Services, ImageLocation, entries);

            if (track != 0)
            {
                byte sector = rdr.ReadByte();
                rdr.Offset = (uint)D64Loader.SectorOffset(track, sector);
                while (ReadDirectorySector(rdr, archive, entries))
                {
                    ;
                }
            }
            return(archive);
        }
コード例 #3
0
        public List <ArchiveDirectoryEntry> LoadDiskDirectory()
        {
            var  entries = new List <ArchiveDirectoryEntry>();
            var  rdr     = new ByteImageReader(RawImage, (uint)SectorOffset(18, 0));
            byte track   = rdr.ReadByte();

            if (track == 0)
            {
                return(entries);
            }
            byte sector = rdr.ReadByte();

            rdr.Offset = (uint)D64Loader.SectorOffset(track, sector);
            while (ReadDirectorySector(rdr, entries))
            {
                ;
            }
            return(entries);
        }
コード例 #4
0
ファイル: D64LoaderTests.cs プロジェクト: gitter-badger/reko
        public void D64_SingleFile()
        {
            var image = CreateD64Image(
                "CBM.COM",
                18, 1,
                new Dictionary<int, byte[]> 
                {
                    {
                        SectorRef(18, 1),
                        Sector(
                            DirEntry(
                                0, 0xFF,
                                FileType.PRG | FileType.Locked,
                                19, 0,
                                "FOO", 
                                1))
                    },
                    {
                        SectorRef(19, 0),
                        Sector(
                            new byte[] { 0, 0xD},
                            Encoding.ASCII.GetBytes("Hello world"))
                    }
                });
            var loader = new D64Loader(sc, "CBM.COM", image);
            var items = loader.LoadDiskDirectory();

            Assert.AreEqual(1, items.Count);
            var file = (ArchivedFile) items[0];
            Assert.AreEqual("Hello world", Encoding.ASCII.GetString(file.GetBytes()));
        }