Exemplo n.º 1
0
        public SearchClient(SearchConfig config)
        {
            //

            EngineOptions = config.SearchEngines;

            SearchEngines = GetAllEngines()
                            .Where(e => EngineOptions.HasFlag(e.Engine))
                            .ToArray();


            UploadEngine = config.UseImgur ? new ImgurClient() : new ImgOpsEngine();

            /*
             *
             */


            var imageInfo = ResolveUploadUrl(config.ImageInput);


            ImageInfo = imageInfo ?? throw new SmartImageException("Image invalid or upload failed");

            OriginalImageResult = FullSearchResult.GetOriginalImageResult(ImageInfo);


            /*
             *
             */

            config.EnsureConfig();

            //

            Results = CreateSearchResults();


            //

            SearchTasks = CreateSearchTasks();

            IsComplete = false;

            //
        }