private void Form1_Load(object sender, EventArgs e) { KcptunClientConfig config; config = KcptunClientConfig.LoadFromFile(KcptunClientConfig.DefaultFileName); if (config != null) { this.textboxProgram.Text = config.ExecutableFile; this.textboxServer.Text = config.ServerAddress; this.textboxRemotePort.Text = config.ServerPort; this.textboxLocalPort.Text = config.LocalPort; this.textboxKey.Text = config.Key; } this.toolStripProgressBar1.Visible = false; this.RefreshGuiTextStatus(); this.monitorTimer.Interval = 3 * 1000; this.monitorTimer.Start(); if (!File.Exists(this.textboxProgram.Text)) { this.PopupDownloadKcptunDialog(); } UpdateTextBoxCommandArguments(null, null); this.textboxServer.TextChanged += UpdateTextBoxCommandArguments; this.textboxRemotePort.TextChanged += UpdateTextBoxCommandArguments; this.textboxLocalPort.TextChanged += UpdateTextBoxCommandArguments; this.textboxKey.TextChanged += UpdateTextBoxCommandArguments; }
private KcptunClientConfig LoadConfiguration() { try { return(KcptunClientConfig.LoadFromFile(KcptunClientConfig.DefaultFileName)); } catch (IOException ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } return(null); }