コード例 #1
0
ファイル: Program.cs プロジェクト: cpm2710/cellbank
        static void Main(string[] args)
        {
            DesktopMirror _mirror = new DesktopMirror();
            _mirror.Load();
            _mirror.Connect();
            long now = System.DateTime.Now.Ticks / 10000;

            while (true)
            {
                now = System.DateTime.Now.Ticks / 10000;
               List<Bitmap> changes= _mirror.getDifference();
              // List<Bitmap> changes= new List<Bitmap>();
              //  changes.Add(_mirror.GetScreen());
               foreach (Bitmap change in changes)
               {
                   System.IO.MemoryStream m = new System.IO.MemoryStream();
                   change.Save(m, System.Drawing.Imaging.ImageFormat.Png);
                   change.Save("d:\\abc.png", System.Drawing.Imaging.ImageFormat.Png);
               }
                //if(changes.Count>0)
               //changes[0].Save("d:\\abc.png", System.Drawing.Imaging.ImageFormat.Png);
               //Console.WriteLine("changes count:"+changes.Count);

                //Bitmap screen = _mirror.GetScreen();

                //System.IO.MemoryStream m = new System.IO.MemoryStream();

                //screen.Save(m, System.Drawing.Imaging.ImageFormat.Png);

                Console.WriteLine((System.DateTime.Now.Ticks / 10000 - now) + "ms");
            }

            _mirror.Disconnect();
            _mirror.Unload();
        }
コード例 #2
0
ファイル: AmbiLEDdForm.cs プロジェクト: ProjectTako/AmbiLED
 // */
 
 void _mirror_DesktopChange(object sender, DesktopMirror.DesktopChangeEventArgs e)
 {
     txtDebugLog.Text = String.Format("Changed rect is {0},{1} ; {2}, {3} ({4})\r\n{5}", e.x1, e.y1, e.x2, e.y2, e.type, txtDebugLog.Text);
 }
コード例 #3
0
ファイル: AmbiLEDdForm.cs プロジェクト: ProjectTako/AmbiLED
        private void PrepareMethod()
        {
            if (rbDirect3D9.Checked || rbDirect3D10.Checked || rbDirect3D11.Checked)
            {
                if (RegisterGAC.Enabled && RegisterGAC.Checked)
                {
                    // NOTE: On some 64-bit setups this doesn't work so well.
                    //       Sometimes if using a 32-bit target, it will not find the GAC assembly
                    //       without a machine restart, so requires manual insertion into the GAC
                    // Alternatively if the required assemblies are in the target applications
                    // search path they will load correctly.

                    // Must be running as Administrator to allow dynamic registration in GAC
                    Config.Register("ScreenshotInjector",
                        "ScreenshotInject.dll");
                }

                AttachProcess();
            }
            else if (rbNET.Checked)
            {
                global.MethodReady = true;
            }
            else if (rbGDI.Checked)
            {
                global.MethodReady = true;
            }
            else if (rbDirect3D9FrontBuffer.Checked)
            {
                global.MethodReady = true;
            }
            else if (rbOpenGL.Checked)
            {
                global.MethodReady = true;
            }
            else if (rbMirrorDriver.Checked)
            {
                _mirror = new DesktopMirror();
                _mirror.DesktopChange += _mirror_DesktopChange;

                global.MethodReady = true;

                try { _mirror.Load(); }
                catch (Exception ex)
                {
                    txtDebugLog.Text = String.Format("DFMirage error: {0})\r\n{1}", ex.Message, txtDebugLog.Text);
                    global.MethodReady = false;
                }

                try { _mirror.Connect(); }
                catch (Exception ex)
                {
                    txtDebugLog.Text = String.Format("DFMirage error: {0})\r\n{1}", ex.Message, txtDebugLog.Text);
                    global.MethodReady = false;
                }

                try
                { _mirror.Start(); }
                catch (Exception ex)
                {
                    txtDebugLog.Text = String.Format("DFMirage error: {0})\r\n{1}", ex.Message, txtDebugLog.Text);
                    global.MethodReady = false;
                }

            }
        }