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.SentReport => qso.SentReport, ExchangeSlot.SentNumber => Digits(qso.SentNumber), 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() : ""; }