Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }