public Town(string name, Country country, State state) { this.Name = name; this.Country = country; this.State = state; }
/*!loads the states */ private static void LoadStates() { XmlDocument doc = new XmlDocument(); doc.Load(AppSettings.getDataPath() + "\\states.xml"); XmlElement root = doc.DocumentElement; XmlNodeList statesList = root.SelectNodes("//state"); foreach (XmlElement element in statesList) { Country country = Countries.GetCountry(element.Attributes["country"].Value); string name = element.Attributes["name"].Value; string shortname = element.Attributes["shortname"].Value; Boolean overseas = false; if (element.HasAttribute("overseas")) overseas = Convert.ToBoolean(element.Attributes["overseas"].Value); State state = new State(country, name, shortname, overseas); state.Flag = AppSettings.getDataPath() + "\\graphics\\flags\\states\\" + element.Attributes["flag"].Value + ".png"; States.AddState(state); if (!File.Exists(state.Flag)) { name = ""; } } }
public static Town GetTown(string name, State state) { return Airports.GetAirport(a => a.Profile.Town.Name == name && a.Profile.Town.State == state).Profile.Town; }
//adds a state to the list public static void AddState(State state) { states.Add(state); }