static void Main(string[] args) { try { int structSize = Marshal.SizeOf(typeof(VolumeHeader)); Console.WriteLine("Marshal.SizeOf(typeof(VolumeHeader) == " + structSize); Disk d = new Disk(); Console.WriteLine("\nMake Disk:"); Console.WriteLine(ToStringProperty(d.GetVolumeHeader())); d.Createdisk("disk1", "oshri"); Console.WriteLine("\nCreate Disk:"); Console.WriteLine(ToStringProperty(d.GetVolumeHeader())); d.Mountdisk("disk1"); if (d.Ismounted(d.myDiskPointer)) { Console.WriteLine("Mounted!"); } d.Createfile("f1", "meir", "F", Store.size(), 50, "I", 0); FCB fcb = d.Openfile("f1", "meir", "IO"); fcb.seekRec(0, (int)fcb.GetFileDescription().FileAddr - 4 + 20); Store str = new Store("", "", "", ""); Store str2 = new Store("", "", "", ""); fcb.readRec(str, 1); str = new Store("123", "aaa", "aaa", "aaa"); fcb.updateRec(str); fcb.seekRec(1, -1); fcb.readRec(str2, 0); fcb.Closefile(); DirEntry newdir = d.GetDirEntry(0); d.Format("oshri"); Console.WriteLine("\nFormat Disk:"); Console.WriteLine(ToStringProperty(d.GetVolumeHeader())); d.Unmountdisk(d.myDiskPointer); if (d.Ismounted(d.myDiskPointer)) { Console.WriteLine("Mounted!"); } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(e.Message); Console.ResetColor(); } }
/// <summary> /// Switching back to the MainWindows /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BackButton_Click(object sender, RoutedEventArgs e) { // if the user is in the recordMenu Section if (RecordMenu.Visibility == Visibility.Visible) { // jumping back to the file menu section RecordMenu.Visibility = Visibility.Hidden; // checking the fcb if (fcb != null) { // getting the keytype to hide the right datagrid if (fcb.GetFileDesc().keyType == "S") { RecordList.Visibility = Visibility.Hidden; } else { CourseList.Visibility = Visibility.Hidden; } } FileList.Visibility = Visibility.Visible; FileMenu.Visibility = Visibility.Visible; this.NextButton.IsEnabled = this.DeleteFileButton.IsEnabled = this.AddFileButton.IsEnabled = this.InformationButton.IsEnabled = this.UpdateFileButton.IsEnabled = true; this.RecordList.Visibility = this.CourseList.Visibility = Visibility.Hidden; // closing the file if (fcb != null) { fcb.Closefile(); } // print all the file PrintFile(); } else { // unmount the disk disk.Unmountdisk(disk.myDiskPointer); // switching back to the main window Switcher.Switch(new MainWindows()); } }