Inheritance: System.MarshalByRefObject
Exemplo n.º 1
0
        /// <summary>
        /// Set the screenshot response for the given process Id
        /// </summary>
        /// <param name="clientPID"></param>
        /// <param name="screenshotResponse"></param>
        public static void SetScreenshotResponse(Int32 clientPID, ScreenshotResponse screenshotResponse)
        {
            try
            {
                lock (_screenshotRequestNotifications)
                {
                    if (_screenshotRequestNotifications[clientPID] != null)
                    {
                        _screenshotRequestNotifications[clientPID](clientPID, ResponseStatus.Complete, screenshotResponse);

                        _screenshotRequestNotifications.Remove(clientPID);
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The callback for when the screenshot has been taken
        /// </summary>
        /// <param name="clientPID"></param>
        /// <param name="status"></param>
        /// <param name="screenshotResponse"></param>
        void DXCallback(Int32 clientPID, ResponseStatus status, ScreenshotResponse screenshotResponse)
        {

            try
            {
                if (screenshotResponse != null && screenshotResponse.CapturedBitmap != null)
                {
                    // Get Data
                    GrabColors(screenshotResponse.CapturedBitmapAsImage);

                    // Send Colors on seperate thread
                    Thread tSendColors = new Thread(new ThreadStart(SendColours));
                    tSendColors.Start();

                    // Measure time
                    EndMeasureTime = DateTime.Now;
                    diffMeasure = EndMeasureTime - StartMeasureTime;

                    if (diffMeasure < TimeSpan.FromMilliseconds(global.var_Interval))
                    {
                        SleepTime = TimeSpan.FromMilliseconds(global.var_Interval) - diffMeasure;
                    } else {
                        SleepTime = TimeSpan.FromMilliseconds(0);
                    }

                    if (ShowFPS.Checked && this.WindowState != FormWindowState.Minimized)
                        ShowFPS.Invoke(new MethodInvoker(delegate() { ShowFPS.Text = "FPS: " + Utility.CalculateFrameRate().ToString(); }));

                    // Additional ...
                    if (measure.Checked && this.WindowState != FormWindowState.Minimized)
                    {
                        label87.Invoke(new MethodInvoker(delegate() { label87.Text = diffMeasure.ToString(); } ));
                        label8.Invoke(new MethodInvoker(delegate() { label8.Text = SleepTime.ToString(); }));
                        //label87.Text = diffMeasure.ToString();
                        //label8.Text = SleepTime.ToString();
                    }
                    if (ShowPreview.Checked && this.WindowState != FormWindowState.Minimized)
                    {
                        pictureBox1.Invoke(new MethodInvoker(delegate()
                        {
                            if (pictureBox1.Image != null)
                            {
                                pictureBox1.Image.Dispose();
                            }
                            /* Size +2
                            if (pictureBox1.Size != screenshotResponse.CapturedBitmapAsImage.Size)
                                pictureBox1.Size = screenshotResponse.CapturedBitmapAsImage.Size;
                            // */
                            if ((pictureBox1.Size.Width + 2) != screenshotResponse.CapturedBitmapAsImage.Size.Width) pictureBox1.Width = screenshotResponse.CapturedBitmapAsImage.Size.Width + 2;
                            if ((pictureBox1.Size.Height + 2) != screenshotResponse.CapturedBitmapAsImage.Size.Height) pictureBox1.Height = screenshotResponse.CapturedBitmapAsImage.Size.Height + 2;

                            pictureBox1.Image = screenshotResponse.CapturedBitmapAsImage;
                        })
                        );
                    }

                    screenshotResponse.CapturedBitmapAsImage.Dispose();

                    // Sleep Interval..
                    Thread.Sleep(SleepTime);
                }

                global.ReadyToCapture = true;

                Thread t = new Thread(new ThreadStart(DoRequest));
                t.Start();
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Колбэк, когда получен во внедряемой библиотеке получен скриншот
        /// </summary>
        /// <param name="clientPID">Идентификатор процесса</param>
        /// <param name="status">Статус ответа</param>
        /// <param name="screenshotResponse">Данные с ответом</param>
        public void ScreenshotManagerCallback(Int32 clientPID, ResponseStatus status, ScreenshotResponse screenshotResponse)
        {
            if (IsLocked)
            {
                inRefresh = false;
                return;
            }

            try
            {
                if (screenshotResponse != null && screenshotResponse.CapturedBitmap != null)
                {
                    // Сохраняем битмап в собственный буфер
                    AssignBitmapFromBytes(screenshotResponse.CapturedBitmap);
                    // Отсылает сообщение об успешном обновлении
                    ScreenshotUpdate(window);
                }
            }
            finally
            {
                inRefresh = false;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Set the screenshot response for the given process Id
        /// </summary>
        /// <param name="clientPID"></param>
        /// <param name="screenshotResponse"></param>
        public static void SetScreenshotResponse(Int32 clientPID, ScreenshotResponse screenshotResponse)
        {
            try
            {
                lock (_screenshotRequestNotifications)
                {
                    if (_screenshotRequestNotifications[clientPID] != null)
                    {
                        _screenshotRequestNotifications[clientPID](clientPID, ResponseStatus.Complete, screenshotResponse);

                        _screenshotRequestNotifications.Remove(clientPID);
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Set the screenshot response for the given process Id
 /// </summary>
 /// <param name="clientPID"></param>
 /// <param name="screenshotResponse"></param>
 public static void SetScreenshotResponse(Int32 clientPID, ScreenshotResponse screenshotResponse)
 {
     try
     {
         lock (_screenshotRequestNotifications)
         {
             if (_screenshotRequestNotifications[clientPID] != null)
             {
                 _screenshotRequestNotifications[clientPID](clientPID, ResponseStatus.Complete, screenshotResponse);
                 _screenshotRequestNotifications.Remove(clientPID);
             }
         }
     }
     catch (Exception e)
     {AddScreenshotDebugMessage(0, e.Message);}
 }
Exemplo n.º 6
0
        //void ScreenshotManager_OnScreenshotDebugMessage(int clientPID, string message)
        //{
        //    txtDebugLog.Invoke(new MethodInvoker(delegate()
        //    {
        //        txtDebugLog.Text = String.Format("Client PID: {0}\r\n{1}\r\n", clientPID, message);
        //    })
        //    );
        //}
        void Callback(Int32 clientPID, ResponseStatus status, ScreenshotResponse screenshotResponse)
        {
            try
            {
                if (screenshotResponse != null && screenshotResponse.CapturedBitmap != null)
                {
                    //pictureBox1.Invoke(new MethodInvoker(delegate()
                    //{
                    //    if (pictureBox1.Image != null)
                    //    {
                    //        pictureBox1.Image.Dispose();
                    //    }
                    //    pictureBox1.Image = screenshotResponse.CapturedBitmapAsImage;
                    //})
                    //);
                    progressBar1.Invoke(new MethodInvoker(delegate()
                    {
                        image = screenshotResponse.CapturedBitmapAsImage;
                    })
                    );
                }

                Thread t = new Thread(new ThreadStart(DoRequest));
                t.Start();
            }
            catch
            {
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// The callback for when the screenshot has been taken
        /// </summary>
        /// <param name="clientPID"></param>
        /// <param name="status"></param>
        /// <param name="screenshotResponse"></param>
        void Callback(Int32 clientPID, ResponseStatus status, ScreenshotResponse screenshotResponse)
        {
            //try
            //{
            //    if (screenshotResponse != null && screenshotResponse.CapturedBitmap != null)
            //    {
            //        Bitmap bmp = screenshotResponse.CapturedBitmapAsImage;
            //        Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
            //        System.Drawing.Imaging.BitmapData bmpData =
            //            bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
            //            bmp.PixelFormat);
            //        bmp.UnlockBits(bmpData);
            //        ScreenshotManager_OnScreenshotDebugMessage(clientPID, "Size is " + bmp.Size.ToString());
            //        //MessageBox.Show("Size is " + screenshotResponse.CapturedBitmapAsImage.Size.ToString());

            //        String dir=_process.ProcessName+@"\"+_process.StartTime+@"\";
            //        String file = _process.ProcessName + "_" + DateTime.Now + ".jpg";

            //        dir = @"c:\temp\" + dir.Replace(':','-').Replace(' ','-');
            //        file = file.Replace(':', '-').Replace(' ', '-');

            //        ScreenshotManager_OnScreenshotDebugMessage(clientPID, "Saving to " + dir + file);
            //        if (!Directory.Exists(dir)) {
            //            Directory.CreateDirectory(dir);
            //        }
            //        bmp.Save(dir+file, ImageFormat.Jpeg);
            //        ScreenshotManager_OnScreenshotDebugMessage(clientPID, "Saved to "+dir+file);
            //     }

            //    //Thread t = new Thread(new ThreadStart(DoRequest));
            //    //t.Start();
            //}
            //catch(Exception e)
            //{
            //    ScreenshotManager_OnScreenshotDebugMessage(clientPID, e.ToString());
            //}
        }
Exemplo n.º 8
0
 /// <summary>
 /// The callback for when the screenshot has been taken
 /// </summary>
 /// <param name="clientPID"></param>
 /// <param name="status"></param>
 /// <param name="screenshotResponse"></param>
 public static void processShot(Int32 clientPID, ResponseStatus status, ScreenshotResponse sr)
 {
 }