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(); }
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; }
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(); }
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); }
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); } } }
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); }
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); } } }