Example #1
0
        public WurmServers(
            IWurmLogsHistory wurmLogsHistory,
            IWurmLogsMonitorInternal wurmLogsMonitor,
            IWurmServerList wurmServerList,
            IHttpWebRequests httpWebRequests,
            string dataDirectory,
            IWurmCharacterDirectories wurmCharacterDirectories,
            IWurmServerHistory wurmServerHistory,
            ILogger logger)
        {
            if (wurmLogsHistory == null) throw new ArgumentNullException("wurmLogsHistory");
            if (wurmLogsMonitor == null) throw new ArgumentNullException("wurmLogsMonitor");
            if (wurmServerList == null) throw new ArgumentNullException("wurmServerList");
            if (httpWebRequests == null) throw new ArgumentNullException("httpWebRequests");
            if (dataDirectory == null) throw new ArgumentNullException("dataDirectory");
            if (wurmCharacterDirectories == null) throw new ArgumentNullException("wurmCharacterDirectories");
            if (wurmServerHistory == null) throw new ArgumentNullException("wurmServerHistory");
            if (logger == null) throw new ArgumentNullException("logger");

            liveLogsDataQueue = new LiveLogsDataQueue(wurmLogsMonitor);
            LiveLogs liveLogs = new LiveLogs(liveLogsDataQueue, wurmServerHistory);

            persistentCollectionsLibrary =
                new PersistentCollectionsLibrary(new FlatFilesPersistenceStrategy(dataDirectory),
                    new PersObjErrorHandlingStrategy(logger));
            var persistent = persistentCollectionsLibrary.DefaultCollection.GetObject<ServersData>("WurmServers");
            LogHistorySaved logHistorySaved = new LogHistorySaved(persistent);
            LogHistory logHistory = new LogHistory(wurmLogsHistory, wurmCharacterDirectories, wurmServerHistory, logHistorySaved, new LogEntriesParser());

            WebFeeds webFeeds = new WebFeeds(httpWebRequests, wurmServerList, logger);

            runner = new QueuedJobsSyncRunner<Job, JobResult>(new JobRunner(liveLogs, logHistory, webFeeds, persistentCollectionsLibrary), logger);

            wurmServerFactory = new WurmServerFactory(runner);

            var descriptions = wurmServerList.All;
            foreach (var serverDescription in descriptions)
            {
                RegisterServer(serverDescription);
            }
        }
Example #2
0
 public JobRunner([NotNull] LiveLogs liveLogs, [NotNull] LogHistory logHistory, [NotNull] WebFeeds webFeeds,
                  [NotNull] PersistentCollectionsLibrary persistentCollectionsLibrary)
 {
     if (liveLogs == null)
     {
         throw new ArgumentNullException(nameof(liveLogs));
     }
     if (logHistory == null)
     {
         throw new ArgumentNullException(nameof(logHistory));
     }
     if (webFeeds == null)
     {
         throw new ArgumentNullException(nameof(webFeeds));
     }
     if (persistentCollectionsLibrary == null)
     {
         throw new ArgumentNullException(nameof(persistentCollectionsLibrary));
     }
     this.liveLogs   = liveLogs;
     this.logHistory = logHistory;
     this.webFeeds   = webFeeds;
     this.persistentCollectionsLibrary = persistentCollectionsLibrary;
 }
Example #3
0
        public WurmServers(
            [NotNull] IWurmLogsHistory wurmLogsHistory,
            [NotNull] IWurmLogsMonitorInternal wurmLogsMonitor,
            [NotNull] IWurmServerList wurmServerList,
            [NotNull] IHttpWebRequests httpWebRequests,
            [NotNull] string dataDirectory,
            [NotNull] IWurmCharacterDirectories wurmCharacterDirectories,
            [NotNull] IWurmServerHistory wurmServerHistory,
            [NotNull] IWurmApiLogger logger,
            [NotNull] IWurmServerGroups wurmServerGroups,
            [NotNull] IWurmApiConfig wurmApiConfig)
        {
            if (wurmLogsHistory == null)
            {
                throw new ArgumentNullException(nameof(wurmLogsHistory));
            }
            if (wurmLogsMonitor == null)
            {
                throw new ArgumentNullException(nameof(wurmLogsMonitor));
            }
            if (wurmServerList == null)
            {
                throw new ArgumentNullException(nameof(wurmServerList));
            }
            if (httpWebRequests == null)
            {
                throw new ArgumentNullException(nameof(httpWebRequests));
            }
            if (dataDirectory == null)
            {
                throw new ArgumentNullException(nameof(dataDirectory));
            }
            if (wurmCharacterDirectories == null)
            {
                throw new ArgumentNullException(nameof(wurmCharacterDirectories));
            }
            if (wurmServerHistory == null)
            {
                throw new ArgumentNullException(nameof(wurmServerHistory));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (wurmServerGroups == null)
            {
                throw new ArgumentNullException(nameof(wurmServerGroups));
            }
            if (wurmApiConfig == null)
            {
                throw new ArgumentNullException(nameof(wurmApiConfig));
            }

            this.wurmServerGroups = wurmServerGroups;
            this.wurmApiConfig    = wurmApiConfig;

            liveLogsDataQueue = new LiveLogsDataQueue(wurmLogsMonitor);
            LiveLogs liveLogs = new LiveLogs(liveLogsDataQueue, wurmServerHistory);

            IPersistenceStrategy persistenceStrategy = new FlatFilesPersistenceStrategy(dataDirectory);

            persistentCollectionsLibrary =
                new PersistentCollectionsLibrary(persistenceStrategy,
                                                 new PersObjErrorHandlingStrategy(logger));
            var             persistent      = persistentCollectionsLibrary.DefaultCollection.GetObject <ServersData>("WurmServers");
            LogHistorySaved logHistorySaved = new LogHistorySaved(persistent);
            LogHistory      logHistory      = new LogHistory(wurmLogsHistory,
                                                             wurmCharacterDirectories,
                                                             wurmServerHistory,
                                                             logHistorySaved,
                                                             new LogEntriesParser(),
                                                             logger);

            WebFeeds webFeeds = new WebFeeds(httpWebRequests, wurmServerList, logger);

            runner = new QueuedJobsSyncRunner <Job, JobResult>(new JobRunner(liveLogs, logHistory, webFeeds, persistentCollectionsLibrary), logger);

            wurmServerFactory = new WurmServerFactory(runner);

            var descriptions = wurmServerList.All;

            foreach (var serverDescription in descriptions)
            {
                RegisterServer(serverDescription);
            }
        }