public static string IniReadValue(string Section, string Key) { StringBuilder stringBuilder = new StringBuilder(500); int privateProfileString = DealINI.GetPrivateProfileString(Section, Key, "", stringBuilder, 500, _inipath); return(stringBuilder.ToString()); }
/// <summary> /// get rfid constants from config file /// </summary> private void InitRFIDConstants() { try { dic_customer_RFID_constants.Clear(); string valid_cusomers = DealINI.IniReadValue("CUSTOMERS", "valid_customer"); string[] customers = valid_cusomers.Split('|'); foreach (string item in customers) { string mfg_country = DealINI.IniReadValue(item, "mfg_country"); string mfg_name = DealINI.IniReadValue(item, "mfg_name"); string iec_date = DealINI.IniReadValue(item, "iec_date"); string iec_verfy = DealINI.IniReadValue(item, "iec_verfy"); string iso = DealINI.IniReadValue(item, "iso"); string producttype = DealINI.IniReadValue(item, "producttype"); RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype); dic_customer_RFID_constants.Add(item, rfidConstant); } } catch (Exception) { MessageBox.Show("解析配置文件出错,请检查配置文件!!!"); } }
/// <summary> /// get rfid constants from config file /// </summary> private void InitRFIDConstants() { try { dic_customer_RFID_constants.Clear(); string valid_cusomers = DealINI.IniReadValue("CUSTOMERS", "valid_customer"); string[] customers = valid_cusomers.Split('|'); foreach (string item in customers) { string mfg_country = DealINI.IniReadValue(item, "mfg_country"); string mfg_name = DealINI.IniReadValue(item, "mfg_name"); string iec_date = DealINI.IniReadValue(item, "iec_date"); string iec_verfy = DealINI.IniReadValue(item, "iec_verfy"); string iso = DealINI.IniReadValue(item, "iso"); string producttype = DealINI.IniReadValue(item, "producttype"); string cell_mfg = DealINI.IniReadValue(item, "cell_mfg"); string cellsource_country = DealINI.IniReadValue(item, "cellsource_country"); string polarity_of_terminal = DealINI.IniReadValue(item, "polarity_of_terminal"); string iso9000_date = DealINI.IniReadValue(item, "iso9000_date"); string iso9000_name = DealINI.IniReadValue(item, "iso9000_name"); string iso14000_date = DealINI.IniReadValue(item, "iso14000_date"); string iso14000_name = DealINI.IniReadValue(item, "iso14000_name"); string max_sys_vol = DealINI.IniReadValue(item, "max_sys_vol"); string cell_mfg_date = DealINI.IniReadValue(item, "cell_mfg_date"); RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype, iso9000_name, iso9000_date, iso14000_name, iso14000_date, cellsource_country, polarity_of_terminal, max_sys_vol, cell_mfg, cell_mfg_date); dic_customer_RFID_constants.Add(item, rfidConstant); } } catch (Exception) { MessageBox.Show("解析配置文件出错,请检查配置文件!!!"); } }
private void btn_register_Click(object sender, EventArgs e) { if (tbx_md5code.Text.Trim() == "") { MessageBox.Show("product key can't be empty!"); return; } if (MD5Handler.verifyMd5Hash(tbx_md5code.Text)) { m_bLicensed = true; DealINI.IniWriteValue("SETTING", "LICENSE", tbx_md5code.Text); groupBox1.Visible = !m_bLicensed; label3.Visible = m_bLicensed; HFDesk._licensedPorduct = true; } else { MessageBox.Show("product key is not correct!"); } }
private void ReadIni() { _license = DealINI.IniReadValue("SETTING", "LICENSE"); _server = DealINI.IniReadValue("SETTING", "SERVER"); }
/// <summary> /// get rfid constants from config file /// </summary> private void InitRFIDConstants() { try { dic_customer_RFID_constants.Clear(); string valid_cusomers = DealINI.IniReadValue("CUSTOMERS", "valid_customer"); string valid_cusomer_displayname = DealINI.IniReadValue("CUSTOMERS", "customer_displayname"); string[] customers = valid_cusomers.Split('|'); string[] customer_displayname = valid_cusomer_displayname.Split('|'); IList <CustomerInfo> infoList = new List <CustomerInfo>(); //if (customers.Count()>0) //{ // cbx_customer.DataSource = //} for (int i = 0; i < customers.Length; i++) { CustomerInfo customerinfo = new CustomerInfo() { Id = customers[i], Name = customer_displayname[i] }; infoList.Add(customerinfo); string mfg_country = DealINI.IniReadValue(customers[i], "mfg_country"); string mfg_name = DealINI.IniReadValue(customers[i], "mfg_name"); string iec_date = DealINI.IniReadValue(customers[i], "iec_date"); string iec_verfy = DealINI.IniReadValue(customers[i], "iec_verfy"); string iso = DealINI.IniReadValue(customers[i], "iso"); string producttype = DealINI.IniReadValue(customers[i], "producttype"); string cell_mfg = DealINI.IniReadValue(customers[i], "cell_mfg"); string cellsource_country = DealINI.IniReadValue(customers[i], "cellsource_country"); string polarity_of_terminal = DealINI.IniReadValue(customers[i], "polarity_of_terminal"); string iso9000_date = DealINI.IniReadValue(customers[i], "iso9000_date"); string iso9000_name = DealINI.IniReadValue(customers[i], "iso9000_name"); string iso14000_date = DealINI.IniReadValue(customers[i], "iso14000_date"); string iso14000_name = DealINI.IniReadValue(customers[i], "iso14000_name"); string max_sys_vol = DealINI.IniReadValue(customers[i], "max_sys_vol"); string cell_mfg_date = DealINI.IniReadValue(customers[i], "cell_mfg_date"); RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype, iso9000_name, iso9000_date, iso14000_name, iso14000_date, cellsource_country, polarity_of_terminal, max_sys_vol, cell_mfg, cell_mfg_date); dic_customer_RFID_constants.Add(customers[i], rfidConstant); } if (infoList.Count > 0) { cbx_customer.DataSource = infoList; cbx_customer.ValueMember = "Id"; cbx_customer.DisplayMember = "Name"; } } catch (Exception) { MessageBox.Show("解析配置文件出错,请检查配置文件!!!"); } }
/// <summary> /// get rfid constants from config file /// </summary> private void InitRFIDConstants() { try { //判断是否读取 add by xue lei on 2018-9-11 string isRead = DealINI.IniReadValue("Read", "read"); cbxisRead.Checked = isRead == "true"?true:false; //获取间隔时间 List <string> TimeList = new List <string>(); string[] aryTime = DealINI.IniReadValue("READTIME", "time").ToString().Split('|'); foreach (var a in aryTime) { TimeList.Add(a); } ddlinternalTime.DataSource = TimeList; dic_customer_RFID_constants.Clear(); string valid_cusomers = DealINI.IniReadValue("CUSTOMERS", "valid_customer"); string valid_cusomer_displayname = DealINI.IniReadValue("CUSTOMERS", "customer_displayname"); string[] customers = valid_cusomers.Split('|'); string[] customer_displayname = valid_cusomer_displayname.Split('|'); IList <CustomerInfo> infoList = new List <CustomerInfo>(); //if (customers.Count()>0) //{ // cbx_customer.DataSource = //} for (int i = 0; i < customers.Length; i++) { CustomerInfo customerinfo = new CustomerInfo() { Id = customers[i], Name = customer_displayname[i] }; infoList.Add(customerinfo); string mfg_country = DealINI.IniReadValue(customers[i], "mfg_country"); string mfg_name = DealINI.IniReadValue(customers[i], "mfg_name"); string iec_date = DealINI.IniReadValue(customers[i], "iec_date"); string iec_verfy = DealINI.IniReadValue(customers[i], "iec_verfy"); string iso = DealINI.IniReadValue(customers[i], "iso"); string producttype = DealINI.IniReadValue(customers[i], "producttype"); RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype); dic_customer_RFID_constants.Add(customers[i], rfidConstant); } if (infoList.Count > 0) { cbx_customer.DataSource = infoList; cbx_customer.ValueMember = "Id"; cbx_customer.DisplayMember = "Name"; } } catch (Exception) { MessageBox.Show("解析配置文件出错,请检查配置文件!!!"); } }
//public DealINI(string INIPath) //{ // this.inipath = INIPath; //} //public DealINI() //{ // this.inipath = ""; //} public static void IniWriteValue(string Section, string Key, string Value) { DealINI.WritePrivateProfileString(Section, Key, Value, _inipath); }