コード例 #1
0
 private void readVolume()
 {
     this.volDesc            = new GDFVolumeDescriptor();
     this.volDesc.SectorSize = 0x800;
     this.fr.Seek((long)(0x20 * this.volDesc.SectorSize), SeekOrigin.Begin);
     if (Encoding.ASCII.GetString(this.fr.ReadBytes(20)) == "MICROSOFT*XBOX*MEDIA")
     {
         this.type = IsoType.Xsf;
         this.volDesc.RootOffset = (uint)this.type;
     }
     else
     {
         this.file.Seek((long)((0x20 * this.volDesc.SectorSize) + 0xfd90000), SeekOrigin.Begin);
         if (Encoding.ASCII.GetString(this.fr.ReadBytes(20)) == "MICROSOFT*XBOX*MEDIA")
         {
             this.type = IsoType.Gdf;
             this.volDesc.RootOffset = (uint)this.type;
         }
         else
         {
             this.type = IsoType.XGD3;
             this.volDesc.RootOffset = (uint)this.type;
         }
     }
     this.file.Seek((long)((0x20 * this.volDesc.SectorSize) + this.volDesc.RootOffset), SeekOrigin.Begin);
     this.volDesc.Identifier        = this.fr.ReadBytes(20);
     this.volDesc.RootDirSector     = this.fr.ReadUInt32();
     this.volDesc.RootDirSize       = this.fr.ReadUInt32();
     this.volDesc.ImageCreationTime = this.fr.ReadBytes(8);
     this.volDesc.VolumeSize        = (ulong)(this.fr.BaseStream.Length - this.volDesc.RootOffset);
     this.volDesc.VolumeSectors     = (uint)(this.volDesc.VolumeSize / ((ulong)this.volDesc.SectorSize));
 }
コード例 #2
0
 private void readVolume()
 {
     volDesc            = new GDFVolumeDescriptor();
     volDesc.SectorSize = 0x800;
     fr.Seek(0x20 * volDesc.SectorSize, SeekOrigin.Begin);
     if (Encoding.ASCII.GetString(fr.ReadBytes(20)) == "MICROSOFT*XBOX*MEDIA")
     {
         type = IsoType.Xsf;
         volDesc.RootOffset = (uint)type;
     }
     else
     {
         file.Seek((0x20 * volDesc.SectorSize) + 0xfd90000, SeekOrigin.Begin);
         if (Encoding.ASCII.GetString(fr.ReadBytes(20)) == "MICROSOFT*XBOX*MEDIA")
         {
             type = IsoType.Gdf;
             volDesc.RootOffset = (uint)type;
         }
         else
         {
             type = IsoType.XGD3;
             volDesc.RootOffset = (uint)type;
         }
     }
     file.Seek((0x20 * volDesc.SectorSize) + volDesc.RootOffset, SeekOrigin.Begin);
     volDesc.Identifier        = fr.ReadBytes(20);
     volDesc.RootDirSector     = fr.ReadUInt32();
     volDesc.RootDirSize       = fr.ReadUInt32();
     volDesc.ImageCreationTime = fr.ReadBytes(8);
     volDesc.VolumeSize        = (ulong)(fr.BaseStream.Length - volDesc.RootOffset);
     volDesc.VolumeSectors     = (uint)(volDesc.VolumeSize / volDesc.SectorSize);
 }
コード例 #3
0
 public void Close()
 {
     this.volDesc = new GDFVolumeDescriptor();
     this.Exceptions.Clear();
     this.type = IsoType.Gdf;
     this.rootDir.Clear();
     this.fr.Close();
     this.file.Close();
 }
コード例 #4
0
 public void Close()
 {
     volDesc = new GDFVolumeDescriptor();
     Exceptions.Clear();
     type = IsoType.Gdf;
     rootDir.Clear();
     fr.Close();
     file.Close();
 }
コード例 #5
0
ファイル: GDFStats.cs プロジェクト: sunxiaoguang/i360gm
 public GDFStats(GDFVolumeDescriptor volDesc)
 {
     this.SectorSize = volDesc.SectorSize;
     this.MaxSectors = volDesc.VolumeSectors;
     this.MaxBytes   = volDesc.VolumeSize;
     this.Bmp        = new Bitmap((int)(this.MaxSectors / 0x800), 0x800);
     for (int i = 0; i < this.Bmp.Width; i++)
     {
         for (int j = 0; j < this.Bmp.Height; j++)
         {
             this.Bmp.SetPixel(i, j, Color.Black);
         }
     }
 }
コード例 #6
0
ファイル: GDFDirTable.cs プロジェクト: sunxiaoguang/i360gm
        public GDFDirTable(CBinaryReader File, GDFVolumeDescriptor Vol, uint Sector, uint Size)
        {
            this.Sector = Sector;
            this.Size   = Size;
            File.Seek((long)((Sector * Vol.SectorSize) + Vol.RootOffset), SeekOrigin.Begin);
            byte[]        buffer = File.ReadBytes((int)Size);
            MemoryStream  s      = new MemoryStream(buffer);
            CBinaryReader reader = new CBinaryReader(EndianType.LittleEndian, s);

            try
            {
                while (s.Position < Size)
                {
                    GDFDirEntry item = new GDFDirEntry {
                        SubTreeL = reader.ReadUInt16(),
                        SubTreeR = reader.ReadUInt16()
                    };
                    if ((item.SubTreeL != 0xffff) && (item.SubTreeR != 0xffff))
                    {
                        item.Sector     = reader.ReadUInt32();
                        item.Size       = reader.ReadUInt32();
                        item.Attributes = (GDFDirEntryAttrib)reader.ReadByte();
                        item.NameLength = reader.ReadByte();
                        item.Name       = Encoding.ASCII.GetString(buffer, (int)s.Position, item.NameLength);
                        s.Seek((long)item.NameLength, SeekOrigin.Current);
                        long num1 = s.Position % 4L;
                        if ((s.Position % 4L) != 0L)
                        {
                            s.Seek(4L - (s.Position % 4L), SeekOrigin.Current);
                        }
                        base.Add(item);
                    }
                }
            }
            catch (EndOfStreamException)
            {
                Console.WriteLine("EndOfStreamException while trying to read directory at sector {0} ({1} bytes)", Sector.ToString(), Size.ToString());
            }
            catch (Exception exception)
            {
                Console.WriteLine("Unhandled Exception {0} for directory at sector {1} -> {2}", exception.InnerException, Sector.ToString(), exception.Message);
            }
        }