public bool CloseDevice()
 {
     if (!IsOpen)
     {
         return(true);
     }
     _isRuningCollect   = false;
     IsOpen             = false;
     _sourceImageBuffer = new byte[1920 * 1080 * 4];
     return(VsNetImgScalerExSdk.ImgScalerEx_EndConvert(_handel) == 0);
 }
 private void StartCollectImage()
 {
     while (_isRuningCollect)
     {
         VsNetGDI_CopyWndToBitmapSdk.GDI_GetWndWH(_windowHandle, ref _width, ref _height);
         _bufferSize = _width * _height * 4;
         if (_sourceImageBuffer.Length != _bufferSize)
         {
             _sourceImageBuffer = new byte[_bufferSize];
             VsNetImgScalerExSdk.ImgScalerEx_EndConvert(_handel);
             VsNetImgScalerExSdk.ImgScalerEx_BeginConvert(_handel, _width, _height, 28, 1280, 720, 0, 0, 0, 0, 0);
             _newImageBuffer = new byte[1280 * 720 * 3 / 2];
         }
         VsNetGDI_CopyWndToBitmapSdk.GDI_CopyWndToBitmap(_windowHandle, ref _sourceImageBuffer[0], ref _bitmapInfo);
         VsNetImgScalerExSdk.ImgScalerEx_Convert(_handel, ref _sourceImageBuffer[0], _sourceImageBuffer.Length, ref _newImageBuffer[0], _newImageBuffer.Length);
         Pushing(new VideoDeviceDataContext(_newImageBuffer.ToIntHandle(), _newImageBuffer.Length));
         //TODO 应使用配置
         Thread.Sleep(32);
     }
 }