Unosquare.Labs.LibFprint.FingerprintGallery.RegisterFingerprintData C# (CSharp) Method

RegisterFingerprintData() private method

Registers the supplied fingerprint data, associating it with the given key.
/// fingerprintData is invalid /// or /// key needs to contain a valid string /// The fingerprint data buffer is invalid.
private RegisterFingerprintData ( string key, byte fingerprintData ) : void
key string The key.
fingerprintData byte The fingerprint data.
return void
        private void RegisterFingerprintData(string key, byte[] fingerprintData)
        {
            if (fingerprintData == null || fingerprintData.Length <= 0)
                throw new ArgumentException("fingerprintData is invalid");

            if (string.IsNullOrWhiteSpace(key))
                throw new ArgumentException("key needs to contain a valid string");

            var bufferLength = System.Convert.ToUInt32(fingerprintData.Length);
            var printDataFromBufferPtr = Interop.fp_print_data_from_data(fingerprintData, bufferLength);
            if (printDataFromBufferPtr == IntPtr.Zero)
                throw new FormatException("The fingerprint data buffer is invalid.");

            if (this.HasKey(key))
                this.Remove(key, false);

            InternalList.Add(new Fingerprint() { Identifier = key, Reference = printDataFromBufferPtr });
        }