private void PumpYFrames()
 {
     byte[] array = new byte[307200];
     bool flag = false;
     while (this._pumpYFrames)
     {
         BarcodeScanner._pauseFramesEvent.WaitOne();
         if (this._isScanning)
         {
             try
             {
                 this._cam.GetPreviewBufferY(array);
                 flag = true;
             }
             catch
             {
                 flag = false;
             }
             if (flag)
             {
                 DateTime now = DateTime.Now;
                 RGBLuminanceSource rGBLuminanceSource = new RGBLuminanceSource(array, 640, 480, false);
                 if (this._scanType == CodeType.OneDCodes || this._scanType == CodeType.UPC || this._scanType == CodeType.ITF || this._scanType == CodeType.EAN || this._scanType == CodeType.Code128 || this._scanType == CodeType.Code39)
                 {
                     rGBLuminanceSource.rotateCounterClockwise();
                 }
                 HybridBinarizer binarizer = new HybridBinarizer(rGBLuminanceSource);
                 BinaryBitmap image = new BinaryBitmap(binarizer);
                 Reader reader = this.GetReader(this._scanType);
                 try
                 {
                     Result results = reader.decode(image, this._hintDictionary);
                     TimeSpan timeSpent = DateTime.Now.Subtract(now);
                     Deployment.Current.Dispatcher.BeginInvoke(delegate
                     {
                         this.ProcessScan(results, timeSpent, this.ScanType);
                         if (this.StopOnSuccess)
                         {
                             this.IsScanning = false;
                         }
                     }
                     );
                     BarcodeScanner._pauseFramesEvent.Set();
                 }
                 catch
                 {
                     BarcodeScanner._pauseFramesEvent.Set();
                 }
             }
         }
     }
 }