Esempio n. 1
0
        private void _Desktop_Service_ScreenUpdateEvent(byte[] data, Rectangle r)
        {
            var ms = new Tcp_Message((int)Desktop_Sharing_Shared.Message_Types.UPDATE_REGION);

            ms.Add_Block(BitConverter.GetBytes(r.Top));
            ms.Add_Block(BitConverter.GetBytes(r.Left));
            ms.Add_Block(BitConverter.GetBytes(r.Height));
            ms.Add_Block(BitConverter.GetBytes(r.Width));


            byte[] imgbytes;
            using (var msout = new MemoryStream())
            {
                unsafe
                {
                    fixed(byte *datb = data)
                    {
                        using (Bitmap image = new Bitmap(r.Width, r.Height, r.Width * 4, PixelFormat.Format32bppRgb, new IntPtr(datb)))
                        {
                            image.Save(msout, ImageFormat.Png);
                            imgbytes = msout.ToArray();
                        }
                    }
                }
            }
            ms.Add_Block(imgbytes);
            _Server.Send(ms);
        }
Esempio n. 2
0
        void _Server_NewClientEvent(Secure_Stream client)
        {
            if (!_Desktop_Service.Capturing)
            {
                _Desktop_Service.Capturing = true;
                Thread.Sleep(200);//make sure to sleep long enough for the background service to start up and get an image if needed.
            }
            var ms  = new Tcp_Message((int)Desktop_Sharing_Shared.Message_Types.RESOLUTION_CHANGE);
            var tmp = _Desktop_Service._LastImage;//make sure to get a copy

            ms.Add_Block(BitConverter.GetBytes(tmp.Dimensions.Height));
            ms.Add_Block(BitConverter.GetBytes(tmp.Dimensions.Width));

            byte[] imgbytes;
            using (var msout = new MemoryStream())
            {
                unsafe
                {
                    fixed(byte *datb = tmp.Data)
                    {
                        using (Bitmap image = new Bitmap(tmp.Dimensions.Width, tmp.Dimensions.Height, tmp.Dimensions.Width * 4, PixelFormat.Format32bppRgb, new IntPtr(datb)))
                        {
                            image.Save(msout, ImageFormat.Png);
                            imgbytes = msout.ToArray();
                        }
                    }
                }
            }
            ms.Add_Block(imgbytes);
            client.Encrypt_And_Send(ms);
        }
Esempio n. 3
0
        void _Desktop_Service_MousePositionChangedEvent(Point tl)
        {
            var ms = new Tcp_Message((int)Desktop_Sharing_Shared.Message_Types.MOUSE_POSITION_EVENT);

            ms.Add_Block(BitConverter.GetBytes(tl.Y));
            ms.Add_Block(BitConverter.GetBytes(tl.X));
            _Server.Send(ms);
        }
Esempio n. 4
0
        void _Desktop_Service_MouseImageChangedEvent(Point tl, byte[] data)
        {
            var ms = new Tcp_Message((int)Desktop_Sharing_Shared.Message_Types.MOUSE_IMAGE_EVENT);

            ms.Add_Block(BitConverter.GetBytes(tl.Y));
            ms.Add_Block(BitConverter.GetBytes(tl.X));
            ms.Add_Block(data);
            _Server.Send(ms);
        }