Enable CA1854 and fix concompliance
"Prefer the `IDictionary.TryGetValue(TKey, out TValue)` method"
This commit is contained in:
parent
c5d4e8b783
commit
5de736af0e
|
@ -93,6 +93,8 @@ dotnet_diagnostic.CA1829.severity = error
|
||||||
dotnet_diagnostic.CA1836.severity = error
|
dotnet_diagnostic.CA1836.severity = error
|
||||||
# Avoid StringBuilder parameters for P/Invokes
|
# Avoid StringBuilder parameters for P/Invokes
|
||||||
dotnet_diagnostic.CA1838.severity = suggestion
|
dotnet_diagnostic.CA1838.severity = suggestion
|
||||||
|
# Prefer the `IDictionary.TryGetValue(TKey, out TValue)` method
|
||||||
|
dotnet_diagnostic.CA1854.severity = warning
|
||||||
# Avoid using 'Enumerable.Any()' extension method
|
# Avoid using 'Enumerable.Any()' extension method
|
||||||
dotnet_diagnostic.CA1860.severity = error
|
dotnet_diagnostic.CA1860.severity = error
|
||||||
# Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
|
# Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
|
||||||
|
|
|
@ -144,14 +144,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
: "Console"; // anything that wants not console can set it in the categorylabels
|
: "Console"; // anything that wants not console can set it in the categorylabels
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buckets.ContainsKey(categoryLabel))
|
buckets.GetValueOrPut(categoryLabel, categoryLabel1 =>
|
||||||
{
|
{
|
||||||
var l = new List<string>();
|
List<string> l = new();
|
||||||
buckets.Add(categoryLabel, l);
|
orderedBuckets.Add(new(categoryLabel1, l));
|
||||||
orderedBuckets.Add(new KeyValuePair<string, List<string>>(categoryLabel, l));
|
return l;
|
||||||
}
|
}).Add(button);
|
||||||
|
|
||||||
buckets[categoryLabel].Add(button);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderedBuckets.Count == 1)
|
if (orderedBuckets.Count == 1)
|
||||||
|
|
|
@ -36,9 +36,9 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
||||||
private string OverrideButtonName(string original)
|
private string OverrideButtonName(string original)
|
||||||
{
|
{
|
||||||
// VB hack
|
// VB hack
|
||||||
if (ButtonNameOverrides.ContainsKey(original))
|
if (ButtonNameOverrides.TryGetValue(original, out string vbOverrideName))
|
||||||
{
|
{
|
||||||
original = ButtonNameOverrides[original];
|
original = vbOverrideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
original = Regex.Replace(original, @"\s*(↑|↓|←|→)\s*", "");
|
original = Regex.Replace(original, @"\s*(↑|↓|←|→)\s*", "");
|
||||||
|
@ -48,9 +48,9 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
||||||
original = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(original.ToLowerInvariant());
|
original = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(original.ToLowerInvariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ButtonNameOverrides.ContainsKey(original))
|
if (ButtonNameOverrides.TryGetValue(original, out string overrideName))
|
||||||
{
|
{
|
||||||
original = ButtonNameOverrides[original];
|
original = overrideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add dictionaries or whatever here as needed
|
// TODO: Add dictionaries or whatever here as needed
|
||||||
|
|
Loading…
Reference in New Issue