public LogsScannerFactory( LogFileParserFactory logFileParserFactory, LogFileStreamReaderFactory streamReaderFactory, MonthlyLogFilesHeuristics heuristics, IWurmLogFiles wurmLogFiles, ILogger logger, [NotNull] IWurmApiConfig wurmApiConfig) { if (logFileParserFactory == null) throw new ArgumentNullException("logFileParserFactory"); if (streamReaderFactory == null) throw new ArgumentNullException("streamReaderFactory"); if (heuristics == null) throw new ArgumentNullException("heuristics"); if (wurmLogFiles == null) throw new ArgumentNullException("wurmLogFiles"); if (logger == null) throw new ArgumentNullException("logger"); if (wurmApiConfig == null) throw new ArgumentNullException("wurmApiConfig"); this.logFileParserFactory = logFileParserFactory; this.streamReaderFactory = streamReaderFactory; this.heuristics = heuristics; this.wurmLogFiles = wurmLogFiles; this.logger = logger; this.wurmApiConfig = wurmApiConfig; }
public LogsScanner( [NotNull] LogSearchParameters logSearchParameters, [NotNull] JobCancellationManager cancellationManager, [NotNull] IWurmLogFiles wurmLogFiles, [NotNull] MonthlyLogFilesHeuristics monthlyHeuristics, [NotNull] LogFileStreamReaderFactory streamReaderFactory, [NotNull] ILogger logger, [NotNull] LogFileParserFactory logFileParserFactory, [NotNull] IWurmApiConfig wurmApiConfig) { if (logSearchParameters == null) throw new ArgumentNullException("logSearchParameters"); if (cancellationManager == null) throw new ArgumentNullException("cancellationManager"); if (wurmLogFiles == null) throw new ArgumentNullException("wurmLogFiles"); if (monthlyHeuristics == null) throw new ArgumentNullException("monthlyHeuristics"); if (streamReaderFactory == null) throw new ArgumentNullException("streamReaderFactory"); if (logger == null) throw new ArgumentNullException("logger"); if (logFileParserFactory == null) throw new ArgumentNullException("logFileParserFactory"); if (wurmApiConfig == null) throw new ArgumentNullException("wurmApiConfig"); this.logSearchParameters = logSearchParameters; this.cancellationManager = cancellationManager; this.wurmLogFiles = wurmLogFiles; this.monthlyHeuristics = monthlyHeuristics; this.streamReaderFactory = streamReaderFactory; this.logger = logger; this.logFileParserFactory = logFileParserFactory; this.wurmApiConfig = wurmApiConfig; }
public MonthlyLogFilesHeuristics([NotNull] IPersistentCollection heuristicsPersistentCollection, IWurmLogFiles wurmLogFiles, MonthlyHeuristicsExtractorFactory monthlyHeuristicsExtractorFactory) { if (heuristicsPersistentCollection == null) throw new ArgumentNullException("heuristicsPersistentCollection"); if (wurmLogFiles == null) throw new ArgumentNullException("wurmLogFiles"); if (monthlyHeuristicsExtractorFactory == null) throw new ArgumentNullException("monthlyHeuristicsExtractorFactory"); this.heuristicsPersistentCollection = heuristicsPersistentCollection; this.wurmLogFiles = wurmLogFiles; this.monthlyHeuristicsExtractorFactory = monthlyHeuristicsExtractorFactory; }
public WurmServerHistory( [NotNull] string dataDirectoryFullPath, [NotNull] IWurmLogsHistory wurmLogsHistory, IWurmServerList wurmServerList, IWurmApiLogger logger, IWurmLogsMonitorInternal wurmLogsMonitor, IWurmLogFiles wurmLogFiles, IInternalEventAggregator internalEventAggregator, [NotNull] IWurmServerGroups wurmServerGroups, [NotNull] IWurmApiConfig wurmApiConfig) { if (dataDirectoryFullPath == null) { throw new ArgumentNullException(nameof(dataDirectoryFullPath)); } if (wurmLogsHistory == null) { throw new ArgumentNullException(nameof(wurmLogsHistory)); } if (wurmServerGroups == null) { throw new ArgumentNullException(nameof(wurmServerGroups)); } if (wurmApiConfig == null) { throw new ArgumentNullException(nameof(wurmApiConfig)); } this.wurmLogsHistory = wurmLogsHistory; this.wurmServerGroups = wurmServerGroups; this.wurmApiConfig = wurmApiConfig; IPersistenceStrategy persistenceStrategy = new FlatFilesPersistenceStrategy(dataDirectoryFullPath); var persistentLibrary = new PersistentCollectionsLibrary(persistenceStrategy, new PersObjErrorHandlingStrategy(logger)); var collection = persistentLibrary.GetCollection("serverhistory"); var providerFactory = new ServerHistoryProviderFactory( collection, wurmLogsHistory, wurmServerList, logger, wurmLogsMonitor, wurmLogFiles, internalEventAggregator); jobExecutor = new JobExecutor(providerFactory, persistentLibrary); runner = new QueuedJobsSyncRunner <object, ServerName>(jobExecutor, logger); }
public LogsScanner( [NotNull] LogSearchParameters logSearchParameters, [NotNull] JobCancellationManager cancellationManager, [NotNull] IWurmLogFiles wurmLogFiles, [NotNull] MonthlyLogFilesHeuristics monthlyHeuristics, [NotNull] LogFileStreamReaderFactory streamReaderFactory, [NotNull] IWurmApiLogger logger, [NotNull] LogFileParserFactory logFileParserFactory, [NotNull] IWurmApiConfig wurmApiConfig) { if (logSearchParameters == null) { throw new ArgumentNullException(nameof(logSearchParameters)); } if (cancellationManager == null) { throw new ArgumentNullException(nameof(cancellationManager)); } if (wurmLogFiles == null) { throw new ArgumentNullException(nameof(wurmLogFiles)); } if (monthlyHeuristics == null) { throw new ArgumentNullException(nameof(monthlyHeuristics)); } if (streamReaderFactory == null) { throw new ArgumentNullException(nameof(streamReaderFactory)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (logFileParserFactory == null) { throw new ArgumentNullException(nameof(logFileParserFactory)); } if (wurmApiConfig == null) { throw new ArgumentNullException(nameof(wurmApiConfig)); } this.logSearchParameters = logSearchParameters; this.cancellationManager = cancellationManager; this.wurmLogFiles = wurmLogFiles; this.monthlyHeuristics = monthlyHeuristics; this.streamReaderFactory = streamReaderFactory; this.logger = logger; this.logFileParserFactory = logFileParserFactory; this.wurmApiConfig = wurmApiConfig; }
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); }
public void Setup() { ClientMock.PopulateFromZip(Path.Combine(TestPaksZippedDirFullPath, "logs-samples-emptyfiles.7z")); TestGuyDirectoryInfo = new DirectoryInfo(ClientMock.InstallDirectory.FullPath) .GetDirectories("players") .Single() .GetDirectories("Testguy") .Single(); TotalFileCount = TestGuyDirectoryInfo.GetDirectories("logs").Single().GetFiles().Length; System = Fixture.WurmApiManager.WurmLogFiles; TestGuyLogFiles = System.GetForCharacter(TestGuyCharacterName); }
public ServerHistoryProviderFactory( IPersistentCollection persistentCollection, IWurmLogsHistory wurmLogsHistory, IWurmServerList wurmServerList, IWurmApiLogger logger, IWurmLogsMonitorInternal wurmLogsMonitor, IWurmLogFiles wurmLogFiles, [NotNull] IInternalEventAggregator internalEventAggregator) { if (persistentCollection == null) { throw new ArgumentNullException(nameof(persistentCollection)); } if (wurmLogsHistory == null) { throw new ArgumentNullException(nameof(wurmLogsHistory)); } if (wurmServerList == null) { throw new ArgumentNullException(nameof(wurmServerList)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (wurmLogsMonitor == null) { throw new ArgumentNullException(nameof(wurmLogsMonitor)); } if (wurmLogFiles == null) { throw new ArgumentNullException(nameof(wurmLogFiles)); } if (internalEventAggregator == null) { throw new ArgumentNullException(nameof(internalEventAggregator)); } this.persistentCollection = persistentCollection; this.wurmLogsHistory = wurmLogsHistory; this.wurmServerList = wurmServerList; this.logger = logger; this.wurmLogsMonitor = wurmLogsMonitor; this.wurmLogFiles = wurmLogFiles; this.internalEventAggregator = internalEventAggregator; }
public ServerHistoryProviderFactory( IPersistentCollection persistentCollection, IWurmLogsHistory wurmLogsHistory, IWurmServerList wurmServerList, ILogger logger, IWurmLogsMonitorInternal wurmLogsMonitor, IWurmLogFiles wurmLogFiles) { if (persistentCollection == null) throw new ArgumentNullException("persistentCollection"); if (wurmLogsHistory == null) throw new ArgumentNullException("wurmLogsHistory"); if (wurmServerList == null) throw new ArgumentNullException("wurmServerList"); if (logger == null) throw new ArgumentNullException("logger"); if (wurmLogsMonitor == null) throw new ArgumentNullException("wurmLogsMonitor"); if (wurmLogFiles == null) throw new ArgumentNullException("wurmLogFiles"); this.persistentCollection = persistentCollection; this.wurmLogsHistory = wurmLogsHistory; this.wurmServerList = wurmServerList; this.logger = logger; this.wurmLogsMonitor = wurmLogsMonitor; this.wurmLogFiles = wurmLogFiles; }
public MonthlyLogFilesHeuristics([NotNull] IPersistentCollection heuristicsPersistentCollection, IWurmLogFiles wurmLogFiles, MonthlyHeuristicsExtractorFactory monthlyHeuristicsExtractorFactory) { if (heuristicsPersistentCollection == null) { throw new ArgumentNullException(nameof(heuristicsPersistentCollection)); } if (wurmLogFiles == null) { throw new ArgumentNullException(nameof(wurmLogFiles)); } if (monthlyHeuristicsExtractorFactory == null) { throw new ArgumentNullException(nameof(monthlyHeuristicsExtractorFactory)); } this.heuristicsPersistentCollection = heuristicsPersistentCollection; this.wurmLogFiles = wurmLogFiles; this.monthlyHeuristicsExtractorFactory = monthlyHeuristicsExtractorFactory; }
public LogsScannerFactory( LogFileParserFactory logFileParserFactory, LogFileStreamReaderFactory streamReaderFactory, MonthlyLogFilesHeuristics heuristics, IWurmLogFiles wurmLogFiles, IWurmApiLogger logger, [NotNull] IWurmApiConfig wurmApiConfig) { if (logFileParserFactory == null) { throw new ArgumentNullException(nameof(logFileParserFactory)); } if (streamReaderFactory == null) { throw new ArgumentNullException(nameof(streamReaderFactory)); } if (heuristics == null) { throw new ArgumentNullException(nameof(heuristics)); } if (wurmLogFiles == null) { throw new ArgumentNullException(nameof(wurmLogFiles)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (wurmApiConfig == null) { throw new ArgumentNullException(nameof(wurmApiConfig)); } this.logFileParserFactory = logFileParserFactory; this.streamReaderFactory = streamReaderFactory; this.heuristics = heuristics; this.wurmLogFiles = wurmLogFiles; this.logger = logger; this.wurmApiConfig = wurmApiConfig; }
public WurmServerHistory( string dataDirectoryFullPath, IWurmLogsHistory wurmLogsHistory, IWurmServerList wurmServerList, ILogger logger, IWurmLogsMonitorInternal wurmLogsMonitor, IWurmLogFiles wurmLogFiles) { var persistentLibrary = new PersistentCollectionsLibrary(new FlatFilesPersistenceStrategy(dataDirectoryFullPath), new PersObjErrorHandlingStrategy(logger)); var collection = persistentLibrary.GetCollection("serverhistory"); var providerFactory = new ServerHistoryProviderFactory( collection, wurmLogsHistory, wurmServerList, logger, wurmLogsMonitor, wurmLogFiles); runner = new QueuedJobsSyncRunner<object, ServerName>(new JobExecutor(providerFactory, persistentLibrary), logger); }
public WurmLogsMonitor([NotNull] IWurmLogFiles wurmLogFiles, [NotNull] IWurmApiLogger logger, [NotNull] IPublicEventInvoker publicEventInvoker, [NotNull] IInternalEventAggregator internalEventAggregator, [NotNull] IWurmCharacterDirectories wurmCharacterDirectories, [NotNull] InternalEventInvoker internalEventInvoker, [NotNull] TaskManager taskManager, [NotNull] LogFileStreamReaderFactory logFileStreamReaderFactory) { if (wurmLogFiles == null) { throw new ArgumentNullException(nameof(wurmLogFiles)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (publicEventInvoker == null) { throw new ArgumentNullException(nameof(publicEventInvoker)); } if (internalEventAggregator == null) { throw new ArgumentNullException(nameof(internalEventAggregator)); } if (wurmCharacterDirectories == null) { throw new ArgumentNullException(nameof(wurmCharacterDirectories)); } if (internalEventInvoker == null) { throw new ArgumentNullException(nameof(internalEventInvoker)); } if (taskManager == null) { throw new ArgumentNullException(nameof(taskManager)); } if (logFileStreamReaderFactory == null) { throw new ArgumentNullException(nameof(logFileStreamReaderFactory)); } this.wurmLogFiles = wurmLogFiles; this.logger = logger; this.publicEventInvoker = publicEventInvoker; this.internalEventAggregator = internalEventAggregator; this.wurmCharacterDirectories = wurmCharacterDirectories; this.internalEventInvoker = internalEventInvoker; this.taskManager = taskManager; this.logFileStreamReaderFactory = logFileStreamReaderFactory; try { Rebuild(); } catch (Exception exception) { logger.Log(LogLevel.Error, "Error at WurmLogsMonitor initial rebuild", this, exception); } internalEventAggregator.Subscribe(this); taskHandle = new TaskHandle(Rebuild, "WurmLogsMonitor rebuild"); taskManager.Add(taskHandle); updater = new Task(() => { while (true) { if (stop) { return; } Thread.Sleep(500); if (stop) { return; } try { foreach (var logsMonitorEngineManager in characterNameToEngineManagers.Values) { logsMonitorEngineManager.Update(allEventSubscriptionsTsafe); } } catch (Exception exception) { logger.Log(LogLevel.Error, "WurmLogsMonitor 'updater' task crashed", this, exception); } } }, TaskCreationOptions.LongRunning); updater.Start(); taskHandle.Trigger(); }