示例#1
0
文件: Program.cs 项目: M0LTE/ft8push
        static void AddLogEntryToWorkedBandSquares(string call, int band)
        {
            var matches = GetMatches(call);

            if (matches.Count == 0)
            {
#warning Check log
                return;
            }
            else if (matches.Count > 1)
            {
#warning Do something
                return;
            }

            if (band == 70)
            {
#warning 70cm n1mm weird
                return;
            }

            var m = matches.Single();

            lock (BandSquares)
            {
                if (!BandSquares.Any(mem => mem.Band == band && mem.Prefix == m.PrimaryPrefix))
                {
                    Console.WriteLine($"Adding band square {m.CountryName} ({m.PrimaryPrefix}) / {band}MHz");
                    BandSquares.Add(new BandSquare {
                        Band = band, Country = m.CountryName, Prefix = m.PrimaryPrefix
                    });
                }
            }
        }
示例#2
0
文件: Program.cs 项目: M0LTE/ft8push
        static void RefreshDB()
        {
            string sql = $"select ts Timestamp, Call, Band, Mode from DXLOG where contestnr = {contestnr}";

            var csb = new SQLiteConnectionStringBuilder();

            string dir = @"C:\Users\tomandels\Nextcloud\Radio\N1MM Logger+\Databases";
            string fn  = "m0lte.s3db";

            csb.DataSource = Path.Combine(dir, fn);

            csb.ReadOnly = true;

            List <LogEntry> dbResults;

            using (var conn = new SQLiteConnection(csb.ToString()))
            {
                conn.Open();
                dbResults = conn.Query <LogEntry>(sql).ToList();
            }

            foreach (LogEntry dbrow in dbResults)
            {
                var matches = GetMatches(dbrow.Call);
                if (matches.Count != 1)
                {
                    continue;
                }

                var m = matches.Single();

                lock (BandSquares)
                {
                    if (!BandSquares.Any(mem => mem.Band == dbrow.Band && mem.Prefix == m.PrimaryPrefix))
                    {
                        BandSquares.Add(new BandSquare {
                            Band = dbrow.Band, Country = m.CountryName, Prefix = m.PrimaryPrefix
                        });
                    }
                }
            }
        }