/// <summary> /// Analysiert die aktuelle Konfiguration des Suchlaufs auf Basis /// der DVB <i>Network Information Table (NIT)</i> Informationen. /// </summary> private void AnalyserThread() { // Be safe try { // Configure language UserProfile.ApplyLanguage(); // Uses hardware manager using (HardwareManager.Open()) { // Attach to the hardware itself Hardware device = HardwareManager.OpenHardware(Profile); // Reset counters TotalLocations = m_Locations.Count; CurrentLocation = 0; // Last inversion used SpectrumInversions lastInversion = SpectrumInversions.On; // Process all transponders foreach (GroupLocation location in m_Locations) { // Update counter ++CurrentLocation; // Reset CurrentLocationGroupsPending = 0; CurrentLocationGroup = 0; // Check caller if (!LocationStart(location)) { return; } // Groups found on this location Dictionary <SourceGroup, bool> found = new Dictionary <SourceGroup, bool>(); // Groups with valid network information - only those are considered List <SourceGroup> nitAvailable = new List <SourceGroup>(); // Load counter CurrentLocationGroupsPending = location.Groups.Count; // Process all groups foreach (SourceGroup group in location.Groups) { // Get the expected type Type groupType = group.GetType(); // Clone the group SourceGroup newGroup = SourceGroup.FromString <SourceGroup>(group.ToString()); // Count up --CurrentLocationGroupsPending; ++CurrentLocationGroup; // See if this is already processed if (null != found.Keys.FirstOrDefault(p => p.CompareTo(newGroup, true))) { continue; } // Check for external termination if (null == m_Worker) { return; } // Not supported if (!Profile.SupportsGroup(newGroup) || !device.CanHandle(newGroup)) { // Remember m_UnhandledGroups.Add(newGroup); // Next continue; } // Check caller if (!GroupStart(location, newGroup)) { return; } // Attach to the group if (null != SelectGroup(device, location, newGroup, ref lastInversion)) { // See if we are a cable group CableGroup cableGroup = newGroup as CableGroup; // Attach to the NIT var nit = device.GetLocationInformation(15000); if (null != nit) { // Remember nitAvailable.Add(newGroup); // Process foreach (SourceGroup other in nit.Groups) { if (other.GetType() == groupType) { // See if this is a cable group CableGroup otherCable = other as CableGroup; // Update inversion if (null != otherCable) { // Other must be cable, too if (null == cableGroup) { continue; } // Use same parameters otherCable.SpectrumInversion = cableGroup.SpectrumInversion; otherCable.Bandwidth = cableGroup.Bandwidth; } // Report if (ScannerTraceSwitch.Level >= TraceLevel.Info) { Trace.WriteLine(string.Format(Properties.Resources.Trace_Scanner_NIT, other), ScannerTraceSwitch.DisplayName); } // Mark it found[other] = true; } } } } // Check caller if (!GroupDone(location, newGroup)) { return; } } // Create a brand new scan location ScanLocation scan = location.ToScanLocation(); // Try to update foreach (SourceGroup group in nitAvailable) { // Try to find the full qualified name SourceGroup nitGroup = found.Keys.FirstOrDefault(p => p.CompareTo(group, true)); // Update if (null == nitGroup) { scan.Groups.Add(group); } else { scan.Groups.Add(nitGroup); } } // Just remember m_AnalyseResult[location] = scan; // Check caller if (!LocationDone(location)) { return; } } } } catch (Exception e) { // Remember m_ThreadException = e; } }