public double Match() { try { Transparency = FingerprintTransparency.Current; ReportSupport = Transparency.AcceptsPairing(); int totalRoots = EnumerateRoots(); // https://sourceafis.machinezoo.com/transparency/root-pairs Transparency.LogRootPairs(totalRoots, Roots); double high = 0; int best = -1; for (int i = 0; i < totalRoots; ++i) { double score = TryRoot(Roots[i]); if (best < 0 || score > high) { high = score; best = i; } ClearPairing(); } // https://sourceafis.machinezoo.com/transparency/best-match Transparency.LogBestMatch(best); return(high); } catch (Exception) { CurrentInstance = new MatcherThread(); throw; } finally { Transparency = null; } }
/// <summary>Deactivates transparency logging and releases system resources held by this instance if any.</summary> /// <remarks> /// <para> /// This method is normally called automatically when <c>FingerprintTransparency</c> is used in <c>using</c> statement. /// </para> /// <para> /// Deactivation stops transparency data logging to this instance of <c>FingerprintTransparency</c>. /// Logging thus takes place between invocation of constructor (<see cref="FingerprintTransparency()" />) and invocation of this method. /// If activations were nested, this method reactivates the outer <c>FingerprintTransparency</c>. /// </para> /// <para> /// Subclasses can override this method to perform cleanup. /// Default implementation of this method performs deactivation. /// It must be called by overriding methods for deactivation to work correctly. /// </para> /// </remarks> /// <seealso cref="FingerprintTransparency()" /> public void Dispose() { if (!Disposed) { Disposed = true; CurrentInstance = Outer; Outer = null; } }
/// <summary>Creates an instance of <c>FingerprintTransparency</c> and activates it.</summary> /// <remarks> /// <para> /// Activation places the new <c>FingerprintTransparency</c> instance in thread-local storage, /// which causes all operations executed by current thread to log data to this <c>FingerprintTransparency</c> instance. /// If activations are nested, data is only logged to the currently innermost <c>FingerprintTransparency</c>. /// </para> /// <para> /// Deactivation happens in <see cref="Dispose()" /> method. /// Instances of <c>FingerprintTransparency</c> should be created in <c>using</c> statement /// to ensure that <see cref="Dispose()" /> is always called. /// </para> /// <para> /// <c>FingerprintTransparency</c> is an abstract class. /// This constructor is only called by subclasses. /// </para> /// </remarks> /// <seealso cref="Dispose()" /> protected FingerprintTransparency() { Outer = CurrentInstance; CurrentInstance = this; }