diff --git a/Directory.Packages.props b/Directory.Packages.props index 232098f..917c121 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,55 +1,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RomRepoMgr.Blazor/Components/Pages/Error.razor b/RomRepoMgr.Blazor/Components/Pages/Error.razor index adab1c1..84d9587 100644 --- a/RomRepoMgr.Blazor/Components/Pages/Error.razor +++ b/RomRepoMgr.Blazor/Components/Pages/Error.razor @@ -15,12 +15,14 @@

Development Mode

- Swapping to Development environment will display more detailed information about the error that occurred. + Swapping to Development environment will display more detailed information about the error that + occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. - For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT + environment variable to Development and restarting the app.

diff --git a/RomRepoMgr.Blazor/Components/Routes.razor b/RomRepoMgr.Blazor/Components/Routes.razor index 73fa7ea..8b1a5a5 100644 --- a/RomRepoMgr.Blazor/Components/Routes.razor +++ b/RomRepoMgr.Blazor/Components/Routes.razor @@ -1,7 +1,8 @@ - +@using RomRepoMgr.Blazor.Components.Layout + - + diff --git a/RomRepoMgr.Blazor/Properties/launchSettings.json b/RomRepoMgr.Blazor/Properties/launchSettings.json index 3597ff3..34f9baf 100644 --- a/RomRepoMgr.Blazor/Properties/launchSettings.json +++ b/RomRepoMgr.Blazor/Properties/launchSettings.json @@ -1,23 +1,23 @@ { - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "http://localhost:5079", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:7057;http://localhost:5079", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5079", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7057;http://localhost:5079", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" } } } +} diff --git a/RomRepoMgr.Blazor/appsettings.json b/RomRepoMgr.Blazor/appsettings.json index 10f68b8..39dbe23 100644 --- a/RomRepoMgr.Blazor/appsettings.json +++ b/RomRepoMgr.Blazor/appsettings.json @@ -1,7 +1,7 @@ { - "Logging": { + "Logging": { "LogLevel": { - "Default": "Information", + "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, diff --git a/RomRepoMgr.Blazor/wwwroot/app.css b/RomRepoMgr.Blazor/wwwroot/app.css index 77cf978..3b90274 100644 --- a/RomRepoMgr.Blazor/wwwroot/app.css +++ b/RomRepoMgr.Blazor/wwwroot/app.css @@ -1,191 +1,191 @@ @import '_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css'; body { - --body-font: "Segoe UI Variable", "Segoe UI", sans-serif; - font-family: var(--body-font); - font-size: var(--type-ramp-base-font-size); - line-height: var(--type-ramp-base-line-height); - margin: 0; + --body-font: "Segoe UI Variable", "Segoe UI", sans-serif; + font-family: var(--body-font); + font-size: var(--type-ramp-base-font-size); + line-height: var(--type-ramp-base-line-height); + margin: 0; } .navmenu-icon { - display: none; + display: none; } .main { - min-height: calc(100dvh - 86px); - color: var(--neutral-foreground-rest); - align-items: stretch !important; + min-height: calc(100dvh - 86px); + color: var(--neutral-foreground-rest); + align-items: stretch !important; } .body-content { - align-self: stretch; - height: calc(100dvh - 86px) !important; - display: flex; + align-self: stretch; + height: calc(100dvh - 86px) !important; + display: flex; } .content { - padding: 0.5rem 1.5rem; - align-self: stretch !important; - width: 100%; + padding: 0.5rem 1.5rem; + align-self: stretch !important; + width: 100%; } .manage { - width: 100dvw; + width: 100dvw; } footer { - background: var(--neutral-layer-4); - color: var(--neutral-foreground-rest); - align-items: center; - padding: 10px 10px; + background: var(--neutral-layer-4); + color: var(--neutral-foreground-rest); + align-items: center; + padding: 10px 10px; } - footer a { - color: var(--neutral-foreground-rest); - text-decoration: none; - } +footer a { + color: var(--neutral-foreground-rest); + text-decoration: none; +} - footer a:focus { - outline: 1px dashed; - outline-offset: 3px; - } +footer a:focus { + outline: 1px dashed; + outline-offset: 3px; +} - footer a:hover { - text-decoration: underline; - } +footer a:hover { + text-decoration: underline; +} .alert { - border: 1px dashed var(--accent-fill-rest); - padding: 5px; + border: 1px dashed var(--accent-fill-rest); + padding: 5px; } #blazor-error-ui { - background: lightyellow; - bottom: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - position: fixed; - width: 100%; - z-index: 1000; - margin: 20px 0; + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; + margin: 20px 0; } - #blazor-error-ui .dismiss { - cursor: pointer; - position: absolute; - right: 0.75rem; - top: 0.5rem; - } +#blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; +} .blazor-error-boundary { - background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZ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em/1.8rem, #b32121; + padding: 1rem 1rem 1rem 3.7rem; + color: white; } - .blazor-error-boundary::before { - content: "An error has occurred. " - } +.blazor-error-boundary::before { + content: "An error has occurred. " +} .loading-progress { - position: relative; - display: block; - width: 8rem; - height: 8rem; - margin: 20vh auto 1rem auto; + position: relative; + display: block; + width: 8rem; + height: 8rem; + margin: 20vh auto 1rem auto; } - .loading-progress circle { - fill: none; - stroke: #e0e0e0; - stroke-width: 0.6rem; - transform-origin: 50% 50%; - transform: rotate(-90deg); - } +.loading-progress circle { + fill: none; + stroke: #e0e0e0; + stroke-width: 0.6rem; + transform-origin: 50% 50%; + transform: rotate(-90deg); +} - .loading-progress circle:last-child { - stroke: #1b6ec2; - stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; - transition: stroke-dasharray 0.05s ease-in-out; - } +.loading-progress circle:last-child { + stroke: #1b6ec2; + stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; + transition: stroke-dasharray 0.05s ease-in-out; +} .loading-progress-text { - position: absolute; - text-align: center; - font-weight: bold; - inset: calc(20vh + 3.25rem) 0 auto 0.2rem; + position: absolute; + text-align: center; + font-weight: bold; + inset: calc(20vh + 3.25rem) 0 auto 0.2rem; } - .loading-progress-text:after { - content: var(--blazor-load-percentage-text, "Loading"); - } +.loading-progress-text:after { + content: var(--blazor-load-percentage-text, "Loading"); +} code { - color: #c02d76; + color: #c02d76; } @media (max-width: 600px) { - .header-gutters { - margin: 0.5rem 3rem 0.5rem 1.5rem !important; - } + .header-gutters { + margin: 0.5rem 3rem 0.5rem 1.5rem !important; + } - [dir="rtl"] .header-gutters { - margin: 0.5rem 1.5rem 0.5rem 3rem !important; - } + [dir="rtl"] .header-gutters { + margin: 0.5rem 1.5rem 0.5rem 3rem !important; + } - .main { - flex-direction: column !important; - row-gap: 0 !important; - } + .main { + flex-direction: column !important; + row-gap: 0 !important; + } - nav.sitenav { - width: 100%; - height: 100%; - } + nav.sitenav { + width: 100%; + height: 100%; + } - #main-menu { - width: 100% !important; - } + #main-menu { + width: 100% !important; + } - #main-menu > div:first-child:is(.expander) { - display: none; - } + #main-menu > div:first-child:is(.expander) { + display: none; + } - .navmenu { - width: 100%; - } + .navmenu { + width: 100%; + } - #navmenu-toggle { - appearance: none; - } + #navmenu-toggle { + appearance: none; + } - #navmenu-toggle ~ nav { - display: none; - } + #navmenu-toggle ~ nav { + display: none; + } - #navmenu-toggle:checked ~ nav { - display: block; - } + #navmenu-toggle:checked ~ nav { + display: block; + } - .navmenu-icon { - cursor: pointer; - z-index: 10; - display: block; - position: absolute; - top: 15px; - left: unset; - right: 20px; - width: 20px; - height: 20px; - border: none; - } + .navmenu-icon { + cursor: pointer; + z-index: 10; + display: block; + position: absolute; + top: 15px; + left: unset; + right: 20px; + width: 20px; + height: 20px; + border: none; + } - [dir="rtl"] .navmenu-icon { - left: 20px; - right: unset; - } + [dir="rtl"] .navmenu-icon { + left: 20px; + right: unset; + } } diff --git a/RomRepoMgr.Core/Aaru/FAT.cs b/RomRepoMgr.Core/Aaru/FAT.cs index 32c744e..36d20ac 100644 --- a/RomRepoMgr.Core/Aaru/FAT.cs +++ b/RomRepoMgr.Core/Aaru/FAT.cs @@ -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); - byte apricotSpc = bpbSector[0x52]; - var 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 apricotBps = BitConverter.ToUInt16(bpbSector, 0x50); + byte apricotSpc = bpbSector[0x52]; + ushort apricotReservedSecs = BitConverter.ToUInt16(bpbSector, 0x53); + byte apricotFatsNo = bpbSector[0x55]; + 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 && diff --git a/RomRepoMgr.Core/Base32.cs b/RomRepoMgr.Core/Base32.cs index 9237826..7da6406 100644 --- a/RomRepoMgr.Core/Base32.cs +++ b/RomRepoMgr.Core/Base32.cs @@ -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 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 diff --git a/RomRepoMgr.Core/Checksums/CRC32/arm_simd.cs b/RomRepoMgr.Core/Checksums/CRC32/arm_simd.cs index b5cc46d..261cb90 100644 --- a/RomRepoMgr.Core/Checksums/CRC32/arm_simd.cs +++ b/RomRepoMgr.Core/Checksums/CRC32/arm_simd.cs @@ -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) { diff --git a/RomRepoMgr.Core/Checksums/CRC32/clmul.cs b/RomRepoMgr.Core/Checksums/CRC32/clmul.cs index be91e40..1781d29 100644 --- a/RomRepoMgr.Core/Checksums/CRC32/clmul.cs +++ b/RomRepoMgr.Core/Checksums/CRC32/clmul.cs @@ -110,9 +110,9 @@ static class Clmul Vector128 xmmCRC1 = Vector128.Zero; Vector128 xmmCRC2 = Vector128.Zero; Vector128 xmmCRC3 = Vector128.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); diff --git a/RomRepoMgr.Core/Checksums/CRC32Context.cs b/RomRepoMgr.Core/Checksums/CRC32Context.cs index 12aa0a0..fb4d4e5 100644 --- a/RomRepoMgr.Core/Checksums/CRC32Context.cs +++ b/RomRepoMgr.Core/Checksums/CRC32Context.cs @@ -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,8 +528,8 @@ public sealed partial class Crc32Context : IChecksum uint[][] localTable = GenerateTable(polynomial); - var buffer = new byte[65536]; - int read = fileStream.EnsureRead(buffer, 0, 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(); diff --git a/RomRepoMgr.Core/Checksums/CRC64/clmul.cs b/RomRepoMgr.Core/Checksums/CRC64/clmul.cs index 34a1b7d..ccc1d2d 100644 --- a/RomRepoMgr.Core/Checksums/CRC64/clmul.cs +++ b/RomRepoMgr.Core/Checksums/CRC64/clmul.cs @@ -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; diff --git a/RomRepoMgr.Core/Checksums/CRC64Context.cs b/RomRepoMgr.Core/Checksums/CRC64Context.cs index ae7adf3..6a9e9d7 100644 --- a/RomRepoMgr.Core/Checksums/CRC64Context.cs +++ b/RomRepoMgr.Core/Checksums/CRC64Context.cs @@ -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,8 +449,8 @@ public sealed partial class Crc64Context : IChecksum ulong[][] localTable = GenerateTable(polynomial); - var buffer = new byte[65536]; - int read = fileStream.EnsureRead(buffer, 0, 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(); diff --git a/RomRepoMgr.Core/Checksums/SpamSumContext.cs b/RomRepoMgr.Core/Checksums/SpamSumContext.cs index 90f1f07..b37fa8c 100644 --- a/RomRepoMgr.Core/Checksums/SpamSumContext.cs +++ b/RomRepoMgr.Core/Checksums/SpamSumContext.cs @@ -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]); } /// diff --git a/RomRepoMgr.Core/Extensions.cs b/RomRepoMgr.Core/Extensions.cs index 44da3b3..f5c1c15 100644 --- a/RomRepoMgr.Core/Extensions.cs +++ b/RomRepoMgr.Core/Extensions.cs @@ -58,7 +58,7 @@ public static class Extensions /// public static int EnsureRead(this Stream s, byte[] buffer, int offset, int count) { - var pos = 0; + int pos = 0; int read; do diff --git a/RomRepoMgr.Core/Filesystem/Fuse.cs b/RomRepoMgr.Core/Filesystem/Fuse.cs index 033a000..c66106c 100644 --- a/RomRepoMgr.Core/Filesystem/Fuse.cs +++ b/RomRepoMgr.Core/Filesystem/Fuse.cs @@ -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); @@ -823,8 +823,8 @@ public sealed class Fuse : FileSystem public void Umount() { - var rnd = new Random(); - var token = new byte[64]; + var rnd = new Random(); + byte[] token = new byte[64]; rnd.NextBytes(token); _umountToken = Base32.ToBase32String(token); setxattr(Path.Combine(MountPoint, ".fuse_umount"), _umountToken, IntPtr.Zero, 0, 0); diff --git a/RomRepoMgr.Core/Filesystem/Winfsp.cs b/RomRepoMgr.Core/Filesystem/Winfsp.cs index 7377136..66cd462 100644 --- a/RomRepoMgr.Core/Filesystem/Winfsp.cs +++ b/RomRepoMgr.Core/Filesystem/Winfsp.cs @@ -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]; + var rootSecurityDescriptor = new RawSecurityDescriptor(rootSddl); + byte[] fileSecurity = new byte[rootSecurityDescriptor.BinaryLength]; rootSecurityDescriptor.GetBinaryForm(fileSecurity, 0); securityDescriptor = fileSecurity; diff --git a/RomRepoMgr.Core/ForcedSeekStream.cs b/RomRepoMgr.Core/ForcedSeekStream.cs index 480d66a..2789793 100644 --- a/RomRepoMgr.Core/ForcedSeekStream.cs +++ b/RomRepoMgr.Core/ForcedSeekStream.cs @@ -89,7 +89,7 @@ internal sealed class ForcedSeekStream : 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 : 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); diff --git a/RomRepoMgr.Core/Workers/DatImporter.cs b/RomRepoMgr.Core/Workers/DatImporter.cs index cfde823..c9741e0 100644 --- a/RomRepoMgr.Core/Workers/DatImporter.cs +++ b/RomRepoMgr.Core/Workers/DatImporter.cs @@ -175,7 +175,7 @@ public sealed class DatImporter Maximum = machineNames.Count }); - var position = 0; + int position = 0; var machines = new Dictionary(); foreach(string name in machineNames) @@ -223,29 +223,29 @@ public sealed class DatImporter var disks = new List(); var medias = new List(); - 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; diff --git a/RomRepoMgr.Settings/Interop/DetectOS.cs b/RomRepoMgr.Settings/Interop/DetectOS.cs index 3431d2f..be43515 100644 --- a/RomRepoMgr.Settings/Interop/DetectOS.cs +++ b/RomRepoMgr.Settings/Interop/DetectOS.cs @@ -232,7 +232,7 @@ public static class DetectOS /// Current operating system version public static string GetVersion() { - var environ = Environment.OSVersion.Version.ToString(); + string environ = Environment.OSVersion.Version.ToString(); switch(GetRealPlatformID()) { diff --git a/RomRepoMgr.sln.DotSettings b/RomRepoMgr.sln.DotSettings index b6fa999..a28c03d 100644 --- a/RomRepoMgr.sln.DotSettings +++ b/RomRepoMgr.sln.DotSettings @@ -1,18 +1,22 @@ - + True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True \ No newline at end of file + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/RomRepoMgr/SerilogSink.cs b/RomRepoMgr/SerilogSink.cs index 2040087..bf58ba1 100644 --- a/RomRepoMgr/SerilogSink.cs +++ b/RomRepoMgr/SerilogSink.cs @@ -14,23 +14,27 @@ public class SerilogSink(LogEventLevel minimumLevel, IList? 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, area, source, messageTemplate); + } } private static Serilog.Events.LogEventLevel LogLevelToSerilogLevel(LogEventLevel level) diff --git a/RomRepoMgr/ViewModels/ExportDatViewModel.cs b/RomRepoMgr/ViewModels/ExportDatViewModel.cs index fe4612a..980c7b8 100644 --- a/RomRepoMgr/ViewModels/ExportDatViewModel.cs +++ b/RomRepoMgr/ViewModels/ExportDatViewModel.cs @@ -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); diff --git a/RomRepoMgr/ViewModels/RemoveDatViewModel.cs b/RomRepoMgr/ViewModels/RemoveDatViewModel.cs index d299299..b809de8 100644 --- a/RomRepoMgr/ViewModels/RemoveDatViewModel.cs +++ b/RomRepoMgr/ViewModels/RemoveDatViewModel.cs @@ -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); diff --git a/codealike.json b/codealike.json index d8d2a61..7cc6ad2 100644 --- a/codealike.json +++ b/codealike.json @@ -1 +1 @@ -{"projectId":"ad616503-97fa-41cc-8470-2fd4ac56d06f","projectName":"RomRepoMgr"} \ No newline at end of file +{"projectId": "ad616503-97fa-41cc-8470-2fd4ac56d06f", "projectName": "RomRepoMgr"} \ No newline at end of file