bool ParseForServerInfo(IEnumerable <LogEntry> logEntries, bool fromLiveLogs = false)
        {
            bool foundAny = false;

            foreach (var wurmLogEntry in logEntries)
            {
                var serverStamp = wurmLogEntry.TryGetServerFromLogEntry(logger, characterName);
                if (serverStamp != null)
                {
                    ServerName previousServerName = null;
                    if (fromLiveLogs)
                    {
                        previousServerName = currentLiveLogsServer
                                             ?? sortedServerHistory.TryGetServerAtStamp(Time.Get.LocalNow);
                    }

                    sortedServerHistory.Insert(serverStamp);
                    foundAny = true;

                    if (fromLiveLogs)
                    {
                        currentLiveLogsServer = serverStamp.ServerName;

                        eventAggregator.Send(new YouAreOnEventDetectedOnLiveLogs(currentLiveLogsServer,
                                                                                 characterName,
                                                                                 previousServerName != currentLiveLogsServer));
                    }
                }
            }
            return(foundAny);
        }
示例#2
0
 public WurmConfigDirectories(IWurmPaths wurmPaths, [NotNull] IInternalEventAggregator eventAggregator,
                              TaskManager taskManager, IWurmApiLogger logger)
     : base(
         wurmPaths.ConfigsDirFullPath,
         taskManager,
         () => eventAggregator.Send(new ConfigDirectoriesChanged()),
         logger,
         ValidateDirectory,
         wurmPaths)
 {
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     this.eventAggregator = eventAggregator;
 }