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); } } }
public void WriteTo(Stream s, bool raw = false) { Disk.WriteTo(s, raw); }
public void WriteTo(string path, bool raw = false) { Disk.WriteTo(path, raw); }
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); } }