public override bool Equals(object obj)
        {
            var station = obj as Station;

            if (obj == null)
            {
                return(false);
            }

            return((StationName == null && station.StationName == null ||
                    StationName != null && StationName.Equals(station.StationName)) &&
                   (StateCountryName == null && station.StateCountryName == null ||
                    StateCountryName != null && StateCountryName.Equals(station.StateCountryName)) &&
                   (StateProvinceAbbrev == null && station.StateProvinceAbbrev == null ||
                    StateProvinceAbbrev != null && StateProvinceAbbrev.Equals(station.StateProvinceAbbrev)) &&
                   (ICAO == null && station.ICAO == null ||
                    ICAO != null && ICAO.Equals(station.ICAO)) &&
                   (IATA == null && station.IATA == null ||
                    IATA != null && IATA.Equals(station.IATA)) &&
                   SYNOP == station.SYNOP &&
                   (Latitude == null && station.Latitude == null ||
                    Latitude != null && Latitude.Equals(station.Latitude)) &&
                   (Longitude == null && station.Longitude == null ||
                    Longitude != null && Longitude.Equals(station.Longitude)) &&
                   Elevation == station.Elevation &&
                   METAR == station.METAR &&
                   RADAR == station.RADAR &&
                   AviationFlag == station.AviationFlag &&
                   UpperAir == station.UpperAir &&
                   ObservationSystem == station.ObservationSystem &&
                   OfficeType == station.OfficeType &&
                   (Country == null && station.Country == null ||
                    Country != null && Country.Equals(station.Country)) &&
                   Priority == Priority);
        }
Exemple #2
0
        private List<Aircraft> FindExact(RegistryAircraft reg_ac)
        {
            List<Aircraft> result = new List<Aircraft>();
            string reg_type = ICAO.GetType(reg_ac.icao);
            foreach (Aircraft ac in mainForm.analyzeForm.aircrafts)
            {
                string edited_type = ac.ui_type.Replace(" ", "");
                edited_type = edited_type.Replace("-", "");
                edited_type = edited_type.ToUpper();
                string edited_model = ac.atc_model.Replace(" ", "");
                edited_model = edited_model.Replace("-", "");
                edited_model = edited_model.ToUpper();

                if (
                       (ac.atc_model.Contains(reg_ac.icao) || 
                        ac.ui_type.Contains(reg_ac.icao) || 
                        edited_type.Contains(reg_type) || 
                        edited_model.Contains(reg_type)
                       ) 
                       && reg_ac.icao != "")
                {
                    ac.icao = reg_ac.icao;
                    if (ac.atc_airline.ToUpper() == reg_ac.airline || ac.atc_parking_codes.ToUpper() == reg_ac.airline || ac.texture.ToUpper() == reg_ac.airline)
                    {
                        ac.Fill();
                        Logger.Log("FindExact : " + reg_ac.airline + " / " + reg_ac.icao + " ==> " + ac.title);
                        result.Add(ac);
                    }
                }
            }
            return result;
        }
Exemple #3
0
        private List<Aircraft> SortResult(List<Aircraft> unsorted, string compare_icao) {
            string reg_wake = ICAO.GetWake(compare_icao);
            string reg_eng_type = ICAO.GetEngineType(compare_icao);
            int reg_eng_count = ICAO.GetEngineCount(compare_icao);

            // assign match to result aircrafts
            if (unsorted.Count > 1)
            {
                foreach (Aircraft temp_ac in unsorted)
                {
                    temp_ac.match_count = 0;
                    if (reg_wake == temp_ac.wake) temp_ac.match_count = 4;
                    if (reg_eng_type == temp_ac.engine_type) temp_ac.match_count += 2;
                    if (reg_eng_count == temp_ac.engine_count) temp_ac.match_count += 2;
                    int min1 = Math.Min(2, compare_icao.Length);
                    int min2 = Math.Min(2, temp_ac.icao.Length);
                    int min3 = Math.Min(3, compare_icao.Length);
                    int min4 = Math.Min(3, temp_ac.icao.Length);
                    if (compare_icao.Substring(0, min1) == temp_ac.icao.Substring(0, min2)) temp_ac.match_count += 1;
                    if (compare_icao.Substring(0, min3) == temp_ac.icao.Substring(0, min4)) temp_ac.match_count += 2;
                    if (temp_ac.title.Contains(compare_icao.Substring(0, min3))) temp_ac.match_count += 1;
                }

                unsorted.Sort(delegate(Aircraft a1, Aircraft a2) { return a1.match_count.CompareTo(a2.match_count); });
                unsorted.Reverse();
            }
            return unsorted;
        }
Exemple #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(base.GetHashCode()
                + (ICAO.ToUpper().GetHashCode() * 3
                   + ATIS.ToUpper().GetHashCode() * 3) * 17);
     }
 }
Exemple #5
0
 public MainForm()
 {
     InitializeComponent();
     Logger.Init();
     Logger.Log("");
     Logger.Log("Starting application...");
     registryButton.Enabled = false;
     assignButton.Enabled   = false;
     exportButton.Enabled   = false;
     ICAO.Build();
     VersionChecker.CheckVersion();
 }
        public FlightPlanWaypoint ToData()
        {
            var waypoint = new FlightPlanWaypoint
            {
                Id     = id,
                Airway = ATCAirway,
                Type   = ATCWaypointType,
                ICAO   = ICAO?.ToData()
            };

            (waypoint.Latitude, waypoint.Longitude, waypoint.Altitude) = GpsHelper.ConvertString(WorldPosition);
            return(waypoint);
        }
Exemple #7
0
        /// <summary>
        /// Current country is used to change the formatting so local country is not shown .
        /// </summary>
        /// <param name="country">remember to convert to .ToUpperInvariant()</param>
        /// <returns></returns>
        public string ToString(string country)
        {
            // Shorten the string if current country
            if (!country.IsNullOrWhiteSpace() && country == Country && !ICAO.IsNullOrWhiteSpace())
            {
                return(this.Name + " " + ICAO + "");
            }

            // Matching the format used by the OLC http://www.onlinecontest.org/ with ICAO instead of region
            if (!ICAO.IsNullOrWhiteSpace() && !Country.IsNullOrWhiteSpace())
            {
                return(this.Name + " " + ICAO + " (" + Country + ")");
            }

            if (!Country.IsNullOrWhiteSpace())
            {
                return(this.Name + " (" + Country + ")");
            }

            return(Name);
        }
Exemple #8
0
 public void Fill()
 {
     wake         = ICAO.GetWake(icao);
     engine_type  = ICAO.GetEngineType(icao);
     engine_count = ICAO.GetEngineCount(icao);
 }
Exemple #9
0
 public void SetUpWords(int amount)
 {
     //HUDControl.Instance.ChangeWordsPanel(new Vector2(0, -80), 0f);
     ChosenWords = ICAO.ReturnRandomWordsFromAlphabet(amount);
     HUDControl.Instance.ShowWordsPanel();
 }
Exemple #10
0
 public void SendEmail(ICAO firstAirport, ICAO secondAirport)
 {
     //Do something
 }