public HotkeyConfig(string data, HotkeyConfig def) { var split = data.Split('*'); bool success = false; if (split.Length == 5) { try { Command = PlayerCommands.getCommandByName(split[0]); Key = (Key)Enum.Parse(typeof(Key), split[1]); Modifiers = (ModifierKeys)Enum.Parse(typeof(ModifierKeys), split[2]); Global = bool.Parse(split[3]); Enabled = bool.Parse(split[4]); success = true; } catch {} } if (!success) { Key = def.Key; Modifiers = def.Modifiers; Enabled = def.Enabled; } }
public HotkeyConfig(string data, HotkeyConfig def) { var split = data.Split('*'); bool success = false; if (split.Length == 5) { try { Command = PlayerCommands.getCommandByName(split[0]); Key = (Key)Enum.Parse(typeof(Key), split[1]); Modifiers = (ModifierKeys)Enum.Parse(typeof(ModifierKeys), split[2]); Global = bool.Parse(split[3]); Enabled = bool.Parse(split[4]); success = true; } catch{} } if(!success) { Key = def.Key; Modifiers = def.Modifiers; Enabled = def.Enabled; } }