public API(IFetcher fetcher, string baseAddress, string mediusRequestHeader_XUserContext, string csrfToken) { this.fetcher = fetcher; this.baseAddress = baseAddress; this.mediusRequestHeader_XUserContext = mediusRequestHeader_XUserContext; this.csrfToken = csrfToken; }
public FactoryHostedService( IFetcher fetcher, ILogger <FactoryHostedService> logger) { _fetcher = fetcher; _logger = logger; }
public ExchangesHostedService( IFetcher exchangeFetcher, ILogger <ExchangesHostedService> logger) { _exchangeFetcher = exchangeFetcher; _logger = logger; }
//Constructor public BooksController(IFetcher myService, ICopyUpdater copyUpdaterService, IAdder adderService, ILogger <BooksController> logger) { _myService = myService; _copyUpdaterService = copyUpdaterService; _adderService = adderService; _logger = logger; }
public Crawler(IRepository <string> urlRepository, IHtmlParser htmlParser, IFetcher htmlFetcher) { this.urlRepository = urlRepository; this.htmlParser = htmlParser; this.htmlFetcher = htmlFetcher; this.visitedUrls = new HashSet <string>(); this.downloadedImgs = new HashSet <string>(); }
public ManageShowsController( IRepository<ApplicationUser, string> users, IAppSettings appSettings, IFetcher fetcher, ManageShowsService manageShowsService) : base(users, appSettings) { this.Fetcher = fetcher; this.ManageShowsService = manageShowsService; }
/// <summary> /// Creates a new external JSON solver. /// </summary> /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param> /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param> /// <param name="fetcher">Used to download implementations of the external solver.</param> /// <param name="executor">Used to launch the external solver.</param> /// <param name="externalSolverUri">The feed URI used to get the external solver.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public ExternalSolver(ISolver backingSolver, ISelectionsManager selectionsManager, IFetcher fetcher, IExecutor executor, FeedUri externalSolverUri, IFeedManager feedManager, ITaskHandler handler) { _backingSolver = backingSolver ?? throw new ArgumentNullException(nameof(backingSolver)); _selectionsManager = selectionsManager ?? throw new ArgumentNullException(nameof(selectionsManager)); _fetcher = fetcher ?? throw new ArgumentNullException(nameof(fetcher)); _executor = executor ?? throw new ArgumentNullException(nameof(executor)); _feedManager = feedManager ?? throw new ArgumentNullException(nameof(feedManager)); _handler = handler ?? throw new ArgumentNullException(nameof(handler)); _solverRequirements = new Requirements(externalSolverUri ?? throw new ArgumentNullException(nameof(externalSolverUri))); }
internal static ThenStep Then <T>(Scenario scenario, IFetcher <T> fetcher, IMatcher <T> matcher) { scenario.Step("Then(IFetcher<{0}>,IMatcher<{0}>({1}))", typeof(T).Name, matcher.GetType().Name); scenario.InjectDependencies(fetcher); scenario.InjectDependencies(matcher); T result = scenario.InvokeOrFailReturningResult(fetcher.Fetch); return(InternalMatch(scenario, result, matcher)); }
public void CanUseSetupResultAndIgnoreArguments_WhenUsingUnorderedBlock() { IFetcher fetcher = MockRepository.Mock <IFetcher>(); fetcher.Expect(x => x.GetUsersWithCriteriaLike(null)) .IgnoreArguments() .Return(new Student[] { new Student(), new Student() }); Assert.Equal(2, fetcher.GetUsersWithCriteriaLike("foo").Length); fetcher.VerifyAllExpectations(); }
public ProjectionTrack(IFetcher fetcher, IDocumentStore store, IProjection projection, IDaemonLogger logger, IDaemonErrorHandler errorHandler) { _fetcher = fetcher; _projection = projection; _logger = logger; _errorHandler = errorHandler; _store = store; _events = store.Schema.Events; ViewType = _projection.Produces; }
public async static Task <FetchResponse> Request(IFetcher fetch, string url, string method = "GET", object body = null, Dictionary <string, string> headerOverrides = null) { var headers = GetHeaders(headerOverrides); return(await fetch.Fetch(url, new FetchConfig { Method = MethodMode.Parse(method), Body = body, Mode = CorsMode.Cors, Headers = headers, Credentials = CredentialsMode.Include, ReferrerPolicy = ReferrerPolicyMode.NoReferrerWhenDowngrade })); }
public ProjectionTrack(IFetcher fetcher, DocumentStore store, IProjection projection, IDaemonLogger logger, IDaemonErrorHandler errorHandler, ITenant tenant) { _fetcher = fetcher; _projection = projection; _logger = logger; _errorHandler = errorHandler; _tenant = tenant; _store = store; _events = store.Events; ViewType = _projection.ProjectedType(); }
public ShowService( IMappingEngine mappingEngine, ShowManager showManager, EpisodeManager episodeManager, SubscriptionManager subscriptionManager, IFetcher fetcher) { this.MappingEngine = mappingEngine; this.ShowManager = showManager; this.EpisodeManager = episodeManager; this.SubscriptionManager = subscriptionManager; this.Fetcher = fetcher; }
public MegaService(IAccountService accountService, IHttpApiClientRequestBuilderFactory iHttpApiClientRequestBuilderFactory, Toastr toastr, LocalStorage localStorage, HttpClient httpClient, IUtil util, IFetcher fetcher, IUriHelper uriHelper, ISweetAlert sweetAlert) { AccountService = accountService; HttpApiClientRequestBuilderFactory = iHttpApiClientRequestBuilderFactory; Toastr = toastr; LocalStorage = localStorage; HttpClient = httpClient; Util = util; Fetcher = fetcher; UriHelper = uriHelper; SweetAlert = sweetAlert; }
public Crawler(CrawlerConfig config, IUrlFrontier urlFrontier, IFetcher fetcher, ISimilarContentManager similarContentManager, List <IUrlFilter> urlFilters) { mConfig = config; Status = CrawlerStatus.STOPPED; mUrlFrontier = urlFrontier; mFetcher = fetcher; mSimilarContentJudger = similarContentManager; mUrlFilters = urlFilters; mLogger = new RuntimeLogger(Path.Combine(config.LogDirectory, "Crawler.Log"), true); mErrorLogger = new RuntimeLogger(Path.Combine(config.LogDirectory, "Crawler Error.Log"), false); }
public void CanUseSetupResultAndIgnoreArguments_WhenUsingUnorderedBlock() { MockRepository mocks = new MockRepository(); IFetcher fetcher = mocks.DynamicMock <IFetcher>(); using (mocks.Unordered()) { SetupResult.For(fetcher.GetUsersWithCriteriaLike(null)).IgnoreArguments().Return( new Student[] { new Student(), new Student() }); } mocks.ReplayAll(); Assert.Equal(2, fetcher.GetUsersWithCriteriaLike("foo").Length); }
/// <summary> /// Creates a wearables JSON patch using the configured fetcher. /// </summary> /// <param name="fetcher">Item fetcher.</param> /// <param name="path">Path to file or directory to fetch from.</param> /// <returns>Wearables JSON patch.</returns> public static JArray CreatePatch(IFetcher fetcher, string path, bool namesOnly = false, string[] parameters = null) { var wearables = CreateWearableList(); if (namesOnly) { fetcher.OnItemFound += (assetPath, assetData) => HandleItemName(assetPath, assetData, wearables); } else { fetcher.OnItemFound += (assetPath, assetData) => HandleItem(assetPath, assetData, wearables, parameters); } fetcher.Fetch(path); return(CreatePatchFromWearables(wearables)); }
/// <summary> /// NDisconf初始化 /// 该方法理应在所有代码执行之前就被调用,否则可能会出现配置调用顺序错误 /// </summary> /// <param name="path"></param> private async Task Init(string path) { this._setting = this.GetSetting(path); this._fetcher = FetcherFactory.GetFetcher(this._setting); this._preservations = new IPreservation[] { new FilePreservation(this._setting.Preservation), new ItemPreservation(this._setting.Preservation) }; if (this._setting.EnableRemote) { await this._fallBackPolicy.ExecuteAsync(async() => { await RecoverAllConfigs().ConfigureAwait(false); }, new Dictionary <string, object> { { "Action", "RecoverAllConfigs" }, }).ConfigureAwait(false); } }
/// <summary> /// Creates a new external JSON solver. /// </summary> /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param> /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param> /// <param name="fetcher">Used to download implementations of the external solver.</param> /// <param name="executor">Used to launch the external solver.</param> /// <param name="config">User settings controlling network behaviour, solving, etc.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public ExternalSolver([NotNull] ISolver backingSolver, [NotNull] ISelectionsManager selectionsManager, [NotNull] IFetcher fetcher, [NotNull] IExecutor executor, [NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] ITaskHandler handler) { #region Sanity checks if (backingSolver == null) { throw new ArgumentNullException(nameof(backingSolver)); } if (selectionsManager == null) { throw new ArgumentNullException(nameof(selectionsManager)); } if (fetcher == null) { throw new ArgumentNullException(nameof(fetcher)); } if (executor == null) { throw new ArgumentNullException(nameof(executor)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } if (feedManager == null) { throw new ArgumentNullException(nameof(feedManager)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } #endregion _backingSolver = backingSolver; _selectionsManager = selectionsManager; _fetcher = fetcher; _executor = executor; _feedManager = feedManager; _handler = handler; _solverRequirements = new Requirements(config.ExternalSolverUri); }
/// <summary> /// Creates a new external JSON solver. /// </summary> /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param> /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param> /// <param name="fetcher">Used to download implementations of the external solver.</param> /// <param name="executor">Used to launch the external solver.</param> /// <param name="config">User settings controlling network behaviour, solving, etc.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public ExternalSolver([NotNull] ISolver backingSolver, [NotNull] ISelectionsManager selectionsManager, [NotNull] IFetcher fetcher, [NotNull] IExecutor executor, [NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] ITaskHandler handler) { #region Sanity checks if (backingSolver == null) throw new ArgumentNullException(nameof(backingSolver)); if (selectionsManager == null) throw new ArgumentNullException(nameof(selectionsManager)); if (fetcher == null) throw new ArgumentNullException(nameof(fetcher)); if (executor == null) throw new ArgumentNullException(nameof(executor)); if (config == null) throw new ArgumentNullException(nameof(config)); if (feedManager == null) throw new ArgumentNullException(nameof(feedManager)); if (handler == null) throw new ArgumentNullException(nameof(handler)); #endregion _backingSolver = backingSolver; _selectionsManager = selectionsManager; _fetcher = fetcher; _executor = executor; _feedManager = feedManager; _handler = handler; _solverRequirements = new Requirements(config.ExternalSolverUri); }
public EquipmentCategoryController(ICommandService commandService, IEquipmentCategoryQueryService userQuery, IFetcher fetcher) { _commandService = commandService; _categoryQuery = userQuery; _fetcher = fetcher; }
public AccountService(HttpClient http, IFetcher fetcher) { _http = http; _fetcher = fetcher; }
public UserQueryService(IFetcher fetcher) { _fetcher = fetcher; }
public static Converter <TFrom> Convert <TFrom>(this IFetcher <TFrom> fetcher) { return(new Converter <TFrom>(fetcher)); }
public Converter(IFetcher <TFrom> fetcher) { _fetcher = fetcher; }
public EquipmentInfoQueryService(IFetcher fetcher) { _fetcher = fetcher; }
public AndroidNetwork(IFetcher fetcher) { _fetcher = fetcher; }
public AndroidNetwork() { _fetcher = MXContainer.Resolve <IFetcher>(); }
public RoleQueryService(IFetcher fetcher) { _fetcher = fetcher; }
/// <summary> /// /// </summary> private FetchManager() { _policy = GetFixedRetryPolicy(config.UpdateStrategy.RetryTimes, config.UpdateStrategy.RetryIntervalSeconds); _fetcher = new Fetcher(config.WebApiHost, _policy); }
public Repository(IFetcher fetcher, IFilter filter) { _fetcher = fetcher; _filter = filter; }
public InvoiceScraper(IFetcher fetcher, string rootAddress, string xusercontext, string csrfToken) { api = new API(fetcher, rootAddress, xusercontext, csrfToken); }
private static void FetchWorldData(VaultContext context, List <World> worlds, Dictionary <String, LocaleSettings> hostLocales, String hostname, bool overwrite) { var host = HostFor(hostname); var localeSettings = hostLocales.ContainsKey(host) ? hostLocales[host] : null; var fetchers = new IFetcher[] { new BuildingFetcher(), new ConfigFetcher() { Overwrite = overwrite, DefaultTimeZoneId = localeSettings?.TimeZoneId ?? "Europe/London" }, new UnitFetcher() }; var world = worlds.Where(w => w.Hostname == hostname).SingleOrDefault(); if (world == null) { short translationId; if (localeSettings != null) { translationId = localeSettings.DefaultTranslationId; } else { translationId = 1; Console.WriteLine($"Warning: No default translation could be found for {hostname}, defaulting to primary English translation."); } world = new World { Name = hostname.Split('.')[0], Hostname = hostname, DefaultTranslationId = translationId }; context.Add(world); } var pendingFetchers = fetchers.Where(f => f.NeedsUpdate(world)).ToList(); if (pendingFetchers.Count > 0) { Console.WriteLine("Pulling for world {0}...", world.Hostname); } else { Console.WriteLine("World {0} is up to date", world.Hostname); } var baseUrl = $"https://{world.Hostname}"; foreach (var fetcher in pendingFetchers) { var url = $"{baseUrl}{fetcher.Endpoint}"; Console.Write("Fetching {0} ... ", url); Console.Out.Flush(); var response = httpClient.GetAsync(url).Result; if ((int)response.StatusCode >= 300 && (int)response.StatusCode < 400) { Console.WriteLine("Warning: server {0} seems to have ended (redirection occurred)", world.Hostname); break; } if (!response.IsSuccessStatusCode) { Console.WriteLine("ERROR: Request failed with code {0}", response.StatusCode); Environment.ExitCode = 1; continue; } Console.Write("Processing... "); Console.Out.Flush(); var data = response.Content.ReadAsStringAsync().Result; fetcher.Process(context, world, data); Console.WriteLine("Done."); } var worldSettings = context.WorldSettings.Where(s => s.WorldId == world.Id).First(); String timezoneId; if (localeSettings != null) { timezoneId = hostLocales[host].TimeZoneId; } else { Console.WriteLine($"Warning: No timezone ID could be found for {hostname}, please manually enter a timezone ID for the server."); Console.WriteLine("An exhaustive list of Timezone IDs can be found at: https://nodatime.org/TimeZones"); Console.WriteLine("(The default for .net and .co.uk is 'Europe/London'.)"); do { Console.Write("Timezone ID: "); timezoneId = Console.ReadLine().Trim(); if (NodaTime.TimeZones.TzdbDateTimeZoneSource.Default.ForId(timezoneId) == null) { Console.WriteLine("Invalid ID: " + timezoneId); timezoneId = null; } } while (timezoneId == null); hostLocales.Add(host, new LocaleSettings { DefaultTranslationId = world.DefaultTranslationId, TimeZoneId = timezoneId }); } worldSettings.TimeZoneId = timezoneId; context.SaveChanges(); }