示例#1
0
        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()));
        }
示例#2
0
        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);
        }
示例#3
0
        public void D64_EmptyImage()
        {
            var image = CreateD64Image(
                "CBM.COM",
                0, 0,
                new Dictionary <int, byte[]>());
            var loader  = new D64Loader(sc, ImageLocation.FromUri("file:CBM.COM"), image);
            var archive = loader.LoadDiskDirectory();

            Assert.AreEqual(0, archive.RootEntries.Count);
        }
示例#4
0
 private int SectorRef(byte track, byte sector)
 {
     return(D64Loader.SectorOffset(track, sector));
 }