public IniDataFmt GetGropPara(string _path) { IniDataFmt data = new IniDataFmt() { IP = "", Path = "", Browser = "" }; folderPath = ""; string sPath = System.Reflection.Assembly.GetAssembly(this.GetType()).Location; char delimiterChars = '\\'; string[] words = sPath.Split(delimiterChars); for (int i = 0; i < words.Length - 1; i++) { folderPath = folderPath + words[i] + "\\"; } if (File.Exists(folderPath + "\\" + filename)) { using (ExecuteIniClass IniFile = new ExecuteIniClass(Path.Combine(folderPath, filename))) { data.IP = IniFile.getKeyValue("Dev", "IP"); data.Path = IniFile.getKeyValue("Dev", "Path"); data.Browser = IniFile.getKeyValue("Dev", "Browser"); } } return(data); }
public bool SaveGropPara(string _path, IniDataFmt _obj) { bool res = true; try { //string sPath = System.Reflection.Assembly.GetAssembly(this.GetType()).Location; //create new if (!File.Exists(folderPath + "\\" + filename)) { File.Create(folderPath + "\\" + filename); } //save para. using (ExecuteIniClass IniFile = new ExecuteIniClass(Path.Combine(folderPath, filename))) { IniFile.setKeyValue("Dev", "IP", _obj.IP); IniFile.setKeyValue("Dev", "Path", _obj.Path); IniFile.setKeyValue("Dev", "Browser", _obj.Browser); } } catch (Exception ex) { res = false; } return(res); }