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);
    }
 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]);
     }
 }
 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);
 }
    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]);
        }
    }
 public static void SetKeyCode(ExIni.IniFile ini, string section, string key, KeyCode keyCode)
 {
     ini[section][key].Value = KeyCodeToString(keyCode);
 }