示例#1
0
 public bool Push(rsid.Faceprints faceprints, string userId)
 {
     if (DoesUserExist(userId))
     {
         return(false);
     }
     else
     {
         faceprintsArray.Add((faceprints, userId));
         isDone = false;
         return(true);
     }
 }
示例#2
0
        public bool Push(rsid.Faceprints faceprints, string userId)
        {
            // if DB is empty - set the db version at the first push to the DB.
            if ((DbVersion < 0) && (FaceprintsArray.Count == 0))
            {
                DbVersion = faceprints.version;
            }

            // handle push to db.
            if (DoesUserExist(userId))
            {
                return(false);
            }
            else
            {
                FaceprintsArray.Add((faceprints, userId));
                return(true);
            }
        }
示例#3
0
        public bool UpdateUser(int userIndex, string userIdStr, ref rsid.Faceprints updatedFaceprints)
        {
            bool success = true;

            var userData = FaceprintsArray[userIndex];
            // var userFaceprints = userData.Item1;
            var userIdName = userData.Item2;

            if (userIdStr == userIdName)
            {
                // update by remove and then re-insert (found no other way to do that properly).
                FaceprintsArray.RemoveAt(userIndex);
                FaceprintsArray.Insert(userIndex, (updatedFaceprints, userIdStr));
            }
            else
            {
                Console.WriteLine("Can't update the new faceprints - userName in DB and new vector mismatch!");
                success = false;
            }

            return(success);
        }
示例#4
0
        public List <UserFaceprints> GetUsersFaceprints()
        {
            int number_of_users = 0;
            var status          = QueryNumberOfUsers(out number_of_users);

            if (status != Status.Ok)
            {
                return(null);
            }
            var exported_db = new rsid.Faceprints[number_of_users];

            String[] user_ids = new String[number_of_users];
            status = QueryUserIds(out user_ids);
            if (status != Status.Ok)
            {
                return(null);
            }
            for (int i = 0; i < number_of_users; i++)
            {
                exported_db[i] = new Faceprints();
            }
            status = rsid_get_users_faceprints(_handle, exported_db);
            var user_features = new List <UserFaceprints>();

            for (uint i = 0; i < number_of_users; i++)
            {
                user_features.Add(new UserFaceprints
                {
                    faceprints = exported_db[i],
                    userID     = user_ids[i]
                });
                if (status != Status.Ok)
                {
                    return(null);
                }
            }
            return(user_features);
        }
示例#5
0
        // DBLE - db layer element
        public bool VerifyVersionMatchedDBLE(ref rsid.Faceprints faceprints)
        {
            bool versionMatched = ((faceprints.version == DbVersion) || (DbVersion < 0));

            return(versionMatched);
        }
示例#6
0
 static extern Status rsid_set_user_features(IntPtr rsid_authenticator, string userId, ref rsid.Faceprints userFeatures);