public Block(string filepath, int length, FileSystem fs) { data = new byte[length]; this.filepath = filepath; this.length = length; this.FileSystem = fs; freeSpace = new List<Region> { new Region(this, 0, length) }; _fileSystem = new FileSystem(); }
public MainWindow() { InitializeComponent(); fs = new FileSystem(); Block b = new Block("memory10", 10,fs); Block b2 = new Block("memory5", 5, fs); fs.add(b2); fs.open(b); File f1 = (File)fs.writeFile("test", new byte[] { 1, 2, 3, 4, 5 }); Console.WriteLine(String.Join(", ", b.data)); File f2 = (File)fs.writeFile("tet2", new byte[] { 11,12,13,14,15 }); Console.WriteLine(String.Join(", ", b.data)); fs.delete(f1); fs.writeFile("test3", new byte[] { 21, 22, 23 }); fs.writeFile("test4", new byte[] { 201, 202, 203, 204, 205, 206 }); Console.WriteLine(String.Join(", ", b.data)); refresh(); }