public string UploadVerifySample()
        {
            string        messages = "";
            List <string> s        = new List <string>();

            s.Add("E:\\Applications\\BiometricAuth\\BiometricAuth\\samples\\voice\\s1.wav");
            s.Add("E:\\Applications\\BiometricAuth\\BiometricAuth\\samples\\voice\\s2.wav");
            s.Add("E:\\Applications\\BiometricAuth\\BiometricAuth\\samples\\image\\sample1.png");
            s.Add("E:\\Applications\\BiometricAuth\\BiometricAuth\\samples\\image\\sample2.png");
            BiometricClassID bcid = new BiometricClassID();

            bcid.ClassID   = 1234;
            bcid.Partition = 10212;
            bcid.Storage   = "bws";
            Sample[] samples;
            try
            {
                samples = s.Select(file => new Sample
                {
                    Trait = file.EndsWith("wav", StringComparison.OrdinalIgnoreCase) ? Trait.Voice : Trait.Face,
                    Data  = System.IO.File.ReadAllBytes(file)
                }).ToArray();
            }
            catch (Exception e)
            {
                return(e.Message);
            }

            BioIDWebServiceClient client = null;

            try
            {
                // connect to  BWS
                client = new BioIDWebServiceClient();

                // go for the commands:
                // - Enrollment
                if (bcid != null)
                {
                    var flags = ClassificationFlags.None;

                    try
                    {
                        bool success = client.Verify(bcid, samples, flags, out messages);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("error...:");
                        Console.WriteLine(e.Message);
                    }
                }
            }

            catch (Exception e)
            {
                Console.WriteLine("Exception caught:");
                Console.WriteLine(e.Message);
            }
            return(messages);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a <see cref="BiometricClassID"/> (BCID) from its string representation.
        /// </summary>
        /// <param name="value">The string encoding to convert to a BCID.</param>
        /// <returns>
        /// A newly created <see cref="BiometricClassID"/>, when the <paramref name="value"/>
        /// contained a valid representation of a BCID, otherwise a <c>null</c> reference.
        /// </returns>
        public static BiometricClassID ParseBCID(string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(null);
            }
            string str = value.Trim();

            if (str.StartsWith("urn:bcid:", StringComparison.InvariantCultureIgnoreCase))
            {
                str = str.Substring(9);
            }
            string[] components = str.Split(new char[] { '/', '.', ':' });
            if (components.Length != 3)
            {
                return(null);
            }
            var bcid = new BiometricClassID();

            bcid.Storage = components[0];
            int i;

            if (!int.TryParse(components[1], out i))
            {
                return(null);
            }
            bcid.Partition = i;
            if (!int.TryParse(components[2], out i))
            {
                return(null);
            }
            bcid.ClassID = i;
            return(bcid);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a <see cref="BiometricClassID"/> (BCID) from its string representation.
 /// </summary>
 /// <param name="value">The string encoding to convert to a BCID.</param>
 /// <returns>
 /// A newly created <see cref="BiometricClassID"/>, when the <paramref name="value"/>
 /// contained a valid representation of a BCID, otherwise a <c>null</c> reference.
 /// </returns>
 public static BiometricClassID ParseBCID(string value)
 {
     if (string.IsNullOrWhiteSpace(value))
         return null;
     string str = value.Trim();
     if (str.StartsWith("urn:bcid:", StringComparison.InvariantCultureIgnoreCase))
         str = str.Substring(9);
     string[] components = str.Split(new char[] { '/', '.', ':' });
     if (components.Length != 3)
         return null;
     var bcid = new BiometricClassID();
     bcid.Storage = components[0];
     int i;
     if (!int.TryParse(components[1], out i))
         return null;
     bcid.Partition = i;
     if (!int.TryParse(components[2], out i))
         return null;
     bcid.ClassID = i;
     return bcid;
 }