/// <summary> /// 加载配置 /// </summary> private void LoadConfig() { if (!File.Exists(DefaultIniPath)) { return; } config.ArgbYellowCard = Convert.ToInt32(INIComm.IniReadValue("CardColorArgb", "Yellow", DefaultIniPath)); config.ArgbBlueCard = Convert.ToInt32(INIComm.IniReadValue("CardColorArgb", "Blue", DefaultIniPath)); config.ArgbRedCard = Convert.ToInt32(INIComm.IniReadValue("CardColorArgb", "Red", DefaultIniPath)); config.KeyYellow = Convert.ToInt32(INIComm.IniReadValue("CardKey", "Yellow", DefaultIniPath)); config.KeyBlue = Convert.ToInt32(INIComm.IniReadValue("CardKey", "Blue", DefaultIniPath)); config.KeyRed = Convert.ToInt32(INIComm.IniReadValue("CardKey", "Red", DefaultIniPath)); config.CardPositionX = Convert.ToInt32(INIComm.IniReadValue("CardPosition", "X", DefaultIniPath)); config.CardPositionY = Convert.ToInt32(INIComm.IniReadValue("CardPosition", "Y", DefaultIniPath)); config.KeyBlank = Convert.ToInt32(INIComm.IniReadValue("Frequency", "KeyBlank", DefaultIniPath)); config.TimeOut = Convert.ToInt32(INIComm.IniReadValue("Frequency", "TimeOut", DefaultIniPath)); config.RAutoYellowCard = Convert.ToBoolean(INIComm.IniReadValue("Function", "RAutoYellowCard", DefaultIniPath)); gb_Settings.BeginInvoke((Action) delegate { tb_Yellow.Text = ((Keys)config.KeyYellow).ToString(); tb_Blue.Text = ((Keys)config.KeyBlue).ToString(); tb_Red.Text = ((Keys)config.KeyRed).ToString(); lb_Color_Y.BackColor = Color.FromArgb(config.ArgbYellowCard); lb_Color_B.BackColor = Color.FromArgb(config.ArgbBlueCard); lb_Color_R.BackColor = Color.FromArgb(config.ArgbRedCard); tb_CardPosX.Text = config.CardPositionX.ToString(); tb_CardPosY.Text = config.CardPositionY.ToString(); tb_KeyDownDelay.Text = config.KeyBlank.ToString(); tb_getCardTimeOut.Text = config.TimeOut.ToString(); cb_rAutoYellow.Checked = config.RAutoYellowCard; }); }
private void WriteIni(string section, string key, string value) { INIComm.IniWrite(section, key, value, DefaultIniPath); LoadConfig(); }