Beispiel #1
0
        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);
        }
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);
        }
Beispiel #3
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 #4
0
        public string GetPara(string _path)
        {
            string resPath = "", 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)))
                {
                    resPath = IniFile.getKeyValue("Dev", "IP");
                }
            }

            return(resPath);
        }