public void Run(TextWriter output) { if (output is null) { throw new ArgumentNullException(nameof(output)); } PilotState pilotState = new PilotState(); GalaxyState galaxyState = new GalaxyState(); OutputFormatter.Format( JournalSource.Entries .Select(JournalEntryParser.Parse) .SelectMany(entry => Summarizer.Convert(pilotState, galaxyState, SupportedMinorFaction, entry)), output); }
public IEnumerable <SummaryEntry> Convert(PilotState pilotState, GalaxyState galaxyState, string supportedMinorFaction, JObject entry) { if (pilotState is null) { throw new ArgumentNullException(nameof(pilotState)); } if (supportedMinorFaction is null) { throw new ArgumentNullException(nameof(supportedMinorFaction)); } if (entry == null) { throw new NullReferenceException(nameof(entry)); } IEnumerable <SummaryEntry> result = Enumerable.Empty <SummaryEntry>(); if (JournalEntryProcessors.TryGetValue(entry.Value <string>("event"), out JournalEntryProcessor journalEntryProcessor)) { result = journalEntryProcessor.Process(pilotState, galaxyState, supportedMinorFaction, entry); } return(result); }