private void btnWriteData_Click(object sender, EventArgs e)//Write { iniFile.WriteValue("MachineName", "Name", txtMachineName.Text.Trim()); iniFile.WriteValue("ReportPath", "Path", txtReportFolder.Text.Trim()); iniFile.WriteValue("SFCPath", "Path", txtSFCFolder.Text.Trim()); iniFile.WriteValue("DataPath", "Path", txtDataFolder.Text.Trim()); iniFile.WriteValue("ImagePath", "Path", txtImageFolder.Text.Trim()); iniFile.WriteValue("ScreenPath", "Path", txtImageShotFolder.Text.Trim()); iniFile.WriteValue("ProgramPath", "Path", txtProgramPath.Text.Trim()); MessageBox.Show("写入成功!"); }
public static GClsConfigFile configFile; //定义配置文件 public static string ReadConfig(string FileName, string label, string name, String defultVal) //读配置文件 { string ret; configFile = new GClsConfigFile(Application.StartupPath + "/Config/" + FileName); ret = configFile.GetString(label, name, defultVal); if (ret == defultVal) { configFile.WriteValue(label, name, defultVal); } return(ret); }
public static void WriteConfig(string FileName, string label, string name, String defultVal) //写配置文件 { configFile = new GClsConfigFile(Application.StartupPath + "/Config/" + FileName); configFile.WriteValue(label, name, defultVal); }