コード例 #1
0
ファイル: Program.cs プロジェクト: pedrokj/0x10c
        static void MainTest(string[] args)
        {
            {
                var disk = new Disk();
                "Hello, World!".PackInto(disk.Words, 0);
                disk.WriteTo("hello.disk.txt");
                disk.WriteTo("hello.disk.bin", raw: true);
            }

            int __break = 1;

            {
                var disk = new Disk("hello.disk.txt");
                var msg  = disk.Words.UnpackString(0);
                Console.WriteLine("Message: \"{0}\"", msg);
            }

            {
                var disk = new Disk();
                disk.ReadFrom("hello.disk.bin", raw: true);
                var msg = disk.Words.UnpackString(0);
                Console.WriteLine("Message: \"{0}\"", msg);
            }

            {
                var fs = new Ssfs();

                fs.Format(BinaryImage.ReadImage("boot/bootload.bin"));
                fs.AddFile("kernel.sys", BinaryImage.ReadImage("boot/kernel.sys"));
                fs.AddFile("hmd2043.drv", BinaryImage.ReadImage("boot/hmd2043.drv"));
                fs.AddFile("ssfs.drv", BinaryImage.ReadImage("boot/ssfs.drv"));
                fs.AddFile("shell.sys", BinaryImage.ReadImage("boot/shell.sys"));
                fs.AddFile("shell.ro", BinaryImage.ReadImage("boot/shell.ro"));

                fs.WriteTo("boot.disk.txt");
                fs.WriteTo("boot.disk.bin", raw: true);
            }

            {
                var fs = new Ssfs("boot.disk.txt");
                Console.WriteLine("List of files in boot.disk.txt:");
                foreach (var file in fs.IterFiles())
                {
                    Console.WriteLine(" {0}", file.Path);
                }
            }
        }
コード例 #2
0
 public void WriteTo(Stream s, bool raw = false)
 {
     Disk.WriteTo(s, raw);
 }
コード例 #3
0
 public void WriteTo(string path, bool raw = false)
 {
     Disk.WriteTo(path, raw);
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: DanielKeep/0x10c
        static void MainTest(string[] args)
        {
            {
                var disk = new Disk();
                "Hello, World!".PackInto(disk.Words, 0);
                disk.WriteTo("hello.disk.txt");
                disk.WriteTo("hello.disk.bin", raw: true);
            }

            int __break = 1;

            {
                var disk = new Disk("hello.disk.txt");
                var msg = disk.Words.UnpackString(0);
                Console.WriteLine("Message: \"{0}\"", msg);
            }

            {
                var disk = new Disk();
                disk.ReadFrom("hello.disk.bin", raw: true);
                var msg = disk.Words.UnpackString(0);
                Console.WriteLine("Message: \"{0}\"", msg);
            }

            {
                var fs = new Ssfs();

                fs.Format(BinaryImage.ReadImage("boot/bootload.bin"));
                fs.AddFile("kernel.sys", BinaryImage.ReadImage("boot/kernel.sys"));
                fs.AddFile("hmd2043.drv", BinaryImage.ReadImage("boot/hmd2043.drv"));
                fs.AddFile("ssfs.drv", BinaryImage.ReadImage("boot/ssfs.drv"));
                fs.AddFile("shell.sys", BinaryImage.ReadImage("boot/shell.sys"));
                fs.AddFile("shell.ro", BinaryImage.ReadImage("boot/shell.ro"));

                fs.WriteTo("boot.disk.txt");
                fs.WriteTo("boot.disk.bin", raw: true);
            }

            {
                var fs = new Ssfs("boot.disk.txt");
                Console.WriteLine("List of files in boot.disk.txt:");
                foreach (var file in fs.IterFiles())
                    Console.WriteLine(" {0}", file.Path);
            }
        }