Exemplo n.º 1
0
        public static async Task <D64> Empty()
        {
            var disk = new D64();

            disk._bytes = await File.ReadAllBytesAsync("empty.d64");

            return(disk);
        }
Exemplo n.º 2
0
        public static async Task <D64> FromStream(Stream stream)
        {
            var disk = new D64();
            var read = await stream.ReadAsync(disk._bytes, 0, (int)__size);

            if (read != __size)
            {
                throw new ArgumentException("Stream is not a d64 disk");
            }

            return(disk);
        }
Exemplo n.º 3
0
        static async Task Main(string[] args)
        {
            var filenameT64 = @"E:\Commodore 64\media\zyronesc.T64";

            using (var streamT64 = File.OpenRead(filenameT64))
            {
                var tape = await T64.FromStream(streamT64);

                var filenameD64 = @"E:\Commodore 64\media\zyronesc.D64";
                using (var streamD64 = File.OpenWrite(filenameD64))
                {
                    var disk = await D64.Empty();

                    disk.DiskName(tape.userDescription).DosType("2A");

                    foreach (var file in tape.files.OrderBy(xx => xx.offsetFile))
                    {
                        disk.Write(D64FileType.PRG, file.c64FileName, file.bytes);
                    }

                    await disk.WriteTo(streamD64);
                }
            }
        }