-
Notifications
You must be signed in to change notification settings - Fork 2
/
ConnectDialog.cs
100 lines (96 loc) · 2.64 KB
/
ConnectDialog.cs
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
using System;
using System.Windows.Forms;
namespace CollabClient
{
public partial class ConnectDialog : Form
{
public ConnectDialog()
{
InitializeComponent();
Console.Title = "CollabVM .NET Client - Console";
}
private void Cb_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cb.SelectedIndex + 1)
{
case 1:
textBox.Text = "computernewb.com:443/collab-vm/vm1";
textBox2.Text = "vm1";
checksecure.Checked = true;
break;
case 2:
textBox.Text = "computernewb.com:443/collab-vm/vm2";
textBox2.Text = "vm2";
checksecure.Checked = true;
break;
case 3:
textBox.Text = "computernewb.com:443/collab-vm/vm3";
textBox2.Text = "vm3";
checksecure.Checked = true;
break;
case 4:
textBox.Text = "computernewb.com:443/collab-vm/vm4";
textBox2.Text = "vm4";
checksecure.Checked = true;
break;
case 5:
textBox.Text = "computernewb.com:443/collab-vm/vm5";
textBox2.Text = "vm5";
checksecure.Checked = true;
break;
case 6:
textBox.Text = "computernewb.com:443/collab-vm/vm6";
textBox2.Text = "vm6";
checksecure.Checked = true;
break;
case 7:
textBox.Text = "computernewb.com:443/collab-vm/vm7";
textBox2.Text = "vm7";
checksecure.Checked = true;
break;
case 8:
textBox.Text = "computernewb.com:443/collab-vm/vm8";
textBox2.Text = "vm8";
checksecure.Checked = true;
break;
case 9:
textBox.Text = "computernewb.com:443/collab-vm/vm0";
textBox2.Text = "vm0b0t";
checksecure.Checked = true;
break;
}
}
private void OkButton_Click(object sender, EventArgs e)
{
Globals.vmip = textBox.Text;
Globals.vmname = textBox2.Text;
Globals.vmusername = textBox3.Text;
Globals.isSecure = checksecure.Checked;
Hide();
new Form1().Show();
}
private void CancelButton_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void SecureCheck_Click(object sender, EventArgs e)
{
try {
string[] seperators = { ":6004", ":443" }; // Thought it was gonna be :80 huh?
string[] swapPorts = textBox.Text.Split(seperators, System.StringSplitOptions.RemoveEmptyEntries);
if (checksecure.Checked)
{
textBox.Text = ($"{swapPorts[0]}:443{swapPorts[1]}");
}
else
{
textBox.Text = ($"{swapPorts[0]}:6004{swapPorts[1]}");
}
}
catch(Exception err)
{
Console.WriteLine($"{err.Message}\n\tCannot convert a non-6004 IP to 443 or vice-versa.");
}
}
}
}