Esempio n. 1
0
        public WurmLogsHistory([NotNull] IWurmLogFiles wurmLogFiles, [NotNull] ILogger logger,
            [NotNull] string heuristicsDataDirectory, [NotNull] LogFileStreamReaderFactory logFileStreamReaderFactory,
            [NotNull] IWurmApiConfig wurmApiConfig)
        {
            if (wurmLogFiles == null) throw new ArgumentNullException("wurmLogFiles");
            if (logger == null) throw new ArgumentNullException("logger");
            if (heuristicsDataDirectory == null) throw new ArgumentNullException("heuristicsDataDirectory");
            if (logFileStreamReaderFactory == null) throw new ArgumentNullException("logFileStreamReaderFactory");
            if (wurmApiConfig == null) throw new ArgumentNullException("wurmApiConfig");

            var persistentLibrary =
                new PersistentCollectionsLibrary(new FlatFilesPersistenceStrategy(heuristicsDataDirectory),
                    new PersObjErrorHandlingStrategy(logger));
            var heuristicsCollection = persistentLibrary.GetCollection("heuristics");

            var logsScannerFactory = new LogsScannerFactory(
                new LogFileParserFactory(logger),
                logFileStreamReaderFactory,
                new MonthlyLogFilesHeuristics(
                    heuristicsCollection,
                    wurmLogFiles,
                    new MonthlyHeuristicsExtractorFactory(logFileStreamReaderFactory, logger, wurmApiConfig)),
                wurmLogFiles,
                logger,
                wurmApiConfig);

            runner =
                new QueuedJobsSyncRunner<LogSearchParameters, ScanResult>(
                    new ScanJobExecutor(logsScannerFactory, persistentLibrary, logger),
                    logger);
        }
Esempio n. 2
0
        public WurmLogsHistory([NotNull] IWurmLogFiles wurmLogFiles, [NotNull] IWurmApiLogger logger,
                               [NotNull] string heuristicsDataDirectory, [NotNull] LogFileStreamReaderFactory logFileStreamReaderFactory,
                               [NotNull] IWurmApiConfig wurmApiConfig)
        {
            if (wurmLogFiles == null)
            {
                throw new ArgumentNullException(nameof(wurmLogFiles));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (heuristicsDataDirectory == null)
            {
                throw new ArgumentNullException(nameof(heuristicsDataDirectory));
            }
            if (logFileStreamReaderFactory == null)
            {
                throw new ArgumentNullException(nameof(logFileStreamReaderFactory));
            }
            if (wurmApiConfig == null)
            {
                throw new ArgumentNullException(nameof(wurmApiConfig));
            }

            IPersistenceStrategy persistenceStrategy = new FlatFilesPersistenceStrategy(heuristicsDataDirectory);

            var persistentLibrary =
                new PersistentCollectionsLibrary(persistenceStrategy,
                                                 new PersObjErrorHandlingStrategy(logger));
            var heuristicsCollection = persistentLibrary.GetCollection("heuristics");

            var logsScannerFactory = new LogsScannerFactory(
                new LogFileParserFactory(logger),
                logFileStreamReaderFactory,
                new MonthlyLogFilesHeuristics(
                    heuristicsCollection,
                    wurmLogFiles,
                    new MonthlyHeuristicsExtractorFactory(logFileStreamReaderFactory, logger, wurmApiConfig)),
                wurmLogFiles,
                logger,
                wurmApiConfig);

            runner =
                new QueuedJobsSyncRunner <LogSearchParameters, ScanResult>(
                    new ScanJobExecutor(logsScannerFactory, persistentLibrary, logger),
                    logger);
        }
Esempio n. 3
0
 public ScanJobExecutor([NotNull] LogsScannerFactory logsScannerFactory,
                        [NotNull] PersistentCollectionsLibrary persistentLibrary, [NotNull] IWurmApiLogger logger)
 {
     if (logsScannerFactory == null)
     {
         throw new ArgumentNullException(nameof(logsScannerFactory));
     }
     if (persistentLibrary == null)
     {
         throw new ArgumentNullException(nameof(persistentLibrary));
     }
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     this.logsScannerFactory = logsScannerFactory;
     this.persistentLibrary  = persistentLibrary;
     this.logger             = logger;
 }