public SourceCreatorTreeNode(ISourceFactory factory, Type baseType, IList<Type> creatorTypes) { m_type = baseType; if (!m_type.IsAbstract) { m_instance = Activator.CreateInstance(m_type, factory) as ISourceCreator; m_instance.Init(); } var childCreatorTypes = creatorTypes.Where(t => t.BaseType == m_type).ToList(); if (childCreatorTypes.Count > 0) { // remove children from search creatorTypes = creatorTypes.Except(childCreatorTypes).ToList(); m_childCreatorNodes = childCreatorTypes.Select(t => new SourceCreatorTreeNode(factory, t, creatorTypes)).ToList(); } }
protected override void ProcessFtp(ISourceFactory factory) { using (var hostManager = AutoDiscover == true ? new DynamicHostManager(Config, new NetworkScanner(TaskPoolScheduler.Default), TaskPoolScheduler.Default) : (IHostManager) new StaticHostManager(Config.Known)) { CancellationToken token = CancellationToken.None; if (Config.TimeOut.HasValue) { CancellationTokenSource tokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(Config.TimeOut.Value)); token = tokenSource.Token; } var downloaders = factory.GetSources(hostManager); var tasks = downloaders.Select(ftpDownloader => ftpDownloader.Download(token)); var archiving = new DeleteArchiving(); if (Archive.HasValue) { log.Info("Archiving..."); archiving.Archive(Out, TimeSpan.FromDays(Archive.Value)); } Task.WhenAll(tasks).Wait(token); } }
public ISourceRegistration <T> CreateAndRegisterSource(ISourceFactory <T> factory) { var source = factory.CreateSource(); var registration = new RegisteredEnergyObservationSourceWrapper <T>(this, source); _registeredSources.Add(registration); return(registration); }
public FileWorker(DataBase dataBase, IDbWriterFactory dbWriterFactory, ISourceFactory sourceFactory) { _sourceFactory = sourceFactory; DataBase = dataBase; _dbWriter = dbWriterFactory.GetDbWriter(dataBase.Settings.DefaultSource); }
protected override void ProcessFtp(ISourceFactory downloaders) { var instance = new MonitoringInstance(TaskPoolScheduler.Default, Config, downloaders, new DeleteArchiving()); if (instance.Start()) { log.Info("Press enter to stop monitoring..."); System.Console.ReadLine(); instance.Stop(); } }
public MonitoringInstance(IScheduler scheduler, MonitoringConfig configuration, ISourceFactory downloaderFactory, IDeleteArchiving archiving) { Guard.NotNull(() => configuration, configuration); Guard.NotNull(() => scheduler, scheduler); Guard.NotNull(() => downloaderFactory, downloaderFactory); Guard.NotNull(() => archiving, archiving); this.configuration = configuration; this.archiving = archiving; this.scheduler = scheduler; this.downloaderFactory = downloaderFactory; }
public SystemSurfaceController(IOrderItemManager orderItemManager, INotifier notifier, IExchangeMailWebApi exchangeMailWebApi, IUmbracoWrapper dataTypes, ISourceFactory sourceFactory, IOrderItemSearcher orderItemsSearcher, IAutomaticMailSendingEngine automaticMailSendingEngine, IUmbracoWrapper umbraco) { _orderItemManager = orderItemManager; _notifier = notifier; _exchangeMailWebApi = exchangeMailWebApi; _dataTypes = dataTypes; _sourceFactory = sourceFactory; _orderItemsSearcher = orderItemsSearcher; _automaticMailSendingEngine = automaticMailSendingEngine; _umbraco = umbraco; }
public static SourceCreatorTreeNode CreateImplementationHeirarchy(ISourceFactory factory) { Type baseType = factory.CreatorType; AppDomain app = AppDomain.CurrentDomain; var assemblies = app.GetAssemblies(); var creatorTypes = assemblies .SelectMany(a => a.GetTypes()) .Where(t => !t.IsInterface && baseType.IsAssignableFrom(t)) .ToList(); var rootCreatorNode = new SourceCreatorTreeNode(factory, baseType, creatorTypes); return rootCreatorNode; }
public BlipVideoDownloadSourceCreator(ISourceFactory factory) : base(factory) { }
public Configuration(ISourceFactory sourceFactory, List <IPersistentCollector> collectors) { this.sourceFactory = sourceFactory; this.persistentCollectors = collectors; }
protected VideoDownloadSourceCreator(ISourceFactory factory) : base(factory) { }
protected SourceCreatorBase(ISourceFactory factory) { Factory = factory; }
private static void ProcessFactoriesInApp() { Console.WriteLine("Choose source factory to work with."); int i = 0; foreach (var appSourceFactory in App.SourceFactories) { ++i; Console.WriteLine($"{i}: {appSourceFactory.GetType()}"); } var userChoiceIsValid = false; ISourceFactory <FlashObservation> sourceFactory = null; if (App.SourceFactories.Count == 0) { sourceFactory = new RandomEnergySourceFactory(new Logger()); Console.WriteLine($"The source factory is not defined in plugin, so it will be {nameof(RandomEnergySource)}"); } else { while (!userChoiceIsValid) { if (TryReadUserInput(0, App.SourceFactories.Count, out int userChoice)) { userChoiceIsValid = true; sourceFactory = App.SourceFactories.ElementAt(userChoice - 1); } } } Console.WriteLine("Choose processing factory to work with."); i = 0; foreach (var appProcessingFactory in App.ProcessingFactories) { ++i; Console.WriteLine($"{i}: {appProcessingFactory.GetType()}"); } IProcessingFactory <FlashObservation> processingFactory = null; userChoiceIsValid = false; while (!userChoiceIsValid !) { if (TryReadUserInput(0, App.ProcessingFactories.Count, out int userChoice)) { userChoiceIsValid = true; processingFactory = App.ProcessingFactories.ElementAt(userChoice - 1); } } Console.WriteLine($"Processing source factory {sourceFactory.GetType()}..."); ISourceRegistration <FlashObservation> sourceRegistration = App.CreateAndRegisterSource(sourceFactory); IProcessingGroup <FlashObservation> processingGroup = sourceRegistration.AttachProcessingGroup(processingFactory); SourceRegistrations.Add(sourceRegistration); Console.WriteLine("Click Ctrl+C to stop generating values"); sourceRegistration.Start().Wait(); ProcessAnalyzer(processingGroup.Analizer); }
protected VideoChannelSourceCreator(ISourceFactory factory) : base(factory) { }
public FileWorkerFactory(IDbWriterFactory dbWriterFactory, ISourceFactory sourceFactory) { _dbWriterFactory = dbWriterFactory; _sourceFactory = sourceFactory; }
protected HttpChannelSourceCreator(ISourceFactory factory) : base(factory) { }
public HostDownloadSourceCreator(ISourceFactory factory) : base(factory) { }
public YoutubeVideoDownloadSourceCreator(ISourceFactory factory) : base(factory) { }
protected abstract void ProcessFtp(ISourceFactory downloaders);
protected ChannelSourceCreator(ISourceFactory factory) : base(factory) { SourceType = typeof(IChannelSource); }
protected DownloadSourceCreator(ISourceFactory factory) : base(factory) { SourceType = typeof(IDownloadSource); }