private bool CheckForValidBootSectors()
 {
     if (Bootloader.Count == 1)
     {
         return(HeaderVerifier.VerifyFHAT16BootSector(Bootloader[0], (ushort)Kernel.Count, (ushort)Master.Floppy.Sectors.Length, true));
     }
     else
     {
         MessageBox.Show("Bootloader is too big");
         return(false);
     }
 }
Exemple #2
0
 private bool VerifyBootSector(bool IsBootable)
 {
     return(HeaderVerifier.VerifyFHAT16BootSector(OutputFloppy.Sectors[0], OutputFloppy.Sectors[0].Memory[8], (ushort)OutputFloppy.Sectors.Length, IsBootable));
 }
Exemple #3
0
 private bool ConvertEntrys(ushort SectorNumber, cFileSystemItem ItemToFill, uint Size)
 {
     if (ItemToFill.IsDirectory())
     {
         //ignore the first Entry, as it is isn't displayed in the logical structure
         int  SubIndex = ItemToFill.Metadata.GetBinaryEntrySize();
         bool run      = true;
         while (run)
         {
             if (HeaderVerifier.IsValidDirectoryEntry(InputFloppy.Sectors[SectorNumber], SubIndex, SectorNumber, InputFAT))
             {
                 //TODO: Read/write the datetimes
                 cFileFlags Flags = new cFileFlags();
                 Flags.ReadFromBinary((byte)InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 5]);
                 ushort[] Data = new ushort[4];
                 Data[0] = InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 0];
                 Data[1] = InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 1];
                 Data[2] = InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 2];
                 Data[3] = InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 3];
                 string Name = cFileSigConverter.ConvertToFileName(Data);
                 Data    = new ushort[2];
                 Data[0] = InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 4];
                 Data[1] = InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 5];
                 string          Extention = cFileSigConverter.ConvertToFileExtention(Data);
                 cFileSystemItem NewItem   = new cFileSystemItem(Name, Extention, Flags, false);
                 Size = (uint)((uint)InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 13] << 16 |
                               (uint)InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 12]);
                 if (ConvertEntrys(InputFloppy.Sectors[SectorNumber].Memory[SubIndex + 14], NewItem, Size))
                 {
                     ItemToFill.AddItem(NewItem);
                 }
                 SubIndex += ItemToFill.Metadata.GetBinaryEntrySize();
                 if (SubIndex >= InputFAT.GetSectorSize())
                 {
                     SubIndex     = 0;
                     SectorNumber = InputFAT.NextSector(SectorNumber);
                     if (SectorNumber >= 0xFFF0)
                     {
                         run = false;
                     }
                 }
             }
             else
             {
                 run = false;
             }
         }
         return(true);
     }
     else
     {
         List <ushort> Data = new List <ushort>();
         bool          run  = true;
         uint          i    = 0;
         while (run)
         {
             int subIndex = 0;
             while (subIndex < 512 && i < Size)
             {
                 Data.Add(InputFloppy.Sectors[SectorNumber].Memory[subIndex]);
                 i++;
                 subIndex++;
             }
             SectorNumber = InputFAT.NextSector(SectorNumber);
             if (SectorNumber >= 0xFFF0)
             {
                 run = false;
             }
         }
         cFile Newfile = new cFile();
         Newfile.SetFileData(Data);
         ItemToFill.SetFile(Newfile);
         return(true);
     }
 }