/// <summary> /// Vergleicht zwei Schlüssel. /// </summary> /// <param name="obj">Der andere Schlüssel.</param> /// <returns>Gesetzt, wenn die Schlüssel semantisch identisch sind.</returns> public override bool Equals(object obj) { // Change type GroupKey other = obj as GroupKey; // Not possible if (null == other) { return(false); } // Compare all return(Equals(Group, other.Group) && Equals(Location, other.Location)); }
/// <summary> /// Steuerung der Aktivierung der Programmzeitschrift. /// </summary> /// <param name="device">Das aktuell verwendete DVB.NET Gerät.</param> private void CollectProgramGuide(Hardware device) { // Not necessary if (!EPGProgress.HasValue) { return; } // Be safe try { // Load interval once if (!EPGItemCountCheckInterval.HasValue) { try { // Load setting string interval = ConfigurationManager.AppSettings["CardServerProgramGuideCountCheckInterval"]; // Load data uint value; if (!string.IsNullOrEmpty(interval)) { if (uint.TryParse(interval, out value)) { if ((value > 0) && (value < int.MaxValue)) { EPGItemCountCheckInterval = (int)value; } } } } finally { // Load default if (!EPGItemCountCheckInterval.HasValue) { EPGItemCountCheckInterval = 10; } } } // Time since we last checked the item count TimeSpan countDelta = DateTime.UtcNow - m_EPGLastItemCheck; // Must recheck if (countDelta.TotalSeconds >= EPGItemCountCheckInterval.Value) { if (m_EPGLastItemCount == m_EPGItemCount) { // Early stop m_EPGLastTune = DateTime.MinValue; } else { // Remember item count m_EPGLastItemCheck = DateTime.UtcNow; m_EPGLastItemCount = m_EPGItemCount; } } // Read the interval since the last tune TimeSpan delta = DateTime.UtcNow - m_EPGLastTune; // Check for change interval if (delta.TotalSeconds < 60) { return; } // Always shut down receivers device.SelectGroup(null, null); // Get the current state int total = m_EPGGroups.Count, left = m_EPGPending.Count; // Set the progress value if (total < 1) { EPGProgress = 1; } else { EPGProgress = 1.0 * (total - left) / total; } // See if we are fully done if (left < 1) { return; } // Load next GroupKey next = m_EPGPending[0]; // Remove from list m_EPGPending.RemoveAt(0); // Tune to transponder device.SelectGroup(next.Location, next.Group); // See if there is something on this group if (null == device.GetGroupInformation(5000)) { // Push back m_EPGPending.Add(next); // Next after a short delay return; } // Add standard EPG device.AddProgramGuideConsumer(OnStandardEPGEvent); // Check PREMIERE Direct if (0 != (m_EPGExtensions & EPGExtensions.PREMIEREDirect)) { foreach (SourceSelection selection in Profile.FindSource(DirectCIT.TriggerSource)) { if (Equals(selection.Location, device.CurrentLocation)) { if (Equals(selection.Group, device.CurrentGroup)) { // Register device.SetConsumerState(device.AddConsumer <DirectCIT>(OnPremiereEPGEvent), true); // Did it break; } } } } // Check PREMIERE Sport if (0 != (m_EPGExtensions & EPGExtensions.PREMIERESport)) { foreach (SourceSelection selection in Profile.FindSource(SportCIT.TriggerSource)) { if (Equals(selection.Location, device.CurrentLocation)) { if (Equals(selection.Group, device.CurrentGroup)) { // Register device.SetConsumerState(device.AddConsumer <SportCIT>(OnPremiereEPGEvent), true); // Did it break; } } } } // Check FreeSat UK if (0 != (m_EPGExtensions & EPGExtensions.FreeSatUK)) { foreach (SourceSelection selection in Profile.FindSource(EIT.FreeSatEPGTriggerSource)) { if (Equals(selection.Location, device.CurrentLocation)) { if (Equals(selection.Group, device.CurrentGroup)) { // Register Guid consumerId = device.AddConsumer <EIT>(EIT.FreeSatEPGPID, OnStandardEPGEvent); device.SetConsumerState(consumerId, true); // Did it break; } } } } // Reset time m_EPGLastTune = DateTime.UtcNow; // Remember item count m_EPGLastItemCheck = DateTime.UtcNow; m_EPGLastItemCount = m_EPGItemCount; } catch { // Just go on } }