Exemple #1
0
    void SetParaToFile()
    {
        if (!File.Exists(folderPath + "\\" + filename))
        {
            File.Create(folderPath + "\\" + filename);
        }

        //save para.
        using (ExecuteIniClass IniFile = new ExecuteIniClass(Path.Combine(folderPath, filename)))
        {
            IniFile.setKeyValue("Dev", "IP", textBox1.Text);
            IniFile.setKeyValue("Dev", "Cloud", txtCloudIp.Text);
        }
    }
Exemple #2
0
    void GetParaFromFile()
    {
        string sPath          = System.Reflection.Assembly.GetAssembly(this.GetType()).Location;
        char   delimiterChars = '\\';

        string[] words = sPath.Split(delimiterChars);
        folderPath = "";
        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)))
            {
                textBox1.Text   = IniFile.getKeyValue("Dev", "IP");
                txtCloudIp.Text = IniFile.getKeyValue("Dev", "Cloud");
            }
        }
    }