3 using System.Collections.Generic;
13 private readonly Dictionary<KeyOrMouse, string> bindings =
new Dictionary<KeyOrMouse, string>();
14 public IReadOnlyDictionary<KeyOrMouse, string>
Bindings => bindings;
20 var bindings =
new Dictionary<KeyOrMouse, string>();
21 foreach (var subElement
in element.Elements())
25 string command = subElement.GetAttributeString(
"command",
"");
26 if (command.IsNullOrWhiteSpace()) {
continue; }
27 bindings[keyOrMouse] = command;
30 this.bindings = bindings;
33 public static void Init(XElement? element)
35 if (element is
null) {
return; }
43 .ForEach(kvp => element.Add(
44 new XElement(
"Keybind",
45 new XAttribute(
"key", kvp.Key),
46 new XAttribute(
"command", kvp.Value))));
50 => bindings[key] = command;
53 => bindings.Remove(key);
void SaveTo(XElement element)
void Set(KeyOrMouse key, string command)
void Remove(KeyOrMouse key)
IReadOnlyDictionary< KeyOrMouse, string > Bindings
static void Init(XElement? element)
static DebugConsoleMapping Instance