diff --git a/CollabVMSharp/CollabVMClient.cs b/CollabVMSharp/CollabVMClient.cs index 92a1182..a0467e4 100644 --- a/CollabVMSharp/CollabVMClient.cs +++ b/CollabVMSharp/CollabVMClient.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using System.Net; using System.Net.WebSockets; +using System.Numerics; using System.Security.Authentication; using System.Text; using System.Text.RegularExpressions; @@ -65,6 +66,7 @@ public class CollabVMClient { public event EventHandler NodeConnectFailed; public event EventHandler ConnectionFailed; public event EventHandler Rect; + public event EventHandler ScreenSize; public event EventHandler Renamed; public event EventHandler UserRenamed; public event EventHandler UserJoined; @@ -132,6 +134,7 @@ public class CollabVMClient { NodeConnectFailed += delegate { }; ConnectionFailed += delegate { }; Rect += delegate { }; + ScreenSize += delegate { }; Renamed += delegate { }; UserRenamed += delegate { }; UserJoined += delegate { }; @@ -262,7 +265,10 @@ public class CollabVMClient { } case "size": { if (msgArr[1] != "0") return; - this.framebuffer = new Image(int.Parse(msgArr[2]), int.Parse(msgArr[3])); + var width = int.Parse(msgArr[2]); + var height = int.Parse(msgArr[3]); + this.framebuffer = new Image(width, height); + this.ScreenSize.Invoke(this, new ScreenSizeEventArgs { Width = width, Height = height }); break; } case "png": { diff --git a/CollabVMSharp/EventArgs.cs b/CollabVMSharp/EventArgs.cs index 63ebae7..2615f86 100644 --- a/CollabVMSharp/EventArgs.cs +++ b/CollabVMSharp/EventArgs.cs @@ -48,6 +48,12 @@ public class RectEventArgs { public Image Data { get; set; } } +public class ScreenSizeEventArgs +{ + public int Width { get; set; } + public int Height { get; set; } +} + // this might not be the best place for this IDK public enum VoteStatus { Started,