void AddPicture(RemoteCapture toAdd) { _captures.Add(DateTime.Now, toAdd); }
public void UpdateScreen(byte[] screenCapture, byte[] mouseCapture) { Image screenImage = null; lock (_syncPictures) { RemoteCapture toDisplay = new RemoteCapture() { ScreeNCapture = screenCapture, MouseCapture = mouseCapture }; if (_captures.Count == 0) { this.AddPicture(toDisplay); } else { toDisplay = PopOldestPicture(); RemoteCapture newCapture = new RemoteCapture() { ScreeNCapture = screenCapture, MouseCapture = mouseCapture }; this.AddPicture(newCapture); } byte[] uncompressedScreen = Tools.Instance.DataCompression.Decompress(toDisplay.ScreeNCapture); byte[] uncompressedMouse = Tools.Instance.DataCompression.Decompress(toDisplay.MouseCapture); if (uncompressedScreen != null) { Rectangle screenBounds = new Rectangle(); Tools.Instance.RemotingUtils.DeserializeDesktopCapture(uncompressedScreen, out screenImage, out screenBounds); } Image finalDisplay = null; if (uncompressedMouse != null) { // unpack the data Image cursor; int cursorX, cursorY; Tools.Instance.RemotingUtils.DeserializeMouseCapture(uncompressedMouse, out cursor, out cursorX, out cursorY); finalDisplay = Tools.Instance.RemotingUtils.AppendMouseToDesktop(screenImage, cursor, cursorX, cursorY); } if (pbRemote.Width > 0 && pbRemote.Height > 0) { Image resized = Tools.Instance.ImageConverter.ResizeImage(finalDisplay, pbRemote.Width, pbRemote.Height); pbRemote.Image = resized; } } }