/// <summary> /// Add a new provider. /// </summary> /// <param name="newProvider">The new provider instance.</param> public static void AddProvider(TerrestrialProvider newProvider) { addProvider(newProvider); Country newCountry = newProvider.Country; foreach (Country oldCountry in Countries) { if (oldCountry.Name == newCountry.Name) { oldCountry.AddArea(newProvider.Area, false); return; } if (oldCountry.Name.CompareTo(newCountry.Name) > 0) { newCountry.AddArea(newProvider.Area, false); countries.Insert(countries.IndexOf(oldCountry), newCountry); return; } } newCountry.AddArea(newProvider.Area, false); countries.Add(newCountry); }
/// <summary> /// Load the terrestrial collection from the tuning files. /// </summary> /// <param name="directoryName">The full path of the directory containing the tuning files.</param> public static void Load(string directoryName) { Providers.Clear(); DirectoryInfo directoryInfo = new DirectoryInfo(directoryName); foreach (FileInfo fileInfo in directoryInfo.GetFiles("*.xml")) { TerrestrialProvider terrestrialProvider = new TerrestrialProvider(fileInfo.Name.Substring(0, fileInfo.Name.Length - 4)); terrestrialProvider.load(fileInfo); AddProvider(terrestrialProvider); } }
private static void addProvider(TerrestrialProvider newProvider) { foreach (TerrestrialProvider oldProvider in Providers) { if (oldProvider.Name == newProvider.Name) { return; } if (oldProvider.Name.CompareTo(newProvider.Name) > 0) { Providers.Insert(Providers.IndexOf(oldProvider), newProvider); return; } } Providers.Add(newProvider); }
private static void addProvider(TerrestrialProvider newProvider) { foreach (TerrestrialProvider oldProvider in Providers) { if (oldProvider.Name == newProvider.Name) return; if (oldProvider.Name.CompareTo(newProvider.Name) > 0) { Providers.Insert(Providers.IndexOf(oldProvider), newProvider); return; } } Providers.Add(newProvider); }