示例#1
0
        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);
        }
示例#2
0
 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;
 }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 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);
     }
 }
示例#6
0
 private bool IsBootable(cFloppy FloppyToUse)
 {
     try
     {
         if (FloppyToUse.Sectors[0].Memory[0] == 0xC382)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
示例#7
0
        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();
            }
        }
示例#8
0
 internal cFAT(DiskType ModeOfDisk, cFloppy FloppyToUse)
 {
     Mode       = ModeOfDisk;
     Floppy     = FloppyToUse;
     SectorSize = 512;           //might need to change that later on
 }