-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cd6b96
commit 0c1ba06
Showing
8 changed files
with
145 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Linq; | ||
using DiscUtils.Iso9660; | ||
using IrdLibraryClient.IrdFormat; | ||
using Ps3DiscDumper.Utils; | ||
|
||
namespace Ps3DiscDumper.DiscInfo | ||
{ | ||
public static class DiscInfoConverter | ||
{ | ||
public static DiscInfo ToDiscInfo(this Ird ird) | ||
{ | ||
List<FileRecord> fsInfo; | ||
var sectorSize = 2048L; | ||
using (var stream = new MemoryStream()) | ||
{ | ||
using (var headerStream = new MemoryStream(ird.Header)) | ||
using (var gzipStream = new GZipStream(headerStream, CompressionMode.Decompress)) | ||
{ | ||
gzipStream.CopyTo(stream); | ||
} | ||
stream.Seek(0, SeekOrigin.Begin); | ||
var reader = new CDReader(stream, true, true); | ||
fsInfo = reader.GetFilesystemStructure(); | ||
sectorSize = reader.ClusterSize; | ||
} | ||
var checksums = ird.Files.ToDictionary(f => f.Offset, f => f.Md5Checksum.ToHexString()); | ||
return new DiscInfo | ||
{ | ||
ProductCode = ird.ProductCode, | ||
DiscVersion = ird.GameVersion, | ||
DiscKeyRawData = ird.Data1.ToHexString(), | ||
DiscKey = Decrypter.DecryptDiscKey(ird.Data1).ToHexString(), | ||
Files = fsInfo.ToDictionary( | ||
f => f.Filename, | ||
f => new FileInfo | ||
{ | ||
Offset = f.StartSector * sectorSize, | ||
Size = f.Length, | ||
Hashes = new Dictionary<string, string> | ||
{ | ||
["MD5"] = checksums[f.StartSector], | ||
} | ||
}) | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Ps3DiscDumper.DiscInfo | ||
{ | ||
public class FileInfo | ||
{ | ||
public long Offset; | ||
public long Size; | ||
public Dictionary<string, string> Hashes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters