static void MakeUpRandomData() { var repo = new ContactDbRepo(); foreach (var contact in repo.GetList()) { repo.Delete(contact); } var calls = new[] { "M0LTE", "2E0XLX", "G4RDC", "2E0JPM", "2E1EPQ" }; var bands = new[] { 21, 14, 7, 3.5, 1.8 }; for (int i = 0; i < 10000; i++) { Debug.WriteLine(i); DateTime dt = DateTime.Now.AddDays(-1).AddSeconds(i * 10 + rnd.Next(0, 6)); repo.Add(new ContactDbRow { Band = bands[rnd.Next(0, bands.Length)], Operator = calls[rnd.Next(0, calls.Length)], Call = MakeUpCallsign(), ContestNumber = 10, IsMultiplier1 = rnd.Next(5) == 0, StationName = "stn-" + (rnd.Next(2) + 1), TimestampUtc_dt = dt }); } }
static void ProcessContactAdd(N1mmXmlContactInfo ci) { if (!OnlyProcessOriginals || (OnlyProcessOriginals && ci.IsOriginal == "True")) { // True = contact was originated on this computer. Without this check, in a multiple n1mm scenario, // if this computer has All QSOs selected, we will receive the contact twice. We only want // the one from the PC on which the contact was logged. This does mean every n1mm instance // will need to be configured to send datagrams to us. That seems reasonable. Console.WriteLine($"Adding a contact: {ci.Call} / {ci.Operator}"); var contactRepo = new ContactDbRepo(pathToDb); ContactDbRow row = Mappers.Map(ci); contactRepo.Add(row); } else { Console.WriteLine($"Skipping a non-original contact: {ci.Call} / {ci.Operator}"); } }
static void ProcessContactReplace(N1mmXmlContactReplace cr) { if (cr.IsOriginal == "True") // True = contact was originated on this computer. Without this check, in a multiple n1mm scenario, { // if this computer has All QSOs selected, we will receive the contact twice. We only want // the one from the PC on which the contact was logged. This does mean every n1mm instance // will need to be configured to send datagrams to us. That seems reasonable. Console.WriteLine($"Replacing a contact: {cr.Call} / {cr.Operator}"); var contactRepo = new ContactDbRepo(pathToDb); DeleteContact(cr.Timestamp, cr.StationName); ContactDbRow row = Mappers.Map(cr); contactRepo.Add(row); } else { Console.WriteLine($"Skipping a replace (non-original): {cr.Call} / {cr.Operator}"); } }