Exemplo n.º 1
0
        public frmMain()
        {
            InitializeComponent();


            if (File.Exists(configFilePath))
            {
                string ip       = IniHelper.Read(defaultConfigSection, "ip", defaultIp, configFilePath);
                string user     = IniHelper.Read(defaultConfigSection, "user", defaultUser, configFilePath);
                string password = IniHelper.Read(defaultConfigSection, "password", defaultPassword, configFilePath);
                txtIp.Text       = ip;
                txtUser.Text     = user;
                txtPassword.Text = password;
            }
            else
            {
                IniHelper.Write(defaultConfigSection, "ip", defaultIp, configFilePath);
                IniHelper.Write(defaultConfigSection, "user", defaultUser, configFilePath);
                IniHelper.Write(defaultConfigSection, "password", defaultPassword, configFilePath);
                txtIp.Text       = defaultIp;
                txtUser.Text     = defaultUser;
                txtPassword.Text = defaultPassword;
            }
            this.progressBar.Visible = false;
        }
Exemplo n.º 2
0
        private void saveConfig()
        {
            string ip       = txtIp.Text;
            string user     = txtUser.Text;
            string password = txtPassword.Text;

            IniHelper.Write(defaultConfigSection, "ip", ip, configFilePath);
            IniHelper.Write(defaultConfigSection, "user", user, configFilePath);
            IniHelper.Write(defaultConfigSection, "password", password, configFilePath);
        }