Write the numbered Cabrillo lines a .udc file asks for
CabrilloFormat 2, 3, 4 and 5 name the NAQP, NA Sprint, Sweepstakes and section-and-serial lines. A file asking for one of those got the default line; it now gets the layout, ported from CabrilloString2 and CabrilloString4 in N1MM's Contact.cs, in N1MM's columns. The exchange the layouts split into columns is built from the boxes the file defines, in the order it defines them. N1MM builds it from the section box alone, which writes only half of a two-box exchange such as NAQP's name and state. Format 6, the ARRL RTTY Roundup line, is still not read. No published .udc file asks for it, because the Roundup has a contest class of its own. ExchangeSlots.ValueOf moves to Nonemm.Contests as QsoExchange.ValueOf, so the contest code can read a contact through its exchange boxes without a second copy of that switch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests;
|
||||
|
||||
/// Reading the exchange back out of a logged contact, one entry box at a time.
|
||||
/// `ExchangeSlots.Apply` in `Nonemm.Session` puts the values in.
|
||||
public static class QsoExchange
|
||||
{
|
||||
/// What the contact holds for one exchange box, or an empty string for a
|
||||
/// box it holds nothing for.
|
||||
public static string ValueOf(Qso qso, ExchangeSlot slot) => slot switch
|
||||
{
|
||||
ExchangeSlot.ReceivedReport => qso.ReceivedReport,
|
||||
ExchangeSlot.SerialNumber => Digits(qso.ReceivedNumber),
|
||||
ExchangeSlot.Zone => Digits(qso.Zone),
|
||||
ExchangeSlot.Section => qso.Section,
|
||||
ExchangeSlot.Check => Digits(qso.Check),
|
||||
ExchangeSlot.Precedence => qso.Precedence,
|
||||
ExchangeSlot.Exchange1 => qso.Exchange1,
|
||||
ExchangeSlot.MiscText => qso.MiscText,
|
||||
ExchangeSlot.Name => qso.Name,
|
||||
ExchangeSlot.Qth => qso.Qth,
|
||||
ExchangeSlot.GridSquare => qso.GridSquare,
|
||||
ExchangeSlot.Power => qso.Power,
|
||||
ExchangeSlot.Comment => qso.Comment,
|
||||
_ => "",
|
||||
};
|
||||
|
||||
private static string Digits(int value) => value > 0 ? value.ToString() : "";
|
||||
}
|
||||
Reference in New Issue
Block a user