Take a QTC header that is only a series number as ten lines

An operator copying a header off the air often types the series number and
nothing else. That read as a header the program could not parse, so the box
went yellow and Close refused to log the series.

N1MM fills the count in: "If he only types the batch number without the
forward slash and count, the program will assume the count is 10."

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
This commit is contained in:
2026-09-10 19:30:47 +00:00
co-authored by Claude Opus 5
parent 265f90ccd7
commit 9b3e10d127
2 changed files with 26 additions and 7 deletions
+13 -6
View File
@@ -214,16 +214,23 @@ public sealed class QtcTraffic
/// The header a station sends in front of a series: a series number, a
/// separator and how many lines follow. Anything between the two numbers
/// counts as the separator, because it is copied off the air.
/// counts as the separator, because it is copied off the air. A series
/// number on its own means ten lines, which is what N1MM assumes: "If he
/// only types the batch number without the forward slash and count, the
/// program will assume the count is 10."
public static (int Series, int Count)? ReadHeader(string text)
{
string[] parts = text.Trim().ToUpperInvariant().Replace("QTC", "").Trim()
.Split(['/', '-', ' ', '\\'], StringSplitOptions.RemoveEmptyEntries);
return parts.Length >= 2
&& int.TryParse(parts[0], out int series)
&& int.TryParse(parts[1], out int count)
&& series > 0
&& count is > 0 and <= WaeQtc.MostPerSeries
if (parts.Length == 0 || !int.TryParse(parts[0], out int series) || series <= 0)
{
return null;
}
if (parts.Length == 1)
{
return (series, WaeQtc.MostPerSeries);
}
return int.TryParse(parts[1], out int count) && count is > 0 and <= WaeQtc.MostPerSeries
? (series, count)
: null;
}