Esempio n. 1
0
 public void Write(CBinaryWriter bw)
 {
     bw.Write(this.Size);
     bw.Write((uint) this.Flags);
     bw.Write((uint) this.FourCC);
     bw.Write(this.RGBBitCount);
     bw.Write(this.BitMaskRed);
     bw.Write(this.BitMaskGreen);
     bw.Write(this.BitMaskBlue);
     bw.Write(this.BitMaskRGBAlpha);
 }
Esempio n. 2
0
 public void Write(CBinaryWriter bw)
 {
     bw.Write(this.Size);
     bw.Write((uint) this.Flags);
     bw.Write(this.Height);
     bw.Write(this.Width);
     bw.Write(this.Depth);
     bw.Write(this.Pitch);
     bw.Write(this.MipMapCount);
     bw.Write(this.Reserved);
     this.PixelFormat.Write(bw);
     this.Caps.Write(bw);
     bw.Write(this.Reserved2);
 }
Esempio n. 3
0
 private void writeGDFsizes(CBinaryWriter bw)
 {
     long length = bw.BaseStream.Length;
     bw.Seek(8L, SeekOrigin.Begin);
     bw.Write((long) (length - 0x400L));
     uint num2 = (uint) (((double) length) / 2048.0);
     bw.Seek(0x8050L, SeekOrigin.Begin);
     bw.Write(num2);
     bw.Endian = EndianType.BigEndian;
     bw.Seek(0x8054L, SeekOrigin.Begin);
     bw.Write(num2);
     bw.Endian = EndianType.LittleEndian;
 }
Esempio n. 4
0
 private void writeGDFheader(MemoryStream ms)
 {
     CBinaryWriter writer = new CBinaryWriter(EndianType.LittleEndian, ms);
     writer.Seek(0L, SeekOrigin.Begin);
     writer.Write((uint) 0x1a465358);
     writer.Write((uint) 0x400);
     writer.Seek(0x8000L, SeekOrigin.Begin);
     writer.Write(gdf_sector);
     writer.Seek(0x10000L, SeekOrigin.Begin);
     writer.Write(this.src.VolDesc.Identifier);
     writer.Write(this.tables[this.tables.Count - 1].Sector);
     writer.Write((uint) (this.sizeToSectors(this.tables[this.tables.Count - 1].Size) * this.src.VolDesc.SectorSize));
     writer.Write(this.src.VolDesc.ImageCreationTime);
     writer.Write((byte) 1);
     writer.Seek(0x107ecL, SeekOrigin.Begin);
     writer.Write(this.src.VolDesc.Identifier);
     writer.Close();
 }
Esempio n. 5
0
 public void WriteGDF(CBinaryWriter bw)
 {
     MemoryStream ms = new MemoryStream();
     ms.Seek(0x12000L, SeekOrigin.Begin);
     for (int i = this.tables.Count - 1; i >= 0; i--)
     {
         if (this.tables[i].Size > 0)
         {
             byte[] buffer = this.tables[i].ToByteArray();
             ms.Write(buffer, 0, buffer.Length);
         }
     }
     this.writeGDFheader(ms);
     bw.Seek(0L, SeekOrigin.Begin);
     bw.Write(ms.ToArray());
     ms.Close();
 }
Esempio n. 6
0
 public void WriteData(CBinaryWriter bw)
 {
     for (int i = this.tables.Count - 1; i >= 0; i--)
     {
         foreach (GDFDirEntry entry in this.tables[i])
         {
             if (!entry.IsDirectory)
             {
                 string path = "";
                 this.calcPath(this.tables[i], entry, ref path);
                 if (path.StartsWith(@"\"))
                 {
                     path = path.Remove(0, 1);
                 }
                 bw.Seek((long) (entry.Sector * this.src.VolDesc.SectorSize), SeekOrigin.Begin);
                 this.src.WriteFileToStream(path, bw);
             }
         }
     }
     this.writeGDFsizes(bw);
 }
Esempio n. 7
0
 public void Write(CBinaryWriter bw)
 {
     bw.Endian = EndianType.LittleEndian;
     bw.WriteUint32(this.magicBytes);
     this.Header.Write(bw);
     if (this.Data != null)
     {
         bw.Write(this.Data);
     }
 }
Esempio n. 8
0
 public void Write(CBinaryWriter bw)
 {
     bw.Write((uint) this.Caps1);
     bw.Write((uint) this.Caps2);
     bw.Write(this.Reserved);
 }
Esempio n. 9
0
 public ConHeaderWriter()
 {
     Resources.emptyLIVE.CopyTo(this.buffer, 0);
     this.header = new MemoryStream(this.buffer);
     this.bw = new CBinaryWriter(EndianType.BigEndian, this.header);
 }
Esempio n. 10
0
 private void writeGDFheader(GDF src, CBinaryWriter bw)
 {
     bw.Seek(0L, SeekOrigin.Begin);
     bw.Write((uint) 0x1a465358);
     bw.Write((uint) 0x400);
     bw.Seek(0x8000L, SeekOrigin.Begin);
     bw.Write(gdf_sector);
     bw.Seek(0x10000L, SeekOrigin.Begin);
     bw.Write(src.VolDesc.Identifier);
     bw.Write(this.rootDir.Sector);
     bw.Write((uint) (this.sizeToSectors(src, this.rootDir.Size) * src.VolDesc.SectorSize));
     bw.Write(src.VolDesc.ImageCreationTime);
     bw.Write((byte) 1);
     bw.Seek(0x107ecL, SeekOrigin.Begin);
     bw.Write(src.VolDesc.Identifier);
 }
Esempio n. 11
0
 private void writeGDFtable(GDF src, CBinaryWriter bw, GDFDirTable table)
 {
     bw.Seek((long) (table.Sector * src.VolDesc.SectorSize), SeekOrigin.Begin);
     byte[] buffer = table.ToByteArray();
     bw.Write(buffer);
     foreach (GDFDirEntry entry in table)
     {
         if (entry.IsDirectory && (entry.SubDir != null))
         {
             this.writeGDFtable(src, bw, entry.SubDir);
         }
     }
 }
Esempio n. 12
0
 public void WriteGDF(GDF src, FileStream iso)
 {
     CBinaryWriter bw = new CBinaryWriter(EndianType.LittleEndian, iso);
     base.ReportProgress(0, "Writing new GDF header...");
     this.writeGDFheader(src, bw);
     base.ReportProgress(0, "Writing new GDF directories...");
     this.writeGDFtable(src, bw, this.rootDir);
 }
Esempio n. 13
0
 public void WriteFiles(GDF src, FileStream Iso)
 {
     CBinaryWriter bw = new CBinaryWriter(EndianType.LittleEndian, Iso);
     base.ReportProgress(0, "Writing file data to new ISO image...");
     this.writeFiles(src, bw, this.rootDir);
     this.writeGDFsizes(bw);
 }
Esempio n. 14
0
 private void writeFiles(GDF src, CBinaryWriter bw, GDFDirTable table)
 {
     uint fileCount = src.FileCount;
     foreach (GDFDirEntry entry in table)
     {
         if (!entry.IsDirectory)
         {
             bw.Seek((long) (entry.Sector * src.VolDesc.SectorSize), SeekOrigin.Begin);
             string path = "";
             this.calcPath(table, entry, ref path);
             if (path.StartsWith(@"\"))
             {
                 path = path.Remove(0, 1);
             }
             this.progress += ((1f / ((float) fileCount)) * 0.45f) * 100f;
             base.ReportProgress((int) this.progress, "Writing '" + path + "' at Sector 0x" + entry.Sector.ToString("X02") + "...");
             src.WriteFileToStream(path, bw);
         }
     }
     foreach (GDFDirEntry entry2 in table)
     {
         if (entry2.IsDirectory && (entry2.SubDir != null))
         {
             this.writeFiles(src, bw, entry2.SubDir);
         }
     }
 }
Esempio n. 15
0
 private string createUniqueName(IsoEntry Iso)
 {
     MemoryStream s = new MemoryStream();
     CBinaryWriter writer = new CBinaryWriter(EndianType.LittleEndian, s);
     writer.Write(Iso.ID.TitleID);
     writer.Write(Iso.ID.MediaID);
     writer.Write(Iso.ID.DiscNumber);
     writer.Write(Iso.ID.DiscCount);
     byte[] buffer = this.sha1.ComputeHash(s.ToArray());
     string str = "";
     for (int i = 0; i < (buffer.Length / 2); i++)
     {
         str = str + buffer[i].ToString("X02");
     }
     return str;
 }
Esempio n. 16
0
 public long WriteFileToStream(string Path, CBinaryWriter Writer)
 {
     try
     {
         GDFDirTable folder = this.GetFolder(this.rootDir, Path);
         string str = Path.Contains(@"\") ? Path.Substring(Path.LastIndexOf(@"\") + 1) : Path;
         foreach (GDFDirEntry entry in folder)
         {
             if (entry.Name.ToLower() == str.ToLower())
             {
                 this.fr.Seek((long) (this.volDesc.RootOffset + (entry.Sector * this.volDesc.SectorSize)), SeekOrigin.Begin);
                 uint num = (uint) Math.Ceiling((double) (((double) entry.Size) / ((double) this.volDesc.SectorSize)));
                 long num2 = 0L;
                 for (uint i = 0; i < num; i++)
                 {
                     byte[] buffer;
                     if ((num2 + this.volDesc.SectorSize) > entry.Size)
                     {
                         buffer = this.fr.ReadBytes((int) (entry.Size - num2));
                         Writer.Write(buffer);
                         int num4 = ((int) this.volDesc.SectorSize) - buffer.Length;
                         for (int j = 0; j < num4; j++)
                         {
                             Writer.Write((byte) 0);
                         }
                     }
                     else
                     {
                         buffer = this.fr.ReadBytes((int) this.volDesc.SectorSize);
                         Writer.Write(buffer);
                     }
                     num2 += this.volDesc.SectorSize;
                 }
                 return (long) entry.Size;
             }
         }
     }
     catch (Exception exception)
     {
         this.Exceptions.Add(exception);
     }
     return -1L;
 }