Enable RCS1246 and fix noncompliance

"Use element access" (indexer, instead of LINQ)
This commit is contained in:
YoshiRulz 2025-06-23 06:49:18 +10:00
parent 734038dc97
commit 64ab7a6663
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 7 additions and 6 deletions

View File

@ -470,6 +470,8 @@ dotnet_diagnostic.RCS1240.severity = warning
dotnet_diagnostic.RCS1242.severity = silent
# Duplicate word in a comment
dotnet_diagnostic.RCS1243.severity = warning
# Use element access
dotnet_diagnostic.RCS1246.severity = warning
## Microsoft.CodeAnalysis.BannedApiAnalyzers rules

View File

@ -4178,7 +4178,7 @@ namespace BizHawk.Client.EmuHawk
if (result.Warnings.Count is not 0)
{
AddOnScreenMessage(result.Warnings.First()); // For now, just show the first warning
AddOnScreenMessage(result.Warnings[0]); // For now, just show the first warning
}
AddOnScreenMessage($"{Path.GetFileName(fn)} imported as {result.Movie.Filename}");

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using BizHawk.Common;
@ -20,8 +19,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
public Mapper000A(IList<int[]> newData)
{
_rom = new int[0x2000];
Array.Copy(newData.First(), _rom, 0x2000);
if (newData[0] is not { Length: >= 0x2000 } first) throw new ArgumentException(paramName: nameof(newData), message: "first array must have 0x2000 elements");
_rom = first.AsSpan(start: 0, length: 0x2000).ToArray();
pinGame = true;
}

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using BizHawk.Common;
@ -21,7 +20,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
pinExRom = false;
pinGame = true;
_rom = new int[0x40000];
Array.Copy(newData.First(), _rom, 0x2000);
if (newData[0] is not { Length: >= 0x2000 } first) throw new ArgumentException(paramName: nameof(newData), message: "first array must have 0x2000 elements");
first.AsSpan(start: 0, length: 0x2000).CopyTo(_rom);
pinGame = true;
for (var i = 0; i < newData.Count; i++)
{