Пример #1
0
 private void loadHotKeys()
 {
     hotKeys = new HotKeyDict(HotKeyManager.getHotKeys());
     keysListView.Items.Clear();
     foreach (KeyValuePair <int, ConfigClass> obj in hotKeys)
     {
         addViewItem(obj.Value);
     }
 }
Пример #2
0
        public static void setHotKeys(HotKeyDict dict)
        {
            hotKeys = new HotKeyDict(dict);
            JArray arr = new JArray();

            foreach (KeyValuePair <int, ConfigClass> pair in hotKeys)
            {
                arr.Add(pair.Value.getJObject());
            }
            Properties.Settings.Default.HotKeys = arr.ToString();
            Properties.Settings.Default.Save();
        }
Пример #3
0
        public static void parseHotKeys()
        {
            hotKeys = new HotKeyDict();
            JArray keys_arr = JArray.Parse(Properties.Settings.Default.HotKeys);

            foreach (JObject obj in keys_arr.Children <JObject>())
            {
                KeyPair key_pairs     = new KeyPair();
                JArray  key_pairs_tmp = (JArray)obj["key_pairs"];
                foreach (int key in key_pairs_tmp)
                {
                    key_pairs.Add((Keys)key);
                }
                ConfigClass.CommandType _type;
                if (!Enum.TryParse(obj["type"].ToString(), out _type))
                {
                    continue;
                }
                hotKeys.Add(key_pairs.GetHashCode(), new ConfigClass(obj["name"].ToString(), key_pairs, _type
                                                                     , obj["exe_file"].ToString(), obj["exe_arg"].ToString(), (Keys)((int)obj["target_key"]), obj["cmd_line"].ToString()));
            }
        }
Пример #4
0
 internal static void InitHotkeys() =>
 DefDatabase <KeyBindingDef> .AllDefsListForReading
 .Where(def =>
        def.category.defName.Equals("TogglesHotkeys")).ToList()
 .ForEach(def =>
          HotKeyDict.Add(def.defName, new Hotkey(def)));