Ejemplo n.º 1
0
        } = "";                                               // New User ID

        static void Main(string[] args)
        {
            // Parse Command-Line Args
            ParseOptions(args);

            // Load DataBase
            var database   = new rsid_utility.DataBase();
            var attributes = File.GetAttributes(input);

            if ((attributes & FileAttributes.Archive) != FileAttributes.Archive)
            {
                throw new Exception($"failed {input} is not archive! database file is archive!");
            }
            database.LoadFile(input);

            // ReName User ID
            var db = database.GetDataBase();

            if (db.Count == 0)
            {
                throw new Exception("failed database is empty!");
            }

            bool is_renamed = false;

            foreach ((Faceprints faceprints, string user_id) in db)
            {
                if (user_id.Replace("\0", "") != old_user_id)
                {
                    continue;
                }

                database.Remove(user_id);
                database.Add(faceprints, new_user_id);
                is_renamed = true;
                break;
            }

            // Save DataBase
            if (!is_renamed)
            {
                return;
            }

            var directory = Path.GetDirectoryName(input);
            var file_name = Path.GetFileName(input);

            database.SaveFile(directory, file_name);
        }
Ejemplo n.º 2
0
 private static void ShowUserIDs(string file)
 {
     try
     {
         var database = new rsid_utility.DataBase();
         database.LoadFile(file);
         var db = database.GetDataBase();
         Console.WriteLine($"* {file.Replace(@"\", "/")} ({db.Count} users)");
         foreach ((Faceprints faceprints, string user_id) in db)
         {
             Console.WriteLine($"  - {user_id}");
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
        } = "";                                          // Output Directory Path

        static void Main(string[] args)
        {
            // Parse Command-Line Args
            ParseOptions(args);

            // Load DataBase
            var database = new rsid_utility.DataBase();

            foreach (var input in inputs)
            {
                var attributes = File.GetAttributes(input);
                if ((attributes & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    database.LoadDirectory(input);
                }
                if ((attributes & FileAttributes.Archive) == FileAttributes.Archive)
                {
                    database.LoadFile(input);
                }
            }

            // Merge Each DataBases To One File
            database.SaveFile(output);
        }