Пример #1
0
        public QSOList GetPreviousInTour(QSO l, bool OnlySameMode)
        {
            QSOList result = new QSOList();

            if (this.Count() > 0)
            {
                for (int i = this.Count() - 1; i >= 0; i--)
                {
                    if (!this[i].Counters.Filtered &&
                        l.Raw.RecvCall == this[i].Raw.RecvCall &&
                        l.Counters.SubTour == this[i].Counters.SubTour &&
                        l.Feq == this[i].Feq &&
                        this[i].Raw.Number < l.Raw.Number &&
                        this[i].DateTime <= l.DateTime)
                    {
                        if (!OnlySameMode ||
                            (OnlySameMode && (
                                 (l.Raw.Mode == "CW" && l.Raw.Mode == this[i].Raw.Mode) ||
                                 (l.Raw.Mode != "CW" && this[i].Raw.Mode != "CW")
                                 )))
                        {
                            this[i].Counters.Offset = (int)(l.DateTime - this[i].DateTime).TotalMinutes;
                            result.Add(this[i]);
                        }
                    }
                }
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// разбор одной строки файла
        /// </summary>
        /// <param name="s"></param>
        private void ParseLine(string s)
        {
            // начало файла
            if (Util.StrExists(s, "start-of-log:"))
            {
                CabrilloExist = true;
            }
            if (CabrilloExist)
            {
                // строка одной связи
                if (Util.StrExists(s, "qso:"))
                {
                    qso_number++;
                    items.Add(new QSO(this, s, qso_number));
                }

                // несколько строчные
                if (Util.StrExists(s, "address:"))
                {
                    header.address.Add(s.Substring(s.IndexOf(':') + 1).Trim());
                }
                if (Util.StrExists(s, "operators:"))
                {
                    header.operators.Add(s.Substring(s.IndexOf(':') + 1).Trim());
                }
                if (Util.StrExists(s, "soapbox:"))
                {
                    header.soapbox.Add(s.Substring(s.IndexOf(':') + 1).Trim());
                }

                // однострочные
                if (Util.StrExists(s, "callsign:"))
                {
                    header.callsign = s.Substring(s.IndexOf(':') + 1).Trim();
                    Call            = header.callsign;
                }
                if (Util.StrExists(s, "category-assisted:"))
                {
                    header.category_assisted = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-band:"))
                {
                    header.category_band = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-mode:"))
                {
                    header.category_mode = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-operator:"))
                {
                    header.category_operator = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-overlay:"))
                {
                    header.category_overlay = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-power:"))
                {
                    header.category_power = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-station:"))
                {
                    header.category_station = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-time:"))
                {
                    header.category_time = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "category-transmitter:"))
                {
                    header.category_transmitter = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "claimed-score:"))
                {
                    header.claimed_score = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "club:"))
                {
                    header.club = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "contest:"))
                {
                    header.contest = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "email:"))
                {
                    header.email = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "location:"))
                {
                    header.location = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "name:"))
                {
                    header.name = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "offtime:"))
                {
                    header.offtime = s.Substring(s.IndexOf(':') + 1).Trim();
                }
                if (Util.StrExists(s, "created-by:"))
                {
                    header.created_by = s.Substring(s.IndexOf(':') + 1).Trim();
                }
            }
        }
Пример #3
0
        /// <summary>
        /// интелектуальное сравнение связи. сначала с оффсетом а потом с магией
        /// </summary>
        /// <param name="l"></param>
        /// <param name="qso_list"></param>
        private void Calculate_AI(QSO l, QSOList qso_list)
        {
            QSOList new_qso_list = new QSOList();

            foreach (QSO item in qso_list)
            {
                if (item.Counters.ErrorOnCheck == false && item.Counters.Filtered == false && item.Counters.OK == false)
                {
                    if (l.DateTime.AddMinutes(-Config.offset_min) <= item.DateTime && item.DateTime <= l.DateTime.AddMinutes(Config.offset_min))
                    {
                        new_qso_list.Add(item);
                    }
                }
            }
            bool found = false;

            foreach (QSO item in new_qso_list)
            {
                found = Calculate_One(l, item, CalculateMode.withoutdate);
                if (found)
                {
                    new_qso_list.Clear();
                    return;
                }
            }
            /// TODO: доделать ебаное интелектуальное сравнение
            /// вроде мысли появились, сравнивать блоками.
            /// типа сравнить дату время и позывные, потом моду, потом контрольные номера и локаторы
            if (!found)
            {
                foreach (QSO r in new_qso_list)
                {
                    /// странное сравнивание №1
                    /// сравниваем по дата время уже в возможных границах
                    /// диапазон, позывные, RST
                    ///              @           @       @     @                 @
                    /// <para>QSO: 28009 CW 2008-09-23 0711 UA1XYZ 599 001 123 UA2XYZ 599 001 AF 1</para>
                    if (l.Raw.RecvCall == r.Raw.SendCall &&
                        l.Raw.SendCall == r.Raw.RecvCall &&
                        l.Feq == r.Feq)
                    {
                        l.Errors.Add(BuildErrorStr(l, r));
                        l.Counters.SetError(ErrorType.similarqso);
                        l.LinkedQSO = r;
                        if (!r.Counters.ErrorOnCheck)
                        {
                            r.LinkedQSO = l;
                        }
                        break;
                    }

                    #region странное сравнивание №2
                    ///// сравниваем по дата время уже в возможных границах
                    ///// диапазон, локатор в одну сторону и позывной в одну сторону
                    /////              @    @      @       @
                    ///// <para>QSO: 28009 CW 2008-09-23 0711 UA1XYZ 599 001 LOCATOR UA2XYZ 599 001 LOCATOR 1</para>
                    //if (((l.Raw.Mode == "CW" && r.Raw.Mode == "CW") || (l.Raw.Mode != "CW" && r.Raw.Mode != "CW")) &&
                    //    Util.AsNumeric(l.Raw.SendExch2) == Util.AsNumeric(r.Raw.RecvExch2) &&
                    //    l.Raw.RecvCall != r.Raw.SendCall &&
                    //    l.Feq == r.Feq)
                    //{
                    //    string ltext = "@[" + r.Raw.SendCall + " QSO:" + r.Raw.Number;

                    //    if (l.Raw.SendCall == r.Raw.RecvCall)
                    //    {
                    //        // переданный позывной и полученный
                    //        ltext = string.Concat(ltext, " [recv call: " + l.Raw.RecvCall + "/" + r.Raw.SendCall + "]");
                    //    }

                    //    if (Util.AsNumeric(l.Raw.SendRST) != Util.AsNumeric(r.Raw.RecvRST) ||
                    //        Util.AsNumeric(l.Raw.RecvRST) != Util.AsNumeric(r.Raw.SendRST))
                    //    {
                    //        // RST не совпало
                    //        if (Util.AsNumeric(l.Raw.SendRST) != Util.AsNumeric(r.Raw.RecvRST))
                    //            ltext = string.Concat(ltext, " [send rst: " + l.Raw.SendRST + "/" + r.Raw.RecvRST + "]");
                    //        if (Util.AsNumeric(l.Raw.RecvRST) != Util.AsNumeric(r.Raw.SendRST))
                    //            ltext = string.Concat(ltext, " [recv rst: " + l.Raw.RecvRST + "/" + r.Raw.SendRST + "]");
                    //    }

                    //    if (Util.AsNumeric(l.Raw.SendExch1) != Util.AsNumeric(r.Raw.RecvExch1) ||
                    //        Util.AsNumeric(l.Raw.RecvExch1) != Util.AsNumeric(r.Raw.SendExch1))
                    //    {
                    //        // не совпал 1 контрольный
                    //        if (Util.AsNumeric(l.Raw.SendExch1) != Util.AsNumeric(r.Raw.RecvExch1))
                    //            ltext = string.Concat(ltext, " [send exch1: " + l.Raw.SendExch1 + "/" + r.Raw.RecvExch1 + "]");
                    //        if (Util.AsNumeric(l.Raw.RecvExch1) != Util.AsNumeric(r.Raw.SendExch1))
                    //            ltext = string.Concat(ltext, " [recv exch1: " + l.Raw.RecvExch1 + "/" + r.Raw.SendExch1 + "]");
                    //    }

                    //    if (Util.AsNumeric(l.Raw.RecvExch2) != Util.AsNumeric(r.Raw.SendExch2))
                    //    {
                    //        // не совпал 2 контрольный
                    //        if (Util.AsNumeric(l.Raw.RecvExch2) != Util.AsNumeric(r.Raw.SendExch2))
                    //            ltext = string.Concat(ltext, " [recv exch2: " + l.Raw.RecvExch2 + "/" + r.Raw.SendExch2 + "]");
                    //    }

                    //    if (Util.AsNumeric(l.Raw.SendExch3) != Util.AsNumeric(r.Raw.RecvExch3) ||
                    //        Util.AsNumeric(l.Raw.RecvExch3) != Util.AsNumeric(r.Raw.SendExch3))
                    //    {
                    //        // не совпал 3 контрольный
                    //        if (Util.AsNumeric(l.Raw.SendExch3) != Util.AsNumeric(r.Raw.RecvExch3))
                    //            ltext = string.Concat(ltext, " [send exch3: " + l.Raw.SendExch3 + "/" + r.Raw.RecvExch3 + "]");
                    //        if (Util.AsNumeric(l.Raw.RecvExch3) != Util.AsNumeric(r.Raw.SendExch3))
                    //            ltext = string.Concat(ltext, " [recv exch3: " + l.Raw.RecvExch3 + "/" + r.Raw.SendExch3 + "]");
                    //    }
                    //    l.Errors.Add(ltext + "]");
                    //    l.Counters.ErrorOnCheck = true;
                    //    break;
                    //}
                    #endregion
                }
            }
        }