General refactor and cleanup.

This commit is contained in:
2025-07-27 17:32:31 +01:00
parent a551e2474d
commit 8c116535c5
25 changed files with 335 additions and 324 deletions

View File

@@ -15,12 +15,14 @@
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
Swapping to <strong>Development</strong> environment will display more detailed information about the error that
occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong>
environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@@ -1,7 +1,8 @@
<FluentDesignTheme StorageName="theme" Mode="DesignThemeModes.Dark">
@using RomRepoMgr.Blazor.Components.Layout
<FluentDesignTheme StorageName="theme" Mode="DesignThemeModes.Dark">
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<RouteView DefaultLayout="typeof(Layout.MainLayout)" RouteData="routeData"/>
<RouteView DefaultLayout="typeof(MainLayout)" RouteData="routeData"/>
<FocusOnNavigate RouteData="routeData" Selector="h1"/>
</Found>
</Router>

View File

@@ -74,14 +74,14 @@ public static class FAT
byte bpbSignature;
byte fat32Signature;
ulong hugeSectors;
var fat32Id = new byte[8];
var msxId = new byte[6];
var dosOem = new byte[8];
var atariOem = new byte[6];
byte[] fat32Id = new byte[8];
byte[] msxId = new byte[6];
byte[] dosOem = new byte[8];
byte[] atariOem = new byte[6];
ushort bootable = 0;
var bpbSector = new byte[512];
var fatSector = new byte[512];
byte[] bpbSector = new byte[512];
byte[] fatSector = new byte[512];
imageStream.Position = 0;
imageStream.EnsureRead(bpbSector, 0, 512);
imageStream.EnsureRead(fatSector, 0, 512);
@@ -111,13 +111,13 @@ public static class FAT
string oemString = Encoding.ASCII.GetString(dosOem);
var apricotBps = BitConverter.ToUInt16(bpbSector, 0x50);
ushort apricotBps = BitConverter.ToUInt16(bpbSector, 0x50);
byte apricotSpc = bpbSector[0x52];
var apricotReservedSecs = BitConverter.ToUInt16(bpbSector, 0x53);
ushort apricotReservedSecs = BitConverter.ToUInt16(bpbSector, 0x53);
byte apricotFatsNo = bpbSector[0x55];
var apricotRootEntries = BitConverter.ToUInt16(bpbSector, 0x56);
var apricotSectors = BitConverter.ToUInt16(bpbSector, 0x58);
var apricotFatSectors = BitConverter.ToUInt16(bpbSector, 0x5B);
ushort apricotRootEntries = BitConverter.ToUInt16(bpbSector, 0x56);
ushort apricotSectors = BitConverter.ToUInt16(bpbSector, 0x58);
ushort apricotFatSectors = BitConverter.ToUInt16(bpbSector, 0x5B);
bool apricotCorrectSpc = apricotSpc is 1 or 2 or 4 or 8 or 16 or 32 or 64;
@@ -197,12 +197,12 @@ public static class FAT
byte z80Di = bpbSector[0];
// First FAT1 sector resides at LBA 0x14
var fat1Sector0 = new byte[512];
byte[] fat1Sector0 = new byte[512];
imageStream.Position = 0x14 * 512;
imageStream.EnsureRead(fat1Sector0, 0, 512);
// First FAT2 sector resides at LBA 0x1A
var fat2Sector0 = new byte[512];
byte[] fat2Sector0 = new byte[512];
imageStream.Position = 0x1A * 512;
imageStream.EnsureRead(fat2Sector0, 0, 512);
bool equalFatIds = fat1Sector0[0] == fat2Sector0[0] && fat1Sector0[1] == fat2Sector0[1];
@@ -210,7 +210,7 @@ public static class FAT
// Volume is software interleaved 2:1
var rootMs = new MemoryStream();
var tmp = new byte[512];
byte[] tmp = new byte[512];
foreach(long position in new long[]
{
@@ -223,12 +223,12 @@ public static class FAT
}
byte[] rootDir = rootMs.ToArray();
var validRootDir = true;
bool validRootDir = true;
// Iterate all root directory
for(var e = 0; e < 96 * 32; e += 32)
for(int e = 0; e < 96 * 32; e += 32)
{
for(var c = 0; c < 11; c++)
for(int c = 0; c < 11; c++)
{
if((rootDir[c + e] >= 0x20 || rootDir[c + e] == 0x00 || rootDir[c + e] == 0x05) &&
rootDir[c + e] != 0xFF &&

View File

@@ -38,17 +38,17 @@ public static class Base32
var builder = new StringBuilder(bytes.Length * _inByteSize / _outByteSize);
// Position in the input buffer
var bytesPosition = 0;
int bytesPosition = 0;
// Offset inside a single byte that <bytesPosition> points to (from left to right)
// 0 - highest bit, 7 - lowest bit
var bytesSubPosition = 0;
int bytesSubPosition = 0;
// Byte to look up in the dictionary
byte outputBase32Byte = 0;
// The number of bits filled in the current output byte
var outputBase32BytePosition = 0;
int outputBase32BytePosition = 0;
// Iterate through input buffer until we reach past the end of it
while(bytesPosition < bytes.Length)
@@ -119,22 +119,22 @@ public static class Base32
string base32StringUpperCase = base32String.ToUpperInvariant();
// Prepare output byte array
var outputBytes = new byte[base32StringUpperCase.Length * _outByteSize / _inByteSize];
byte[] outputBytes = new byte[base32StringUpperCase.Length * _outByteSize / _inByteSize];
// Check the size
if(outputBytes.Length == 0) throw new ArgumentException(Localization.Base32_Not_enought_data);
// Position in the string
var base32Position = 0;
int base32Position = 0;
// Offset inside the character in the string
var base32SubPosition = 0;
int base32SubPosition = 0;
// Position within outputBytes array
var outputBytePosition = 0;
int outputBytePosition = 0;
// The number of bits filled in the current output byte
var outputByteSubPosition = 0;
int outputByteSubPosition = 0;
// Normally we would iterate on the input array but in this case we actually iterate on the output array
// We do it because output array doesn't have overflow bits, while input does and it will cause output array overflow if we don''t stop in time

View File

@@ -56,7 +56,7 @@ static class ArmSimd
{
uint c = crc;
var bufPos = 0;
int bufPos = 0;
while(len >= 64)
{
@@ -95,7 +95,7 @@ static class ArmSimd
{
uint c = crc;
var bufPos = 0;
int bufPos = 0;
while(len >= 32)
{

View File

@@ -110,9 +110,9 @@ static class Clmul
Vector128<uint> xmmCRC1 = Vector128<uint>.Zero;
Vector128<uint> xmmCRC2 = Vector128<uint>.Zero;
Vector128<uint> xmmCRC3 = Vector128<uint>.Zero;
var bufPos = 0;
int bufPos = 0;
var first = true;
bool first = true;
/* fold 512 to 32 step variable declarations for ISO-C90 compat. */
var xmmMask = Vector128.Create(0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000);

View File

@@ -379,15 +379,15 @@ public sealed partial class Crc32Context : IChecksum
static uint[][] GenerateTable(uint polynomial)
{
var table = new uint[8][];
uint[][] table = new uint[8][];
for(var i = 0; i < 8; i++) table[i] = new uint[256];
for(int i = 0; i < 8; i++) table[i] = new uint[256];
for(var i = 0; i < 256; i++)
for(int i = 0; i < 256; i++)
{
var entry = (uint)i;
uint entry = (uint)i;
for(var j = 0; j < 8; j++)
for(int j = 0; j < 8; j++)
{
if((entry & 1) == 1)
entry = entry >> 1 ^ polynomial;
@@ -398,9 +398,9 @@ public sealed partial class Crc32Context : IChecksum
table[0][i] = entry;
}
for(var slice = 1; slice < 8; slice++)
for(int slice = 1; slice < 8; slice++)
{
for(var i = 0; i < 256; i++)
for(int i = 0; i < 256; i++)
table[slice][i] = table[slice - 1][i] >> 8 ^ table[0][table[slice - 1][i] & 0xFF];
}
@@ -417,7 +417,7 @@ public sealed partial class Crc32Context : IChecksum
return;
}
var currentPos = 0;
int currentPos = 0;
if(useIso)
{
@@ -467,7 +467,7 @@ public sealed partial class Crc32Context : IChecksum
{
uint one = BitConverter.ToUInt32(data, currentPos) ^ crc;
currentPos += 4;
var two = BitConverter.ToUInt32(data, currentPos);
uint two = BitConverter.ToUInt32(data, currentPos);
currentPos += 4;
crc = table[0][two >> 24 & 0xFF] ^
@@ -528,7 +528,7 @@ public sealed partial class Crc32Context : IChecksum
uint[][] localTable = GenerateTable(polynomial);
var buffer = new byte[65536];
byte[] buffer = new byte[65536];
int read = fileStream.EnsureRead(buffer, 0, 65536);
while(read > 0)
@@ -661,7 +661,7 @@ public sealed partial class Crc32Context : IChecksum
crc32_free(_nativeContext);
}
for(var i = 0; i < BigEndianBitConverter.GetBytes(crc).Length; i++)
for(int i = 0; i < BigEndianBitConverter.GetBytes(crc).Length; i++)
crc32Output.Append(BigEndianBitConverter.GetBytes(crc)[i].ToString("x2"));
return crc32Output.ToString();

View File

@@ -72,7 +72,7 @@ static class Clmul
internal static ulong Step(ulong crc, byte[] data, uint length)
{
var bufPos = 16;
int bufPos = 16;
const ulong k1 = 0xe05dd497ca393ae4;
const ulong k2 = 0xdabe95afc7875f40;
const ulong mu = 0x9c3e466c172963d5;

View File

@@ -324,15 +324,15 @@ public sealed partial class Crc64Context : IChecksum
static ulong[][] GenerateTable(ulong polynomial)
{
var table = new ulong[8][];
ulong[][] table = new ulong[8][];
for(var i = 0; i < 8; i++) table[i] = new ulong[256];
for(int i = 0; i < 8; i++) table[i] = new ulong[256];
for(var i = 0; i < 256; i++)
for(int i = 0; i < 256; i++)
{
var entry = (ulong)i;
ulong entry = (ulong)i;
for(var j = 0; j < 8; j++)
for(int j = 0; j < 8; j++)
{
if((entry & 1) == 1)
entry = entry >> 1 ^ polynomial;
@@ -343,9 +343,9 @@ public sealed partial class Crc64Context : IChecksum
table[0][i] = entry;
}
for(var slice = 1; slice < 4; slice++)
for(int slice = 1; slice < 4; slice++)
{
for(var i = 0; i < 256; i++)
for(int i = 0; i < 256; i++)
table[slice][i] = table[slice - 1][i] >> 8 ^ table[0][table[slice - 1][i] & 0xFF];
}
@@ -362,7 +362,7 @@ public sealed partial class Crc64Context : IChecksum
return;
}
var dataOff = 0;
int dataOff = 0;
if(useEcma && Pclmulqdq.IsSupported && Sse41.IsSupported && Ssse3.IsSupported && Sse2.IsSupported)
{
@@ -393,7 +393,7 @@ public sealed partial class Crc64Context : IChecksum
while(dataOff < limit)
{
var tmp = (uint)(crc ^ BitConverter.ToUInt32(data, dataOff));
uint tmp = (uint)(crc ^ BitConverter.ToUInt32(data, dataOff));
dataOff += 4;
crc = table[3][tmp & 0xFF] ^
@@ -449,7 +449,7 @@ public sealed partial class Crc64Context : IChecksum
ulong[][] localTable = GenerateTable(polynomial);
var buffer = new byte[65536];
byte[] buffer = new byte[65536];
int read = fileStream.EnsureRead(buffer, 0, 65536);
while(read > 0)
@@ -582,7 +582,7 @@ public sealed partial class Crc64Context : IChecksum
crc64_free(_nativeContext);
}
for(var i = 0; i < BigEndianBitConverter.GetBytes(crc).Length; i++)
for(int i = 0; i < BigEndianBitConverter.GetBytes(crc).Length; i++)
crc64Output.Append(BigEndianBitConverter.GetBytes(crc)[i].ToString("x2"));
return crc64Output.ToString();

View File

@@ -75,7 +75,7 @@ public sealed class SpamSumContext : IChecksum
Bh = new BlockhashContext[NUM_BLOCKHASHES]
};
for(var i = 0; i < NUM_BLOCKHASHES; i++) _self.Bh[i].Digest = new byte[SPAMSUM_LENGTH];
for(int i = 0; i < NUM_BLOCKHASHES; i++) _self.Bh[i].Digest = new byte[SPAMSUM_LENGTH];
_self.Bhstart = 0;
_self.Bhend = 1;
@@ -240,7 +240,7 @@ public sealed class SpamSumContext : IChecksum
var sb = new StringBuilder();
uint bi = _self.Bhstart;
uint h = roll_sum();
var remain = (int)(FUZZY_MAX_RESULT - 1); /* Exclude terminating '\0'. */
int remain = (int)(FUZZY_MAX_RESULT - 1); /* Exclude terminating '\0'. */
result = new byte[FUZZY_MAX_RESULT];
/* Verify that our elimination was not overeager. */
@@ -423,7 +423,7 @@ public sealed class SpamSumContext : IChecksum
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static string CToString(byte[] cString)
{
var count = 0;
int count = 0;
// ReSharper disable once LoopCanBeConvertedToQuery
// LINQ is six times slower
@@ -506,7 +506,7 @@ public sealed class SpamSumContext : IChecksum
{
_self.TotalSize += len;
for(var i = 0; i < len; i++) fuzzy_engine_step(data[i]);
for(int i = 0; i < len; i++) fuzzy_engine_step(data[i]);
}
/// <inheritdoc />

View File

@@ -58,7 +58,7 @@ public static class Extensions
/// </returns>
public static int EnsureRead(this Stream s, byte[] buffer, int offset, int count)
{
var pos = 0;
int pos = 0;
int read;
do

View File

@@ -509,7 +509,7 @@ public sealed class Fuse : FileSystem
{
xattr = new byte[hash.Length / 2];
for(var i = 0; i < xattr.Length; i++)
for(int i = 0; i < xattr.Length; i++)
{
if(hash[i * 2] >= 0x30 && hash[i * 2] <= 0x39)
xattr[i] = (byte)((hash[i * 2] - 0x30) * 0x10);
@@ -824,7 +824,7 @@ public sealed class Fuse : FileSystem
public void Umount()
{
var rnd = new Random();
var token = new byte[64];
byte[] token = new byte[64];
rnd.NextBytes(token);
_umountToken = Base32.ToBase32String(token);
setxattr(Path.Combine(MountPoint, ".fuse_umount"), _umountToken, IntPtr.Zero, 0, 0);

View File

@@ -369,7 +369,7 @@ public class Winfsp(Vfs vfs) : FileSystemBase
if(fileNode is not FileNode { Handle: > 0 } node) return STATUS_INVALID_HANDLE;
var buf = new byte[length];
byte[] buf = new byte[length];
int ret = vfs.Read(node.Handle, buf, (long)offset);
@@ -575,10 +575,10 @@ public class Winfsp(Vfs vfs) : FileSystemBase
if(securityDescriptor == null) return STATUS_SUCCESS;
var rootSddl = "O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;WD)";
string rootSddl = "O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;WD)";
var rootSecurityDescriptor = new RawSecurityDescriptor(rootSddl);
var fileSecurity = new byte[rootSecurityDescriptor.BinaryLength];
byte[] fileSecurity = new byte[rootSecurityDescriptor.BinaryLength];
rootSecurityDescriptor.GetBinaryForm(fileSecurity, 0);
securityDescriptor = fileSecurity;

View File

@@ -89,7 +89,7 @@ internal sealed class ForcedSeekStream<T> : Stream where T : Stream
do
{
var buffer = new byte[BUFFER_LEN];
byte[] buffer = new byte[BUFFER_LEN];
read = _baseStream.Read(buffer, 0, BUFFER_LEN);
_backStream.Write(buffer, 0, read);
} while(read == BUFFER_LEN);
@@ -111,11 +111,11 @@ internal sealed class ForcedSeekStream<T> : Stream where T : Stream
_backStream.Position = _backStream.Length;
long toPosition = position - _backStream.Position;
var fullBufferReads = (int)(toPosition / BUFFER_LEN);
var restToRead = (int)(toPosition % BUFFER_LEN);
int fullBufferReads = (int)(toPosition / BUFFER_LEN);
int restToRead = (int)(toPosition % BUFFER_LEN);
byte[] buffer;
for(var i = 0; i < fullBufferReads; i++)
for(int i = 0; i < fullBufferReads; i++)
{
buffer = new byte[BUFFER_LEN];
_baseStream.EnsureRead(buffer, 0, BUFFER_LEN);

View File

@@ -175,7 +175,7 @@ public sealed class DatImporter
Maximum = machineNames.Count
});
var position = 0;
int position = 0;
var machines = new Dictionary<string, Machine>();
foreach(string name in machineNames)
@@ -223,29 +223,29 @@ public sealed class DatImporter
var disks = new List<Disk>();
var medias = new List<Media>();
var tmpRomCrc32Table = Guid.NewGuid().ToString();
var tmpRomMd5Table = Guid.NewGuid().ToString();
var tmpRomSha1Table = Guid.NewGuid().ToString();
var tmpRomSha256Table = Guid.NewGuid().ToString();
var tmpRomSha384Table = Guid.NewGuid().ToString();
var tmpRomSha512Table = Guid.NewGuid().ToString();
var tmpDiskMd5Table = Guid.NewGuid().ToString();
var tmpDiskSha1Table = Guid.NewGuid().ToString();
var tmpMediaMd5Table = Guid.NewGuid().ToString();
var tmpMediaSha1Table = Guid.NewGuid().ToString();
var tmpMediaSha256Table = Guid.NewGuid().ToString();
string tmpRomCrc32Table = Guid.NewGuid().ToString();
string tmpRomMd5Table = Guid.NewGuid().ToString();
string tmpRomSha1Table = Guid.NewGuid().ToString();
string tmpRomSha256Table = Guid.NewGuid().ToString();
string tmpRomSha384Table = Guid.NewGuid().ToString();
string tmpRomSha512Table = Guid.NewGuid().ToString();
string tmpDiskMd5Table = Guid.NewGuid().ToString();
string tmpDiskSha1Table = Guid.NewGuid().ToString();
string tmpMediaMd5Table = Guid.NewGuid().ToString();
string tmpMediaSha1Table = Guid.NewGuid().ToString();
string tmpMediaSha256Table = Guid.NewGuid().ToString();
var romsHaveCrc = false;
var romsHaveMd5 = false;
var romsHaveSha1 = false;
var romsHaveSha256 = false;
var romsHaveSha384 = false;
var romsHaveSha512 = false;
var disksHaveMd5 = false;
var disksHaveSha1 = false;
var mediasHaveMd5 = false;
var mediasHaveSha1 = false;
var mediasHaveSha256 = false;
bool romsHaveCrc = false;
bool romsHaveMd5 = false;
bool romsHaveSha1 = false;
bool romsHaveSha256 = false;
bool romsHaveSha384 = false;
bool romsHaveSha512 = false;
bool disksHaveMd5 = false;
bool disksHaveSha1 = false;
bool mediasHaveMd5 = false;
bool mediasHaveSha1 = false;
bool mediasHaveSha256 = false;
DbConnection dbConnection = ctx.Database.GetDbConnection();
dbConnection.Open();
@@ -626,7 +626,7 @@ public sealed class DatImporter
foreach(Rom rom in roms)
{
var hashCollision = false;
bool hashCollision = false;
SetProgress?.Invoke(this,
new ProgressEventArgs
@@ -648,7 +648,7 @@ public sealed class DatImporter
return;
}
var uSize = (ulong)rom.GetInt64FieldValue(SabreTools.Models.Metadata.Rom.SizeKey);
ulong uSize = (ulong)rom.GetInt64FieldValue(SabreTools.Models.Metadata.Rom.SizeKey);
DbFile file = null;

View File

@@ -232,7 +232,7 @@ public static class DetectOS
/// <returns>Current operating system version</returns>
public static string GetVersion()
{
var environ = Environment.OSVersion.Version.ToString();
string environ = Environment.OSVersion.Version.ToString();
switch(GetRealPlatformID())
{

View File

@@ -1,4 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xml:space="preserve">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aaru/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Claunia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=datfiles/@EntryIndexedValue">True</s:Boolean>
@@ -15,4 +18,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Winfsp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xattr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xattrs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0020_007B_000A_0020_0020_0020_0020/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean
x:Key="/Default/UserDictionary/Words/=_0020_007B_000A_0020_0020_0020_0020/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -14,17 +14,20 @@ public class SerilogSink(LogEventLevel minimumLevel, IList<string>? areas = null
public void Log(LogEventLevel level, string area, object? source, string messageTemplate)
{
if(IsEnabled(level, area))
{
Serilog.Log.Write(LogLevelToSerilogLevel(level),
"[{Area} {Source}] {MessageTemplate}",
area,
source,
messageTemplate);
}
}
public void Log(LogEventLevel level, string area, object? source, string messageTemplate,
params object?[] propertyValues)
{
if(IsEnabled(level, area))
{
Serilog.Log.Write(LogLevelToSerilogLevel(level),
"[{Area} {Source}] {MessageTemplate}",
propertyValues,
@@ -32,6 +35,7 @@ public class SerilogSink(LogEventLevel minimumLevel, IList<string>? areas = null
source,
messageTemplate);
}
}
private static Serilog.Events.LogEventLevel LogLevelToSerilogLevel(LogEventLevel level)
{

View File

@@ -95,9 +95,9 @@ public sealed partial class ExportDatViewModel : ViewModelBase
ProgressVisible = true;
StatusMessage = Localization.DecompressingDat;
var sha384Bytes = new byte[48];
byte[] sha384Bytes = new byte[48];
for(var i = 0; i < 48; i++)
for(int i = 0; i < 48; i++)
{
if(_datHash[i * 2] >= 0x30 && _datHash[i * 2] <= 0x39)
sha384Bytes[i] = (byte)((_datHash[i * 2] - 0x30) * 0x10);

View File

@@ -76,10 +76,10 @@ public sealed partial class RemoveDatViewModel : ViewModelBase
Dispatcher.UIThread.Post(() => StatusMessage = Localization.RemovingDatFileFromRepo);
var sha384Bytes = new byte[48];
byte[] sha384Bytes = new byte[48];
string sha384 = romSet.Sha384;
for(var i = 0; i < 48; i++)
for(int i = 0; i < 48; i++)
{
if(sha384[i * 2] >= 0x30 && sha384[i * 2] <= 0x39)
sha384Bytes[i] = (byte)((sha384[i * 2] - 0x30) * 0x10);