mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Style] Move StringToByteArray to Style where it belongs
This commit is contained in:
@@ -682,8 +682,8 @@ namespace SabreTools.Helper
|
||||
{
|
||||
// Write standard header and TGZ info
|
||||
byte[] data = Constants.TorrentGZHeader
|
||||
.Concat(StringToByteArray(rom.HashData.MD5)) // MD5
|
||||
.Concat(StringToByteArray(rom.HashData.CRC)) // CRC
|
||||
.Concat(Style.StringToByteArray(rom.HashData.MD5)) // MD5
|
||||
.Concat(Style.StringToByteArray(rom.HashData.CRC)) // CRC
|
||||
.Concat(BitConverter.GetBytes(rom.HashData.Size).Reverse().ToArray()) // Long size (Mirrored)
|
||||
.ToArray();
|
||||
sw.Write(data);
|
||||
@@ -840,17 +840,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa
|
||||
/// </summary>
|
||||
public static byte[] StringToByteArray(String hex)
|
||||
{
|
||||
int NumberChars = hex.Length;
|
||||
byte[] bytes = new byte[NumberChars / 2];
|
||||
for (int i = 0; i < NumberChars; i += 2)
|
||||
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
#region Hash-to-Dat functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user