static bool ProcessRecoveryGDF(Stream isoStream, string outputPath, bool extractFiles = true, bool consoleOutput = true) { var gdf = new XboxGDFImage(isoStream); if (!gdf.Read()) { return(false); } var entry = new GdfEntry(); if (!gdf.GetEntry("recctrl.bin", ref entry, false)) { Console.WriteLine("Failed to find recctrl.bin inside GDF image!"); return(false); } using (var reader = new BinaryReader(gdf.OpenFile(entry))) { Stream dataStream = null; if (extractFiles) { if (!gdf.GetEntry("recdata.bin", ref entry, false)) { Console.WriteLine("Failed to find recdata.bin inside GDF image!"); return(false); } dataStream = gdf.OpenFile(entry); } bool res = ProcessRecovery(reader, dataStream, outputPath, consoleOutput); if (dataStream != null) { dataStream.Close(); } return(res); } }
public bool GetEntry(string fileName, ref GdfEntry entry, bool caseSensitive = true) { foreach (var pair in Entries) { if (caseSensitive) { if (fileName == pair.Item2) { entry = pair.Item1; return(true); } } else { if (fileName.ToLower() == pair.Item2.ToLower()) { entry = pair.Item1; return(true); } } } return(false); }
public Stream OpenFile(GdfEntry entry) { return(new WindowedStream(reader.BaseStream, SectorToOffset(entry.FirstSector), entry.FileSize)); }