예제 #1
0
 public void ConvertTemplate(FingerprintTemplate tpt, [Out] FingerprintTemplate newTpt, int context, GrTemplateFormat format)
 {
     IntPtr zero = IntPtr.Zero;
     IntPtr ptr2 = IntPtr.Zero;
     try
     {
         zero = Marshal.AllocHGlobal(tpt.Size);
         Marshal.Copy(tpt.Buffer, 0, zero, tpt.Size);
         ptr2 = Marshal.AllocHGlobal(0x2710);
         int newTptSize = 0x2710;
         this.ConvertTemplate(zero, ptr2, ref newTptSize, context, (int) format);
         ptr2 = Marshal.ReAllocHGlobal(ptr2, (IntPtr) newTptSize);
         newTpt = new FingerprintTemplate(ptr2, newTptSize);
     }
     catch (OutOfMemoryException exception)
     {
         throw new FingerprintException(-7, exception);
     }
     catch (NullReferenceException exception2)
     {
         throw new FingerprintException(-5, exception2);
     }
     catch (ArgumentException exception3)
     {
         throw new FingerprintException(-5, exception3);
     }
     finally
     {
         Marshal.FreeHGlobal(zero);
         Marshal.FreeHGlobal(ptr2);
     }
 }
예제 #2
0
        public void ConvertTemplate(FingerprintTemplate tpt, [Out] FingerprintTemplate newTpt, int context, GrTemplateFormat format)
        {
            IntPtr zero = IntPtr.Zero;
            IntPtr ptr2 = IntPtr.Zero;

            try
            {
                zero = Marshal.AllocHGlobal(tpt.Size);
                Marshal.Copy(tpt.Buffer, 0, zero, tpt.Size);
                ptr2 = Marshal.AllocHGlobal(0x2710);
                int newTptSize = 0x2710;
                this.ConvertTemplate(zero, ptr2, ref newTptSize, context, (int)format);
                ptr2   = Marshal.ReAllocHGlobal(ptr2, (IntPtr)newTptSize);
                newTpt = new FingerprintTemplate(ptr2, newTptSize);
            }
            catch (OutOfMemoryException exception)
            {
                throw new FingerprintException(-7, exception);
            }
            catch (NullReferenceException exception2)
            {
                throw new FingerprintException(-5, exception2);
            }
            catch (ArgumentException exception3)
            {
                throw new FingerprintException(-5, exception3);
            }
            finally
            {
                Marshal.FreeHGlobal(zero);
                Marshal.FreeHGlobal(ptr2);
            }
        }
예제 #3
0
 public void ConvertTemplate(FingerprintTemplate tpt, [Out] FingerprintTemplate newTpt, GrTemplateFormat format)
 {
     this.ConvertTemplate(tpt, newTpt, 0, format);
 }
예제 #4
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;
     }
 }
예제 #5
0
 public void ExtractEx(FingerprintRawImage fingerPrintRawImage, ref FingerprintTemplate fingerTemplate, GrTemplateFormat tptFormat)
 {
     this.ExtractEx(fingerPrintRawImage, ref fingerTemplate, 0, tptFormat);
 }
예제 #6
0
        public GrEnrollState Enroll(FingerprintRawImage rawImage, ref FingerprintTemplate tpt, GrTemplateFormat tptFormat, int context)
        {
            GrEnrollState state;
            IntPtr        zero = IntPtr.Zero;

            try
            {
                int num     = 0;
                int quality = -1;
                int cb      = 0x2710 * Marshal.SizeOf(typeof(byte));
                zero = Marshal.AllocHGlobal(cb);
                IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
                Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
                num = this.Enroll(destination, rawImage.Width, rawImage.Height, rawImage.Resolution, zero, ref cb, ref quality, (int)tptFormat, context);
                Marshal.FreeCoTaskMem(destination);
                zero  = Marshal.ReAllocHGlobal(zero, (IntPtr)cb);
                tpt   = new FingerprintTemplate(zero, cb, quality);
                state = (GrEnrollState)num;
            }
            catch (OutOfMemoryException exception)
            {
                throw new FingerprintException(-7, exception);
            }
            catch (AccessViolationException exception2)
            {
                throw new FingerprintException(-113, exception2);
            }
            finally
            {
                Marshal.FreeHGlobal(zero);
            }
            return(state);
        }
예제 #7
0
 public GrEnrollState Enroll(FingerprintRawImage rawImage, ref FingerprintTemplate tpt, GrTemplateFormat tptFormat)
 {
     return(this.Enroll(rawImage, ref tpt, tptFormat, 0));
 }
예제 #8
0
 public void ConvertTemplate(FingerprintTemplate tpt, [Out] FingerprintTemplate newTpt, GrTemplateFormat format)
 {
     this.ConvertTemplate(tpt, newTpt, 0, format);
 }
예제 #9
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;
     }
 }
예제 #10
0
 public void ExtractEx(FingerprintRawImage fingerPrintRawImage, ref FingerprintTemplate fingerTemplate, GrTemplateFormat tptFormat)
 {
     this.ExtractEx(fingerPrintRawImage, ref fingerTemplate, 0, tptFormat);
 }
예제 #11
0
 public GrEnrollState Enroll(FingerprintRawImage rawImage, ref FingerprintTemplate tpt, GrTemplateFormat tptFormat, int context)
 {
     GrEnrollState state;
     IntPtr zero = IntPtr.Zero;
     try
     {
         int num = 0;
         int quality = -1;
         int cb = 0x2710 * Marshal.SizeOf(typeof(byte));
         zero = Marshal.AllocHGlobal(cb);
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         num = this.Enroll(destination, rawImage.Width, rawImage.Height, rawImage.Resolution, zero, ref cb, ref quality, (int) tptFormat, context);
         Marshal.FreeCoTaskMem(destination);
         zero = Marshal.ReAllocHGlobal(zero, (IntPtr) cb);
         tpt = new FingerprintTemplate(zero, cb, quality);
         state = (GrEnrollState) num;
     }
     catch (OutOfMemoryException exception)
     {
         throw new FingerprintException(-7, exception);
     }
     catch (AccessViolationException exception2)
     {
         throw new FingerprintException(-113, exception2);
     }
     finally
     {
         Marshal.FreeHGlobal(zero);
     }
     return state;
 }
예제 #12
0
 public GrEnrollState Enroll(FingerprintRawImage rawImage, ref FingerprintTemplate tpt, GrTemplateFormat tptFormat)
 {
     return this.Enroll(rawImage, ref tpt, tptFormat, 0);
 }