Skip to content

Commit

Permalink
manual-merge branch 'master' into 800x600
Browse files Browse the repository at this point in the history
because it's been cherrypicked for a while and it's DUUMB WY DIDN'T I JUST REBASE THIS EVERY TIME I DESPISE ITTTT
  • Loading branch information
yellows111 committed Jan 5, 2024
1 parent d48ae48 commit ae905fd
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 16 deletions.
18 changes: 9 additions & 9 deletions ConnectDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,55 @@ private void Cb_SelectedIndexChanged(object sender, EventArgs e)
switch (cb.SelectedIndex + 1)
{
case 1:
textBox.Text = "computernewb.com:443/collab-vm/vm1";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm1";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 2:
textBox.Text = "computernewb.com:443/collab-vm/vm2";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm2";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 3:
textBox.Text = "computernewb.com:443/collab-vm/vm3";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm3";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 4:
textBox.Text = "computernewb.com:443/collab-vm/vm4";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm4";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 5:
textBox.Text = "computernewb.com:443/collab-vm/vm5";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm5";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 6:
textBox.Text = "computernewb.com:443/collab-vm/vm6";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm6";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 7:
textBox.Text = "computernewb.com:443/collab-vm/vm7";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm7";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 8:
textBox.Text = "computernewb.com:443/collab-vm/vm8";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm8";
checksecure.Checked = true;
checkcompression.Checked = true;
break;
case 9:
textBox.Text = "computernewb.com:443/collab-vm/vm0";
textBox.Text = "computernewb.com:443/collab-vm/mainvms";
textBox2.Text = "vm0b0t";
checksecure.Checked = true;
checkcompression.Checked = true;
Expand Down
1 change: 1 addition & 0 deletions Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal class Globals
public static bool isSecure = false;
public static bool isCompressed = true;
public static bool autoReconnect = false;
public static bool disableTurnMessages = false;
public static ushort GetKeycodeByName(System.Windows.Forms.KeyEventArgs Keyevent, ushort fallback) {
System.Windows.Forms.Keys Keyname = Keyevent.KeyCode;
string keystring = Keyname.ToString();
Expand Down
57 changes: 50 additions & 7 deletions __Form1_800x600.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Form1()
}

private bool pbfocus;
private long pboxRefresh = 1000;
//private long pboxRefresh = 33;
private WebSocket socket;
private Graphics g;
private readonly System.Media.SoundPlayer notify = new System.Media.SoundPlayer(Properties.Resources.notify);
Expand Down Expand Up @@ -99,10 +99,11 @@ private void Form1_Load(object sender, EventArgs e)
pictureBox1.Image = new Bitmap(1024, 768);
g = Graphics.FromImage(pictureBox1.Image);
Text = "CollabVM .NET Client: " + Globals.vmip + "#" + Globals.vmname;
string wsprefix = Globals.isSecure ? "wss" : "ws";
socket = new WebSocket(wsprefix+"://" + Globals.vmip, "guacamole") {Origin = "http://" + Globals.vmip.Split(':')[0]};
string protoPrefix = Globals.isSecure ? "s" : "";
socket = new WebSocket("ws"+protoPrefix+"://" + Globals.vmip, "guacamole") {Origin = "http"+protoPrefix+"://" + Globals.vmip.Split(':')[0]};
if (Globals.isSecure){
socket.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;
//socket.SslConfiguration.EnabledSslProtocols = (System.Security.Authentication.SslProtocols)0x00003000;
}
socket.OnClose += Socket_OnClose;
socket.OnOpen += Socket_OnOpen;
Expand Down Expand Up @@ -302,14 +303,15 @@ private void Socket_OnMessage(object sender, MessageEventArgs e)
ms.Dispose();
//pictureBox1.Invalidate(new Rectangle(point, img.Size));
//pictureBox1.Invoke((Action)(() => pictureBox1.Update()));
if (pboxRefresh < DateTime.UtcNow.Ticks)
/*if (pboxRefresh < DateTime.UtcNow.Ticks)
{
Invoke((MethodInvoker) delegate { pictureBox1.Refresh(); });
pboxRefresh =
DateTime.UtcNow.Ticks +
TimeSpan.FromMilliseconds(1000 / 60)
.Ticks; //limit fps so we won't unnecessarily draw more than x fps and waste cpu
}
}*/
Invoke((MethodInvoker) delegate { pictureBox1.Refresh(); });

//pictureBox1.Update();
//img?.Dispose();
Expand Down Expand Up @@ -506,7 +508,7 @@ user arg[2] is now arg[3]
turntime = 1;
}

if (args.Length > 3 && args[3] != username)
if (args.Length > 3 && args[3] != username && Globals.disableTurnMessages == false)
{
hasTurn = false;
LogChat($">{args[3]} now has the turn.");
Expand All @@ -515,7 +517,13 @@ user arg[2] is now arg[3]
if (args.Length > 2 && args[2] != "0")
{
hasTurn = args[3] == username;
var ms = int.Parse(args[1]);
int ms = 0;
try {
ms = int.Parse(args[1]);
}
catch(Exception err) {
Console.WriteLine("{0}: [{1}]", err.Message, string.Join(", ", args));
}
/*
turn | 17999 | 1 | DotNetClient
turn | 3350 | 2 | DotNetClient | kubapolish
Expand Down Expand Up @@ -629,6 +637,9 @@ private void Socket_OnClose(object sender, CloseEventArgs e)
}
else
{
g.FillRectangle(new SolidBrush(Color.Black),0,0,pictureBox1.Width,pictureBox1.Height);
pictureBox1.Refresh();

if (Globals.autoReconnect == true)
{
LogChat(">You have been disconnected.");
Expand Down Expand Up @@ -800,13 +811,45 @@ private void TextBox1_KeyDown(object sender, KeyEventArgs e)
LogChat(">Auto-reconnect disabled.");
Globals.autoReconnect = false;
break;
}
case "!turnmsg off":
{
LogChat(">No longer suppressing turn messages.");
Globals.disableTurnMessages = false;
break;
}
case "!turnmsg on":
{
LogChat(">Suppressing turn messages.");
Globals.disableTurnMessages = true;
break;
}
case "!tab":
{
Send("key", 0xff09, 1);
Send("key", 0xff09, 0);
break;
}
case "!cad":
{
Send("key", 0xffe3, 1);
Send("key", 0xffe9, 1);
Send("key", 0xffff, 1);
Send("key", 0xffe3, 0);
Send("key", 0xffe9, 0);
Send("key", 0xffff, 0);
break;
}
case "!taskmgr":
{
Send("key", 0xffe3, 1);
Send("key", 0xffe1, 1);
Send("key", 0xff1b, 1);
Send("key", 0xffe3, 0);
Send("key", 0xffe1, 0);
Send("key", 0xff1b, 0);
break;
}
case "!refresh":
{
Invoke((MethodInvoker) delegate { pictureBox1.Refresh(); });
Expand Down

0 comments on commit ae905fd

Please sign in to comment.