コード例 #1
0
    public static KeyCode GetKeyCode(ExIni.IniFile ini, string section, string key, KeyCode defautlValue)
    {
        KeyCode keyCode = StringToKeyCode(GetString(ini, section, key));

        if (keyCode == InvalidKeyCode)
        {
            return(defautlValue);
        }
        return(keyCode);
    }
コード例 #2
0
 public void SaveIni(ExIni.IniFile ini)
 {
     ini[section]["Enable"].Value = Enable.ToString();
     SetKeyCode(ini, section, "Ok", Ok);
     SetKeyCode(ini, section, "Cancel", Cancel);
     for (int i = 0; i < 20; i++)
     {
         SetKeyCode(ini, section, string.Format("Shortcut_{0}", i), Shortcuts[i]);
     }
 }
コード例 #3
0
 static string GetString(ExIni.IniFile ini, string section, string key)
 {
     if (!ini.HasSection(section))
     {
         return(null);
     }
     if (!ini[section].HasKey(key))
     {
         return(null);
     }
     return(ini[section][key].Value);
 }
コード例 #4
0
    public void LoadIni(ExIni.IniFile ini)
    {
        bool b;

        if (bool.TryParse(ini[section]["Enable"].Value, out b))
        {
            Enable = b;
        }
        Ok     = GetKeyCode(ini, section, "Ok", Ok);
        Cancel = GetKeyCode(ini, section, "Cancel", Cancel);
        for (int i = 0; i < 20; i++)
        {
            Shortcuts[i] = GetKeyCode(ini, section, string.Format("Shortcut_{0}", i), Shortcuts[i]);
        }
    }
コード例 #5
0
 public static void SetKeyCode(ExIni.IniFile ini, string section, string key, KeyCode keyCode)
 {
     ini[section][key].Value = KeyCodeToString(keyCode);
 }