コード例 #1
0
        public void GetDiskInfo(String diskPathname)
        {
            base.LoadDisk(diskPathname);

            System.Text.Encoding enc = System.Text.Encoding.ASCII;

            // Read the System Sector
            Byte[] sectorData = base.ReadSector(20, 1);

            System.IO.MemoryStream stm = new System.IO.MemoryStream(sectorData, 0, sectorData.Length);
            System.IO.BinaryReader rdr = new System.IO.BinaryReader(stm);

            stm.Seek(0xF8, SeekOrigin.Begin);

            Byte[] bByteArray = rdr.ReadBytes(8);

            diskName = enc.GetString(bByteArray);
            diskName.Trim();

            sectorData = base.ReadSector(0, 1);

            System.IO.MemoryStream stm2 = new System.IO.MemoryStream(sectorData, 0, sectorData.Length);
            System.IO.BinaryReader rdr2 = new System.IO.BinaryReader(stm2);

            bByteArray = rdr2.ReadBytes(4);

            if (bByteArray[0] == 0x78 && bByteArray[1] == 0xA9 && bByteArray[2] == 0x7F && bByteArray[3] == 0x8D)
            {
                diskType = DiskTypes.Master;
            }
            else
            {
                diskType = DiskTypes.Slave;
            }

            sides           = 2;
            tracksPerSide   = 41;
            sectorsPerTrack = 17;

            sectors = (UInt16)((tracksPerSide * sectorsPerTrack) * sides);

            OricFileInfo[] programList = ReadDirectory(diskPathname);

            foreach (OricFileInfo programInfo in programList)
            {
                UInt16 sectorsUsedByProgram = programInfo.LengthSectors;
                sectorsUsed += sectorsUsedByProgram;
            }

            if (diskType == DiskTypes.Master)
            {
                sectorsUsed += 62;
            }

            sectorsFree = (UInt16)(sectors - sectorsUsed);

            noOfFiles = (UInt16)programList.Count();
        }
コード例 #2
0
ファイル: SedOric.cs プロジェクト: Yicker419/OricExplorer
        private void ReadBitmap1()
        {
            // Read the System sector
            Byte[] sectorData = base.ReadSector(20, 2);

            System.IO.MemoryStream stm = new System.IO.MemoryStream(sectorData, 0, sectorData.Length);
            System.IO.BinaryReader rdr = new System.IO.BinaryReader(stm);

            Byte[] bByteArray = rdr.ReadBytes(2);

            sectorsFree     = rdr.ReadUInt16();
            noOfFiles       = rdr.ReadUInt16();
            tracksPerSide   = rdr.ReadByte();
            sectorsPerTrack = rdr.ReadByte();
            noOfDirectories = rdr.ReadByte();

            bByteArray = rdr.ReadBytes(1);

            if ((bByteArray[0] & 0x80) == 0x80)
            {
                sides = 2;
            }
            else
            {
                sides = 1;
            }

            bByteArray = rdr.ReadBytes(1);

            if (bByteArray[0] == 0)
            {
                diskType = DiskTypes.Master;
            }
            else if (bByteArray[0] == 0x01)
            {
                diskType = DiskTypes.Slave;
            }
            else if (bByteArray[0] == 0x47)
            {
                diskType = DiskTypes.Game;
            }
            else
            {
                diskType = DiskTypes.Unknown;
            }

            sectors     = (ushort)((sectorsPerTrack * tracksPerSide) * sides);
            sectorsUsed = (ushort)(sectors - sectorsFree);
        }
コード例 #3
0
ファイル: OricDisk.cs プロジェクト: Yicker419/OricExplorer
        public Byte[] diskBuffer;            // Buffer used to store the entire disk

        public OricDisk()
        {
            // Initialise settings
            diskLoaded   = false;
            diskModified = false;

            noOfSides       = 0;
            tracksPerSide   = 0;
            sectorsPerTrack = 0;
            noOfFiles       = 0;

            dosFormat  = DOSFormats.Unknown;
            dosVersion = DOSVersions.Unknown;
            diskType   = DiskTypes.Unknown;
        }
コード例 #4
0
ファイル: OricDisk.cs プロジェクト: Yicker419/OricExplorer
        public OricDisk(String diskPathname)
        {
            // Initialise settings
            diskLoaded   = false;
            diskModified = false;

            noOfSides       = 0;
            tracksPerSide   = 0;
            sectorsPerTrack = 0;
            noOfFiles       = 0;

            dosFormat  = DOSFormats.Unknown;
            dosVersion = DOSVersions.Unknown;
            diskType   = DiskTypes.Unknown;

            if (!LoadDisk(diskPathname))
            {
                diskLoaded = false;
            }
            else
            {
                diskLoaded = true;
            }
        }
コード例 #5
0
 public Disk(DiskTypes type, DiskDevices device)
 {
     Type   = type;
     Device = device;
 }