parse out commander names from logs

This commit is contained in:
2024-09-18 21:33:20 +02:00
parent 9918c7d559
commit 007b391dc2
3 changed files with 30 additions and 9 deletions

View File

@@ -602,15 +602,6 @@ internal class DropshipDeployParser : ITransactionParserPart {
}
}
internal class CommanderParser : ITransactionParserPart {
public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
// A commander entry happens when you log out, and log back in again
// for example when switching from Open, to Solo or PG.
context.DiscernCombatZone(transactions, entry);
context.ResetCombatZone();
}
}
public class TransactionParser {
private static Dictionary<string, ITransactionParserPart> ParserParts { get; } = new()
{
@@ -669,6 +660,11 @@ public class TransactionParser {
return Parse(entries, defaultOptions);
}
/// <summary>
/// List of commanders seen during parsing.
/// </summary>
public List<string> Commanders { get; set; } = new();
public List<Transaction>? Parse(IEnumerable<Entry> entries, TransactionParserOptions options) {
TransactionList transactions = new();
TransactionParserContext context = new();
@@ -686,6 +682,9 @@ public class TransactionParser {
transactionParserPart.Parse(entry, context, options, transactions);
}
// Copy out list of commanders seen
Commanders = context.Commanders;
return transactions.ToList();
}
}