static void Main(string[] args) { using var client = new WsjtxClient((msg, from) => { Console.WriteLine(msg); }, IPAddress.Parse("239.255.0.1"), multicast: true, debug: true); Thread.CurrentThread.Join(); }
static void Main(string[] args) { bool showProgress = args.Any(a => a == "--show-progress"); if (args.Any(a => a.EndsWith("configure", StringComparison.OrdinalIgnoreCase))) { DoConfigureDialogue(); return; } if (!File.Exists(ConfigFile)) { Console.WriteLine("Config not found - run again with --configure"); return; } ILinePusher linePusher = new CloudlogLinePusher(); if (!args.Any()) { using var client = new WsjtxClient(RecordReceived, IPAddress.Parse("239.1.2.3"), multicast: true, debug: true); Console.WriteLine($"Cloudlog instance: {linePusher.InstanceUrl}"); Console.WriteLine($"Listening for WSJT-X, ctrl-c to quit..."); Thread.CurrentThread.Join(); void RecordReceived(WsjtxMessage message) { if (!(message is LoggedAdifMessage loggedAdifMessage)) { return; } if (!AdifFile.TryParse(loggedAdifMessage.AdifText, out AdifFile adifFile)) { return; } string adifRecord = adifFile.Records.Single().ToString(); PushLineResult[] results = linePusher.PushLines(new[] { adifRecord }, false, default).Result; foreach (var result in results) { if (result.Success) { Console.WriteLine($"Uploaded QSO with {result.Record.Call}"); } else { Console.WriteLine($"Error uploading: {result.ErrorContent}"); } } } } else { // one-off upload if (!args.Any(File.Exists)) { Console.WriteLine("No existing ADIF file specified"); return; } foreach (var file in args.Where(File.Exists)) { var lines = GetRecords(file) .Select(ar => ar.ToString()) .ToArray(); PushLineResult[] results = linePusher.PushLines(lines, showProgress, default).Result; Console.WriteLine($"{file}: {results.Count(r => r.Success)} successful, {results.Count(r => !r.Success)} failure(s)"); for (int i = 0; i < results.Length; i++) { if (results[i].Success) { continue; } Console.WriteLine($" Line {i + 1}: {results[i].ErrorContent}"); } } } }
private void Form_Load(object sender, EventArgs e) { DateTime firstRunDateTime; SuspendLayout(); AllocConsole(); //Properties.Settings.Default.Upgrade(); //Properties.Settings.Default.Save(); if (!Properties.Settings.Default.debug) { ShowWindow(GetConsoleWindow(), 0); } if (Properties.Settings.Default.windowPos != new Point(0, 0)) { Location = Properties.Settings.Default.windowPos; } if (Properties.Settings.Default.windowHt != 0) { Height = Properties.Settings.Default.windowHt; } if (Properties.Settings.Default.firstRunDateTime == DateTime.MinValue) { firstRunDateTime = DateTime.Now; } else { firstRunDateTime = Properties.Settings.Default.firstRunDateTime; } string ipAddress = Properties.Settings.Default.ipAddress; int port = Properties.Settings.Default.port; bool multicast = Properties.Settings.Default.multicast; //start the UDP message server wsjtxClient = new WsjtxClient(this, IPAddress.Parse(ipAddress), port, multicast, Properties.Settings.Default.debug, firstRunDateTime); wsjtxClient.ConfigsCheckedFromString(Properties.Settings.Default.configsChecked); timeoutNumUpDown.Value = Properties.Settings.Default.timeout; directedCheckBox.Checked = Properties.Settings.Default.useDirected; directedTextBox.Enabled = directedCheckBox.Checked; directedTextBox.ForeColor = System.Drawing.Color.Gray; if (!directedTextBox.Enabled && Properties.Settings.Default.directeds == "") { directedTextBox.Text = "(separate by spaces)"; } else { directedTextBox.Text = Properties.Settings.Default.directeds; directedTextBox.ForeColor = System.Drawing.Color.Black; } mycallCheckBox.Checked = Properties.Settings.Default.playMyCall; loggedCheckBox.Checked = Properties.Settings.Default.playLogged; alertCheckBox.Checked = Properties.Settings.Default.useAlertDirected; logEarlyCheckBox.Checked = Properties.Settings.Default.logEarly; //wsjtxClient.debug = Properties.Settings.Default.debug; wsjtxClient.advanced = Properties.Settings.Default.advanced; alwaysOnTop = Properties.Settings.Default.alwaysOnTop; useRR73CheckBox.Checked = Properties.Settings.Default.useRR73; skipGridCheckBox.Checked = Properties.Settings.Default.skipGrid; replyCqCheckBox.Checked = Properties.Settings.Default.autoReplyCq; exceptCheckBox.Checked = Properties.Settings.Default.enableExclude; replyCqCheckBox_Click(null, null); exceptCheckBox_Click(null, null); exceptTextBox.Text = Properties.Settings.Default.exclude; alertTextBox.Enabled = alertCheckBox.Checked; alertTextBox.ForeColor = System.Drawing.Color.Gray; if (!alertTextBox.Enabled && Properties.Settings.Default.alertDirecteds == "") { alertTextBox.Text = "(separate by spaces)"; } else { alertTextBox.Text = Properties.Settings.Default.alertDirecteds; alertTextBox.ForeColor = System.Drawing.Color.Black; } timer1.Interval = 10; //actual is 11-12 msec (due to OS limitations) timer1.Start(); if (!wsjtxClient.advanced) { timer6.Interval = 3000; timer6.Start(); } else { advButton_Click(null, null); } TopMost = alwaysOnTop; UpdateDebug(); ResumeLayout(); formLoaded = true; timer4.Interval = 60000; //pop up dialog showing UDP settings at tick timer4.Start(); }