/// <summary> /// Initializes a new instance of the <see cref="MdfPsbFile"/> class. /// </summary> /// <param name="psbFilePath">path to the PSB file.</param> /// <param name="verbose">whether to provide verbose output.</param> public MdfPsbFile(string psbFilePath, bool verbose = false) { this.verbose = verbose; Console.WriteLine("Decompressing PSB file..."); this.path = psbFilePath; this.decompressedPath = this.path + ".extract"; // Remove the temp file if it exists if (File.Exists(this.decompressedPath)) { if (verbose) { Console.WriteLine("File exists at {0}, deleting...", this.decompressedPath); } File.Delete(this.decompressedPath); } this.mdfHeader = new MdfHeader(this.path); if (verbose) { Console.WriteLine("MDF Header content:\n{0}", this.mdfHeader.ToString()); } if (verbose) { Console.WriteLine("Generating XOR key for MDF decryption..."); } this.xorKey = this.GenerateXorKey(this.path); if (verbose) { Console.WriteLine("Reading bytes from {0}...", this.path); } this.mdfData = File.ReadAllBytes(this.path); this.DecryptMdfData(); this.DecompressMdfData(); }
public MdfPsbFile(string psbFilePath) { Console.WriteLine("Decompressing PSB file..."); path = psbFilePath; decompressedPath = path + ".extract"; // Remove the temp file if it exists if (File.Exists(decompressedPath)) { File.Delete(decompressedPath); } mdfHeader = new MdfHeader(path); //Console.WriteLine(mdfHeader.ToString()); xorKey = GenerateXorKey(path); mdfData = File.ReadAllBytes(path); DecryptMdfData(); DecompressMdfData(); }
public static bool IsMdfPsb(string psbFilePath) { MdfHeader header = new MdfHeader(psbFilePath); return(header.IsValid()); }