/// <summary> /// Initialize a new instance of the TuningSpec class for a DVB satellite frequency. /// </summary> /// <param name="satellite">The satellite to tune to.</param> /// <param name="frequency">The frequency to tune to.</param> public TuningSpec(Satellite satellite, SatelliteFrequency frequency) { this.frequency = frequency; this.satellite = satellite; symbolRate = frequency.SymbolRate; fec = frequency.FEC; signalPolarization = frequency.Polarization; modulation = frequency.Modulation; }
/// <summary> /// Initialize a new instance of the Satellite class. /// </summary> /// <param name="longitude">The longitude in 1/10th's of a degree. Negative for west.</param> public Satellite(int longitude) { string namePart1 = ((decimal)(longitude / 10)).ToString(); string namePart2; if (longitude < 0) namePart2 = "W"; else namePart2 = "E"; Satellite satellite = new Satellite(namePart1 + "\u00b0" + namePart2 + " Satellite"); if (longitude < 0) { eastWest = "west"; this.longitude = longitude * -1; } else { eastWest = "east"; this.longitude = longitude; } }
/// <summary> /// Check if this instance is equal to another. /// </summary> /// <param name="satellite">The other instance.</param> /// <returns>True if the instances are equal; false otherwise.</returns> public bool EqualTo(Satellite satellite) { return (SortKey == satellite.SortKey); }
/// <summary> /// Load the satellite 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")) { Satellite satellite = new Satellite(fileInfo.Name.Substring(0, fileInfo.Name.Length - 4)); satellite.load(fileInfo); AddProvider(satellite); } }
/// <summary> /// Add a provider to the list. /// </summary> /// <param name="newProvider">The provider to be added.</param> public static void AddProvider(Satellite newProvider) { foreach (Satellite oldProvider in Providers) { if (oldProvider.SortKey == newProvider.SortKey) return; if (oldProvider.SortKey > newProvider.SortKey) { Providers.Insert(Providers.IndexOf(oldProvider), newProvider); return; } } Providers.Add(newProvider); }
private int processSatellite(string parts) { string[] parameters = parts.Split(new char[] { ',' }); if (parameters.Length != 1) { Logger.Instance.Write("INI file format error: The Satellite line is wrong."); return (errorCodeFormatError); } try { int longitude = Int32.Parse(parameters[0].Trim()); currentSatellite = Satellite.FindSatellite(longitude); if (currentSatellite == null) currentSatellite = new Satellite(longitude); if (currentFrequency != null && currentFrequency.Provider == null) currentFrequency.Provider = currentSatellite; } catch (FormatException) { Logger.Instance.Write("INI file format error: The Satellite line is wrong."); return (errorCodeFormatError); } catch (ArithmeticException) { Logger.Instance.Write("INI file format error: The Satellite line is wrong."); return (errorCodeFormatError); } return (errorCodeNoError); }