private void setdefaultUserInfo() { string version = Application.ProductVersion; INIOperater INIOper = new INIOperater(Application.StartupPath + "\\"); if (INIOper.isFileExists()) { if (version != INIOper.GetKey("infomation", "version")) { File.Delete(Application.StartupPath + "\\" + "config.ini"); return; } UserId.Text = INIOper.GetKey("user", "atmfuser"); //GGPassword.Text = INIOper.GetKey("user", "ggpass"); GGuserId.Text = INIOper.GetKey("user", "gguserid"); savePath = INIOper.GetKey("export", "path"); SavePathViewBox.Text = savePath = savePath == "" ? "d:\\" : savePath; string keyt = INIOper.GetKey("user", "keyt"); //******************************************************** if (keyt == "" | keyt == null) { return; } EncryptClass e = new EncryptClass(); UnEncryptRES UERes = e.UnEncryptProcess(keyt); if (UERes.Success) { GGPassword.Text = UERes.Value.Replace(GGuserId.Text + " ", ""); } else { MessageBox.Show(UERes.Message); } } }
private void UpdateDataStruct(string ConfigPath) { INIOperater INIOper = new INIOperater(ConfigPath); if (INIOper.isFileExists()) { FieldInfo[] finfoes = AStruct.GetType().GetFields(); foreach (FieldInfo finfo in finfoes) { string tem = INIOper.GetKey("ATMDataPosition", finfo.Name); if (tem != "") { try { int tempNum = int.Parse(tem.Trim()); finfo.SetValue(AStruct, tempNum); } catch (Exception) { continue; } } else { INIOper.WriteKey("ATMDataPosition", finfo.Name, finfo.GetValue(AStruct).ToString()); } } FieldInfo[] finfies1 = GGStruct.GetType().GetFields(); foreach (FieldInfo finfo in finfies1) { string tem = INIOper.GetKey("GGWOWMDataPosition", finfo.Name); if (tem != "") { try { int tempNum = int.Parse(tem.Trim()); finfo.SetValue(GGStruct, tempNum); } catch (Exception) { continue; } } else { INIOper.WriteKey("GGWOWMDataPosition", finfo.Name, finfo.GetValue(GGStruct).ToString()); } } } }