public async Task <DataPool> FromOptions(DataPoolOptions options)
        {
            DataPool pool = options switch
            {
                InfiniteDataPoolOptions x => new InfiniteDataPool(x.WordlistType),
                CombinationsDataPoolOptions x => new CombinationsDataPool(x.CharSet, x.Length, x.WordlistType),
                RangeDataPoolOptions x => new RangeDataPool(x.Start, x.Amount, x.Step, x.Pad, x.WordlistType),
                FileDataPoolOptions x => new FileDataPool(x.FileName, x.WordlistType),
                WordlistDataPoolOptions x => await MakeWordlistDataPool(x),
                _ => throw new NotImplementedException()
            };

            return(pool);
        }
        public WordlistDataPoolOptionsViewModel(WordlistDataPoolOptions options) : base(options)
        {
            wordlistRepo = SP.GetService <IWordlistRepository>();

            if (options.WordlistId != -1)
            {
                wordlist = wordlistRepo.Get(options.WordlistId).Result;
            }

            // If the wordlist was not found (e.g. deleted)
            if (wordlist is null)
            {
                options.WordlistId = -1;
            }
        }
        private async Task <DataPool> MakeWordlistDataPool(WordlistDataPoolOptions options)
        {
            var entity = await wordlistRepo.Get(options.WordlistId);

            // If the entity was deleted
            if (entity == null)
            {
                Console.WriteLine($"Wordlist entity not found: {options.WordlistId}");
                return(new InfiniteDataPool());
            }

            if (!File.Exists(entity.FileName))
            {
                Console.WriteLine($"Wordlist file not found: {entity.FileName}");
                return(new InfiniteDataPool());
            }

            var factory = new WordlistFactory(ruriLibSettings);

            return(new WordlistDataPool(factory.FromEntity(entity)));
        }