Example #1
0
        public static SearcherDatabase Load(string databaseDirectory)
        {
            if (!Directory.Exists(databaseDirectory))
            {
                throw new InvalidOperationException("databaseDirectory not found.");
            }

            var database = new SearcherDatabase(databaseDirectory, null);

            database.LoadFromFile();

            return(database);
        }
Example #2
0
        public static SearcherDatabase Create(
            List <SearcherItem> items,
            string databaseDirectory,
            bool serializeToFile = true
            )
        {
            if (serializeToFile && databaseDirectory != null && !Directory.Exists(databaseDirectory))
            {
                Directory.CreateDirectory(databaseDirectory);
            }

            var database = new SearcherDatabase(databaseDirectory, items);

            if (serializeToFile)
            {
                database.SerializeToFile();
            }

            return(database);
        }