Beispiel #1
0
        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);
        }
Beispiel #2
0
        public bool SavePara(string _path, string _ip)
        {
            bool res = true;

            try
            {
                string sPath = System.Reflection.Assembly.GetAssembly(this.GetType()).Location;
                folderPath = Path.GetDirectoryName(sPath);
                //char delimiterChars = '\\';
                //string[] words = sPath.Split(delimiterChars);

                //for (int i = 0; i < words.Length - 1; i++)
                //{
                //    folderPath = folderPath + words[i] + "\\";
                //}
                //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", _ip);
                }
            }
            catch (Exception ex)
            {
                res = false;
            }

            return(res);
        }