예제 #1
0
        private void Extract([In] IntPtr rawimage, int width, int height, int res, ref FingerprintTemplate fingerTemplate, int context)
        {
            IntPtr zero = IntPtr.Zero;

            try
            {
                int cb = 0x2710 * Marshal.SizeOf(typeof(byte));
                zero = Marshal.AllocHGlobal(cb);
                int quality = FingerprintException.CheckError(GrFingerprintProxy.GrExtract(rawimage, width, height, res, zero, ref cb, context));
                zero           = Marshal.ReAllocHGlobal(zero, (IntPtr)cb);
                fingerTemplate = new FingerprintTemplate(zero, cb, quality);
            }
            catch (OutOfMemoryException exception)
            {
                throw new FingerprintException(-7, exception);
            }
            catch (AccessViolationException exception2)
            {
                throw new FingerprintException(-113, exception2);
            }
            finally
            {
                Marshal.FreeHGlobal(zero);
            }
        }
예제 #2
0
        private void GetBiometricDisplay(FingerprintTemplate tptQuery, IntPtr rawImage, int width, int height, int res, IntPtr hdc, ref IntPtr handle, int matchContext)
        {
            IntPtr zero = IntPtr.Zero;

            try
            {
                zero = Marshal.AllocHGlobal(tptQuery.Size);
                Marshal.Copy(tptQuery.Buffer, 0, zero, tptQuery.Size);
                int errorCode = 0;
                try
                {
                    errorCode = GrFingerprintProxy.GrBiometricDisplay(zero, rawImage, width, height, res, hdc, ref handle, matchContext);
                }
                catch (AccessViolationException exception)
                {
                    FingerprintException exception2 = new FingerprintException(-113, exception);
                    throw exception2;
                }
                FingerprintException.CheckError(errorCode);
            }
            catch (OutOfMemoryException exception3)
            {
                throw new FingerprintException(-7, exception3);
            }
            finally
            {
                Marshal.FreeHGlobal(zero);
            }
        }
예제 #3
0
 public void CaptureFinalize()
 {
     try
     {
         int errorCode = 0;
         try
         {
             errorCode = GrFingerprintProxy.GrCapFinalize();
         }
         catch (AccessViolationException exception)
         {
             FingerprintException exception2 = new FingerprintException(-113, exception);
             throw exception2;
         }
         FingerprintException.CheckError(errorCode);
     }
     finally
     {
         if (this.grStatusEventHandler != null)
         {
             this.grStatusEventHandler = null;
             if (this.gchStatus.IsAllocated)
             {
                 this.gchStatus.Free();
             }
         }
     }
 }
예제 #4
0
        public void StopCapture(object idSensor)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrCapStopCapture(idSensor.ToString());
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            finally
            {
                if (this.gchFinger.IsAllocated)
                {
                    this.gchFinger.Free();
                }
                if (this.gchImage.IsAllocated)
                {
                    this.gchImage.Free();
                }
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #5
0
 private void ShowFPError(FingerprintException ex)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new DelegateShowFPError(ShowFPError), new object[] { ex });
     }
     else
     {
         MessageBox.Show(String.Format("OnImage Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
0
 public static void SetLicenseFolder(string licenseFolder)
 {
     try
     {
         GrFingerprintProxy.GrSetLicenseFolder(licenseFolder);
     }
     catch (AccessViolationException exception)
     {
         FingerprintException exception2 = new FingerprintException(-113, exception);
         throw exception2;
     }
 }
예제 #7
0
        private void ConvertTemplate([In] IntPtr tpt, [Out] IntPtr newTpt, ref int newTptSize, int context, int format)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrConvertTemplate(tpt, newTpt, ref newTptSize, context, format);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #8
0
        public static GrLicense GetStrGrFingerVersion(ref byte majorVersion, ref byte minorVersion)
        {
            int num = 0;

            try
            {
                num = GrFingerprintProxy.GrGetGrFingerVersion(ref majorVersion, ref minorVersion);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            return((GrLicense)num);
        }
예제 #9
0
        private void GetHandlerFromRawImage(IntPtr rawImage, int width, int height, IntPtr hdc, ref IntPtr image)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrCapRawImageToHandle(rawImage, width, height, hdc, ref image);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #10
0
 public void GetHandlerFromRawImage(FingerprintRawImage rawImage, IntPtr hdc, ref IntPtr image)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         this.GetHandlerFromRawImage(destination, rawImage.Width, rawImage.Height, hdc, ref image);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
예제 #11
0
 public void GetBiometricDisplay(FingerprintTemplate tptQuery, FingerprintRawImage rawImage, IntPtr hdc, ref IntPtr handle, int matchContext)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         this.GetBiometricDisplay(tptQuery, destination, rawImage.Width, rawImage.Height, rawImage.Resolution, hdc, ref handle, matchContext);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
예제 #12
0
 public void ExtractEx(FingerprintRawImage fingerPrintRawImage, ref FingerprintTemplate fingerTemplate, int context, GrTemplateFormat tptFormat)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(fingerPrintRawImage.Width * fingerPrintRawImage.Height);
         Marshal.Copy(fingerPrintRawImage.RawImage, 0, destination, fingerPrintRawImage.Width * fingerPrintRawImage.Height);
         this.ExtractEx(destination, fingerPrintRawImage.Width, fingerPrintRawImage.Height, fingerPrintRawImage.Resolution, ref fingerTemplate, context, (int)tptFormat);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
예제 #13
0
        public static int EncodeBase64(IntPtr buffer, int bufferSize, ref IntPtr encodedBuffer, ref int encodedSize)
        {
            int num = 0;

            try
            {
                num = GrFingerprintProxy.EncodeBase64(buffer, bufferSize, encodedBuffer, ref encodedSize);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            return(num);
        }
예제 #14
0
        public void DestroyContext(int context)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrDestroyContext(context);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #15
0
        private void IdentifyPrepare(IntPtr queryTemplate, int context)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrIdentifyPrepare(queryTemplate, context);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #16
0
        private void CaptureInitialize(GrStatusEventHandler grStatusEventHandler)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrCapInitialize(grStatusEventHandler);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #17
0
        public void StartEnroll(int context)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrStartEnroll(context).ToInt32();
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #18
0
        public void SetVerifyParameters(int verifyThreshold, int verifyRotationTolerance, int context)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrSetVerifyParameters(verifyThreshold, verifyRotationTolerance, context);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #19
0
        private void StartCapture(string sensor, GrFingerEventHandler grFingerEventHandler, GrImageEventHandler grImageEventHandler)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrCapStartCapture(sensor, grFingerEventHandler, grImageEventHandler);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #20
0
        public void SetBiometricDisplayColors(int minutiaeColor, int minutiaeMatchedColor, int segmentColor, int segmentMatchedColor, int inclinationColor, int inclinationMatchedColor)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrSetBiometricDisplayColors(minutiaeColor, minutiaeMatchedColor, segmentColor, segmentMatchedColor, inclinationColor, inclinationMatchedColor);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #21
0
        private void SaveRawImageToFile(IntPtr rawimage, int width, int height, string fileName, GrCaptureImageFormat imageFormat)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrCapSaveRawImageToFile(rawimage, width, height, fileName, imageFormat);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-7, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #22
0
 public void SaveRawImageToFile(FingerprintRawImage rawImage, string fileName, GrCaptureImageFormat imageFormat)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         this.SaveRawImageToFile(destination, rawImage.Width, rawImage.Height, fileName, imageFormat);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
예제 #23
0
        public void LoadImageFromFile(string filename, int res)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrCapLoadImageFromFile(filename, res);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #24
0
        public static void InstallLicense(string productKey)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrInstallLicense(productKey);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
        }
예제 #25
0
        private int Verify(IntPtr queryTemplate, IntPtr referenceTemplate, out int verifyScore, int context)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrVerify(queryTemplate, referenceTemplate, out verifyScore, context);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
            return(errorCode);
        }
예제 #26
0
        public static int DecodeBase64(IntPtr encodedBuffer, int encodedSize, ref IntPtr decodedBuffer, ref int decodedSize)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.DecodeBase64(encodedBuffer, encodedSize, decodedBuffer, ref decodedSize);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
            return(errorCode);
        }
예제 #27
0
        private int Enroll([In] IntPtr rawimage, int width, int height, int res, IntPtr tpt, ref int tptSize, ref int quality, int tptFormat, int context)
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrEnroll(rawimage, width, height, res, tpt, ref tptSize, ref quality, tptFormat, context);
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
            return(errorCode);
        }
예제 #28
0
        public void Initialize()
        {
            int errorCode = 0;

            try
            {
                errorCode = GrFingerprintProxy.GrInitialize();
            }
            catch (AccessViolationException exception)
            {
                FingerprintException exception2 = new FingerprintException(-113, exception);
                throw exception2;
            }
            FingerprintException.CheckError(errorCode);
            this.bInitialized = true;
        }