Code: Select all
private void Save_Click(object sender, EventArgs e){
try
{
var cfg = new ConfigParser(configpath);
cfg.SetValue("GAMEPROFILE", "key1", ForwardKey);
cfg.SetValue("GAMEPROFILE", "key2", BackwardKey);
cfg.SetValue("GAMEPROFILE", "key3", LeftKey);
cfg.SetValue("GAMEPROFILE", "key4", RightKey);
cfg.SetValue("GAMEPROFILE", "key5", JumpKey);
cfg.SetValue("GAMEPROFILE", "key6", CrouchKey);
cfg.SetValue("GAMEPROFILE", "key7", UseKey);
cfg.SetValue("GAMEPROFILE", "key8", ReloadKey);
cfg.SetValue("GAMEPROFILE", "key9", PeekLeftKey);
cfg.SetValue("GAMEPROFILE", "key10", PeekRightKey);
cfg.SetValue("GAMEDEBUG", "height", Height);
cfg.SetValue("GAMEDEBUG", "width", Width);
cfg.Save();
MessageBox.Show("Settings saved to: " + configpath);
}
catch (Exception ex)
{
MessageBox.Show("Error saving settings: " + ex.Message);
}