I have no idea anymore why I needed this function
This commit is contained in:
@@ -62,5 +62,28 @@ namespace EDJournal {
|
|||||||
|
|
||||||
journalfiles.Sort();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user