Add the core, contest, storage and format layers

Frequencies, bands, modes, callsigns, grid squares and the country file live in
Nonemm.Core. Nonemm.Contests holds the scoring engine and CQ WW and CQ WPX.
Nonemm.Storage writes N1MM's DXLOG schema, and Nonemm.Formats writes Cabrillo
3.0 and reads and writes ADIF.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik
2026-08-27 10:27:51 +00:00
co-authored by Claude Opus 5
commit 0f84bc8972
68 changed files with 3823 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
using Nonemm.Core;
namespace Nonemm.Contests.Rules;
/// CQ World Wide DX, CW and SSB. Points by continent, multipliers are zones and
/// countries counted once per band. The country list is DXCC plus WAE, which is
/// what `wl_cty.dat` holds.
public sealed class CqWorldWide : Contest
{
private readonly ModeCategory mode;
public CqWorldWide(ModeCategory mode) => this.mode = mode;
public string Name => "CQWW";
public string DisplayName => $"CQ World Wide DX {ModeLabel()}";
public string CabrilloName => mode == ModeCategory.Cw ? "CQ-WW-CW" : "CQ-WW-SSB";
public IReadOnlyList<ExchangeField> ExchangeFields =>
[
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
new ExchangeField("Zone", ExchangeSlot.Zone, ExchangeFieldKind.CqZone),
];
public IReadOnlyList<string> MultiplierNames => ["Zones", "Countries"];
public DupeScope DupeScope => DupeScope.PerBand;
public bool HasSerialNumbers => false;
public IReadOnlyList<ModeCategory> Modes => [mode];
public string SentExchangeFor(StationInfo me) =>
$"{DefaultReport()} {me.CqZone}";
public int PointsFor(QsoContext qso)
{
if (!qso.Qso.Call.CountsForEntity)
{
return 0;
}
if (qso.IsSameCountry)
{
return 0;
}
if (!qso.IsSameContinent)
{
return 3;
}
return qso.Continent == "NA" ? 2 : 1;
}
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
{
string band = qso.Band?.Name ?? "";
List<Multiplier> found = [];
if (qso.Qso.Zone > 0)
{
found.Add(new Multiplier(1, qso.Qso.Zone.ToString(), band));
}
if (qso.CountryPrefix.Length > 0 && qso.Qso.Call.CountsForEntity)
{
found.Add(new Multiplier(2, qso.CountryPrefix, band));
}
return found;
}
public int TotalScore(ScoreTally tally) => tally.Points * tally.TotalMultipliers;
public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me) =>
new(
[new CabrilloField(qso.SentReport, 3), new CabrilloField(me.CqZone.ToString(), 6)],
[new CabrilloField(qso.ReceivedReport, 3), new CabrilloField(qso.Zone.ToString(), 6)]);
private string ModeLabel() => mode == ModeCategory.Cw ? "CW" : "SSB";
private string DefaultReport() => mode == ModeCategory.Cw ? "599" : "59";
}