Refactor `HotkeyInfo.ResolveWithDefaults`

This commit is contained in:
James Groom 2024-03-12 15:22:07 +10:00 committed by GitHub
parent fdf63900b6
commit 24bd99eb07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -2,7 +2,6 @@
using System.Linq;
using BizHawk.Common;
using BizHawk.Common.CollectionExtensions;
namespace BizHawk.Client.Common
{
@ -195,8 +194,8 @@ namespace BizHawk.Client.Common
public static void ResolveWithDefaults(IDictionary<string, string> dict)
{
foreach (var k in dict.Keys.Where(static k => !AllHotkeys.ContainsKey(k)).ToArray()) dict.Remove(k); // remove extraneous
foreach (var (k, v) in AllHotkeys) if (!dict.ContainsKey(k)) dict[k] = v.DefaultBinding; // add missing
dict.RemoveAll(static kvp => !AllHotkeys.ContainsKey(kvp.Key)); // remove extraneous
}
public readonly string DefaultBinding;