internal cFloppy GetFloppy(int SectorSize) { int NumSectors = Readout.Count / SectorSize; if ((Readout.Count % SectorSize) != 0) { NumSectors++; } cFloppy result = new cFloppy(NumSectors); int SectorIndex = 0; int SectorPos = 0; int ReadoutPos = 0; while (SectorIndex < NumSectors) { while (SectorPos < SectorSize && ReadoutPos < Readout.Count) { result.Sectors[SectorIndex].Memory[SectorPos] = Readout[ReadoutPos]; SectorPos++; ReadoutPos++; } SectorPos = 0; SectorIndex++; } return(result); }
public mainForm() { InitializeComponent(); cbEndian.SelectedIndex = 1; //Organic outputs big Endian Floppy = new cFloppy(0); FileSystem = new cFileSystem(DiskType.NonBootable, Floppy); ItemsInWorkingDirectory = new DataTable(); dgItemsInWorkingDir.DataSource = ItemsInWorkingDirectory; LastSelectedIndex = -1; }
internal cFloppy Clone() { cFloppy Clone = new cFloppy(this.Sectors.Length); for (int i = 0; i < this.Sectors.Length; i++) { Clone.Sectors[i] = this.Sectors[i].Clone(); } return(Clone); }
internal cFileSystem(DiskType ModeOfDisk, cFloppy FloppyToUse) { FAT = new cFAT(ModeOfDisk, FloppyToUse); cFileFlags RootDirFlags = new cFileFlags(); RootDirFlags.Directory = true; RootDirectory = new cFileSystemItem("", "", RootDirFlags, true); WorkingDirectory = RootDirectory; PathToWorkingDirectory = new List <cFileSystemItem>(); PathToWorkingDirectory.Add(RootDirectory); }
internal cBinReader(cFloppy NewFloppy) { InputFloppy = NewFloppy; OutputFloppy = new cFloppy(InputFloppy.Sectors.Length); if (IsBootable(InputFloppy)) { OutputFS = new cFileSystem(DiskType.Bootable, OutputFloppy); OutputFS.FAT.InitFat(); InputFAT = new cFAT(DiskType.Bootable, InputFloppy); } else { OutputFS = new cFileSystem(DiskType.NonBootable, OutputFloppy); OutputFS.FAT.InitFat(); InputFAT = new cFAT(DiskType.NonBootable, InputFloppy); } }
private bool IsBootable(cFloppy FloppyToUse) { try { if (FloppyToUse.Sectors[0].Memory[0] == 0xC382) { return(true); } else { return(false); } } catch { return(false); } }
private void NewFloppyToolStripMenuItem_Click(object sender, EventArgs e) { NewFloppyWizard Wizard = new NewFloppyWizard(this); if (Wizard.ShowDialog() == DialogResult.OK) { if (FileSystem.FAT.InitFat()) { FloppyChanged = true; } else { MessageBox.Show("Failed to generate the Floppy"); Floppy = new cFloppy(0); //make sure, nothing happens FileSystem = new cFileSystem(DiskType.NonBootable, Floppy); } UpdateDirectoryView(); UpdateDiskUsage(); } }
internal cFAT(DiskType ModeOfDisk, cFloppy FloppyToUse) { Mode = ModeOfDisk; Floppy = FloppyToUse; SectorSize = 512; //might need to change that later on }