diff --git a/PlayerJournal.cs b/PlayerJournal.cs index 7f922c3..4cab75a 100644 --- a/PlayerJournal.cs +++ b/PlayerJournal.cs @@ -62,5 +62,28 @@ namespace EDJournal { journalfiles.Sort(); } + + public Entry FindMostRecent(string entry) { + var entries = journalfiles + .OrderByDescending(x => x.DateTime) + .ToArray() + ; + + if (entries == null || entries.Length == 0) { + return null; + } + + foreach(JournalFile file in entries) { + Entry found = file.Entries + .OrderByDescending(x => x.Timestamp) + .First(x => x.Event == entry) + ; + if (found != null) { + return found; + } + } + + return null; + } } }