-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneralSettingsControl.cs
More file actions
121 lines (103 loc) · 4.11 KB
/
Copy pathGeneralSettingsControl.cs
File metadata and controls
121 lines (103 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using SwitchConfigGenerator.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SwitchConfigGenerator
{
public partial class GeneralSettingsControl : UserControl
{
public GeneralSettingsControl()
{
InitializeComponent();
}
private void txtHostname_TextChanged(object sender, EventArgs e)
{
Variables.hostname = txtHostname.Text;
}
private void txtDomainName_TextChanged(object sender, EventArgs e)
{
Variables.domainname = txtDomainName.Text;
}
private void txtUname_TextChanged(object sender, EventArgs e)
{
Variables.username = txtUname.Text;
}
private void txtPasswd_TextChanged(object sender, EventArgs e)
{
Variables.password = txtPasswd.Text;
}
private void txtVtyStart_TextChanged(object sender, EventArgs e)
{
Variables.vtyStart = int.TryParse(txtVtyStart.Text, out int start) ? start : 0;
}
private void txtVtyEnd_TextChanged(object sender, EventArgs e)
{
Variables.vtyEnd = int.TryParse(txtVtyEnd.Text, out int end) ? end : 15;
}
private void txtRsaSize_TextChanged(object sender, EventArgs e)
{
Variables.rsaSize = int.TryParse(txtRsaSize.Text, out int size) ? size : 2048;
}
private void txtTimeoutMin_TextChanged(object sender, EventArgs e)
{
Variables.timeoutMinutes = int.TryParse(txtTimeoutMin.Text, out int minutes) ? minutes : 10;
}
private void txtTimeoutSec_TextChanged(object sender, EventArgs e)
{
Variables.timeoutSeconds = int.TryParse(txtTimeoutSec.Text, out int seconds) ? seconds : 0;
}
private void chkEnableAAA_CheckedChanged(object sender, EventArgs e)
{
Variables.AAAEnabled = chkEnableAAA.Checked;
}
private void chkEnableSSH_CheckedChanged(object sender, EventArgs e)
{
Variables.SSHEnabled = chkEnableSSH.Checked;
}
private void chkEnableTelnet_CheckedChanged(object sender, EventArgs e)
{
Variables.TelnetEnabled = chkEnableTelnet.Checked;
}
private void GeneralSettingsControl_Load(object sender, EventArgs e)
{
txtHostname.Text = Variables.hostname ?? "";
txtDomainName.Text = Variables.domainname ?? "";
txtUname.Text = Variables.username ?? "";
txtPasswd.Text = Variables.password ?? "";
txtVtyStart.Text = Variables.vtyStart.ToString();
txtVtyEnd.Text = Variables.vtyEnd.ToString();
txtRsaSize.Text = Variables.rsaSize.ToString();
txtTimeoutMin.Text = Variables.timeoutMinutes.ToString();
txtTimeoutSec.Text = Variables.timeoutSeconds.ToString();
chkEnableAAA.Checked = Variables.AAAEnabled;
chkEnableSSH.Checked = Variables.SSHEnabled;
chkEnableTelnet.Checked = Variables.TelnetEnabled;
txtBanner.Text = Variables.banner;
btnDomainLookup.Checked = Variables.domainLookup ?? false;
chkConsoleLogging.Checked = Variables.loggingConsole ?? false;
cmbSynchronousLogging.Checked = Variables.loggingSynchronous ?? false;
}
private void txtBanner_TextChanged(object sender, EventArgs e)
{
Variables.banner = txtBanner.Text;
}
private void btnDomainLookup_CheckedChanged(object sender, EventArgs e)
{
Variables.domainLookup = btnDomainLookup.Checked;
}
private void chkConsoleLogging_CheckedChanged(object sender, EventArgs e)
{
Variables.loggingConsole = chkConsoleLogging.Checked;
}
private void cmbSynchronousLogging_CheckedChanged(object sender, EventArgs e)
{
Variables.loggingSynchronous = cmbSynchronousLogging.Checked;
}
}
}