Beispiel #1
0
 public PrimaryVolumeDescriptor ReadPVD()
 {
     XASectorForm1 sector = ReadSector(16);
     PrimaryVolumeDescriptor pvd = new PrimaryVolumeDescriptor();
     pvd.ReadByte(sector.Data);
     return pvd;
 }
Beispiel #2
0
        private void readVolumeDescriptors()
        {
            XASectorForm1    sector;
            VolumeDescriptor vd;
            int sectorId = 16;

            sector = fs.ReadXA1Sector(sectorId);
            vd     = new VolumeDescriptor(sector.Data);
            while (vd.VolumeDescriptorType != VolumeDescriptorType.VolumeDescriptionSetTerminator && sectorId < intNbSectors)
            {
                if (vd.StandardIdentifier == "CD001") //valid volume descriptor
                {
                    switch (vd.VolumeDescriptorType)
                    {
                    case VolumeDescriptorType.PrimaryVolumeDescriptor:
                        PrimaryVolumeDescriptor pvd = new PrimaryVolumeDescriptor(sector.Data);
                        rootDirectory = pvd.RootDirectoryRecord;
                        volumeDescriptors.Add(pvd);
                        break;

                    default:
                        break;
                    }
                }
                sectorId++;
                sector = fs.ReadXA1Sector(sectorId);
                vd     = new VolumeDescriptor(sector.Data);
            }
            if (vd.StandardIdentifier == "CD001") //valid volume descriptor
            {
                volumeDescriptors.Add(vd);
            }
        }
Beispiel #3
0
 void OpenToolStripMenuItemClick(object sender, EventArgs e)
 {
     if(openFileDialog1.ShowDialog()==DialogResult.OK)
     {
         discimg = new ISO9660.Image(openFileDialog1.FileName);
         pvd = discimg.ReadPVD();
         RefreshPVDInfo();
         sectorPos = 0;
         RefreshSectorInfo();
     }
 }
Beispiel #4
0
        private void readDirectoryRecord(int sectorId)
        {
            PrimaryVolumeDescriptor pvd    = (PrimaryVolumeDescriptor)volumeDescriptors[0];
            XASectorForm1           sector = fs.ReadXA1Sector(sectorId);
            int offset = 0;

            while (sector.Data[offset] != 0)
            {
                int    size = sector.Data[offset];
                byte[] data = new byte[size];
                Array.Copy(sector.Data, offset, data, 0, size);
                DirectoryRecord dr = new DirectoryRecord(data);
                if (dr.FileIdentifierLength > 1)
                {
                    dr.FileIdentifier = Encoding.ASCII.GetString(data, 33, dr.FileIdentifierLength - 2);
                }
                else
                {
                    switch (data[33])
                    {
                    case 0:
                        dr.FileIdentifier = ".";
                        break;

                    case 1:
                        dr.FileIdentifier = "..";
                        break;

                    default:
                        dr.FileIdentifier = "";
                        break;
                    }
                }
                rootDirectory.Children.Add(dr);
                offset += size;
            }
        }