Use ByteArrays for hashes (#2)

* [Disk, Rom] Use byte arrays for hashes to save memory

* [Disk, Rom] Use byte arrays for hashes to save memory

* [Disk, Rom] Use byte arrays for hashes to save memory

* [FileTools] Use ByteArrayToString in CHD info

* [ArchiveTools, FileTools] Use the Style method more

* [Disk, Rom] Use byte arrays for hashes to save memory

* [FileTools] Use ByteArrayToString in CHD info

* [ArchiveTools, FileTools] Use the Style method more

* [Disk, Rom] Use byte arrays for hashes to save memory

* [FileTools] Use ByteArrayToString in CHD info

* [ArchiveTools, FileTools] Use the Style method more

* [Disk, Rom] Use byte arrays for hashes to save memory

* [FileTools] Use ByteArrayToString in CHD info

* [ArchiveTools, FileTools] Use the Style method more

* [Disk, Rom] Use byte arrays for hashes to save memory

* [FileTools] Use ByteArrayToString in CHD info

* [ArchiveTools, FileTools] Use the Style method more

* [SabreTools, GZipArchive] Refix some issues from rebase

* # This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 4 commits.
# This is the 1st commit message:

[Disk, Rom] Use byte arrays for hashes to save memory

# This is the commit message #2:

[FileTools] Use ByteArrayToString in CHD info

# This is the commit message #3:

[ArchiveTools, FileTools] Use the Style method more

# This is the commit message #4:

[SabreTools, GZipArchive] Refix some issues from rebase

# This is the commit message #2:

[FileTools] Use ByteArrayToString in CHD info

# This is the commit message #2:

[FileTools] Use ByteArrayToString in CHD info

# This is the commit message #2:

[FileTools] Use ByteArrayToString in CHD info

# This is the commit message #2:

[FileTools] Use ByteArrayToString in CHD info

* [Disk, Rom, Style] Add null or empty check to fix equality check

* [Disk, Rom] Remove unused references

* [Style] Add and implement BinaryReader extensions
This commit is contained in:
Matt Nadareski
2017-11-02 15:35:15 -07:00
committed by GitHub
parent 639f0491bb
commit 6af1547877
7 changed files with 309 additions and 139 deletions

View File

@@ -216,10 +216,9 @@ namespace SabreTools.Library.FileTypes
Rom tempRom = new Rom(gamename, gamename, omitFromScan);
BinaryReader br = new BinaryReader(FileTools.TryOpenRead(_filename));
br.BaseStream.Seek(-8, SeekOrigin.End);
byte[] headercrc = br.ReadBytes(4);
tempRom.CRC = BitConverter.ToString(headercrc.Reverse().ToArray()).Replace("-", string.Empty).ToLowerInvariant();
byte[] headersize = br.ReadBytes(4);
tempRom.Size = BitConverter.ToInt32(headersize.Reverse().ToArray(), 0);
byte[] headercrc = br.ReadBytesReverse(4);
tempRom.CRC = Style.ByteArrayToString(headercrc);
tempRom.Size = br.ReadInt32Reverse();
br.Dispose();
found.Add(tempRom);
@@ -387,8 +386,8 @@ namespace SabreTools.Library.FileTypes
}
// Now convert the data and get the right position
string gzmd5 = BitConverter.ToString(headermd5).Replace("-", string.Empty);
string gzcrc = BitConverter.ToString(headercrc).Replace("-", string.Empty);
string gzmd5 = Style.ByteArrayToString(headermd5);
string gzcrc = Style.ByteArrayToString(headercrc);
long extractedsize = (long)headersz;
Rom rom = new Rom