예제 #1
0
 private void accessKeySecret_Leave(object sender, EventArgs e)
 {
     cfg.SaveAppSetting("AccessKeySecret", EncryptHelper.AESEncrypt(this.textBox_accessKeySecret.Text.ToString()));
     textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "accessKeySecret已经保存,请完成设置录入后点击测试连接!" + "\r\n");
 }
예제 #2
0
        /// <summary>
        /// 读取配置文件并初始化控件
        /// </summary>
        /// <returns></returns>
        private bool readConfigFile()
        {
            try
            {
                textBox_accessKeyId.Text     = EncryptHelper.AESDecrypt(cfg.GetAppSetting("AccessKeyID").ToString());
                textBox_accessKeySecret.Text = EncryptHelper.AESDecrypt(cfg.GetAppSetting("AccessKeySecret").ToString());
                textBox_recordId.Text        = cfg.GetAppSetting("RecordID").ToString();
                fullDomainName.Text          = cfg.GetAppSetting("fullDomainName").ToString();
                label_nextUpdateSeconds.Text = textBox_newSeconds.Text = cfg.GetAppSetting("WaitingTime").ToString();
                if (cfg.GetAppSetting("autoUpdate").ToString() == "On")
                {
                    checkBox_autoUpdate.Checked = true;
                }
                else
                {
                    checkBox_autoUpdate.Checked = false;
                }
                if (cfg.GetAppSetting("whatIsUrl").ToString() != null)
                {
                    string[] arrayUrl = cfg.GetAppSetting("whatIsUrl").ToString().Split(',');
                    foreach (string strUrl in arrayUrl)
                    {
                        comboBox_whatIsUrl.Items.Add(strUrl.ToString().Trim());
                    }
                    comboBox_whatIsUrl.SelectedIndex = 0;
                }

                if (cfg.GetAppSetting("autoBoot").ToString() == "On")
                {
                    checkBox_autoBoot.Checked = true;
                }
                else
                {
                    checkBox_autoBoot.Checked = false;
                }

                if (cfg.GetAppSetting("minimized").ToString() == "On")
                {
                    checkBox_minimized.Checked = true;
                }
                else
                {
                    checkBox_minimized.Checked = false;
                }

                if (cfg.GetAppSetting("logautosave").ToString() == "On")
                {
                    checkBox_logAutoSave.Checked = true;
                }
                else
                {
                    checkBox_logAutoSave.Checked = false;
                }

                textBox_TTL.Text = cfg.GetAppSetting("TTL").ToString();

                if (cfg.GetAppSetting("autoCheckUpdate").ToString() == "On")
                {
                    checkUpdate = true;
                }
                else
                {
                    checkUpdate = false;
                }

                if (cfg.GetAppSetting("ngrokauto").ToString() == "On")
                {
                    checkBox_ngrok.Checked = true;
                    button_ngrok.Enabled   = false;
                }
                else
                {
                    checkBox_ngrok.Checked = false;
                    button_ngrok.Enabled   = true;
                }
                textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "设置文件读取成功!" + "\r\n");
                return(true);
            }
            catch (Exception error)
            {
                textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "运行出错!信息: " + error + "\r\n");
                return(false);
            }
        }