Exemple #1
0
        /// <summary>
        /// Aktualisiert die Programmzeitschrift mit neuen Daten.
        /// </summary>
        /// <param name="entries">Die neuen Daten.</param>
        internal void UpdateGuide(ProgramGuideEntries entries)
        {
            // Report
            Tools.ExtendedLogging("Program Guide of {0} will be updated", ProfileName);

            // Did collection
            LastUpdateTime = DateTime.UtcNow;

            // Try to load resulting file
            try
            {
                // Create brand new
                var newData = m_Events.Clone();

                // Merge new
                newData.Merge(entries);

                // Cleanup
                newData.DiscardOld();

                // Save
                SerializationTools.Save(newData, ProgramGuideFile, Encoding.UTF8);

                // Use it
                m_Events = newData;

                // Report
                Tools.ExtendedLogging("Now using new Program Guide");
            }
            catch (Exception e)
            {
                // Report
                VCRServer.Log(LoggingLevel.Errors, Properties.Resources.EPGMergeFailed, e);
            }
        }
Exemple #2
0
        /// <summary>
        /// Erzeugt eine neue Verwaltungsinstanz.
        /// </summary>
        /// <param name="jobs">Die zugehörige Auftragsverwaltung.</param>
        /// <param name="profileName">Der Name des verwalteten DVB.NET Geräteprofils.</param>
        public ProgramGuideManager(JobManager jobs, string profileName)
        {
            // Remember
            ProfileName = profileName;
            JobManager  = jobs;

            // Calculate file
            ProgramGuideFile = new FileInfo(Path.Combine(JobManager.CollectorDirectory.FullName, $"EPGData for {ProfileName}.xml"));

            // See if profile has it's own program guide
            if (!HasProgramGuide)
            {
                return;
            }

            // Report
            Tools.ExtendedLogging("Looking for Program Guide of {0}", ProfileName);

            // No such file - start empty
            if (!ProgramGuideFile.Exists)
            {
                return;
            }

            // Process
            var events = SerializationTools.Load <ProgramGuideEntries>(ProgramGuideFile);

            if (events != null)
            {
                // Use it
                m_Events = events;

                // Report
                Tools.ExtendedLogging("Found valid Program Guide and using it");

                // Done
                return;
            }

            // Report
            VCRServer.Log(LoggingLevel.Errors, Properties.Resources.EPGFileCorrupted, ProgramGuideFile.FullName);

            // Save delete
            try
            {
                // Process
                ProgramGuideFile.Delete();
            }
            catch
            {
                // Discard any error
                VCRServer.Log(LoggingLevel.Errors, Properties.Resources.EPGDeleteDenied, ProgramGuideFile.FullName);
            }
        }
Exemple #3
0
        /// <summary>
        /// Meldet alle Einträge der Programmzeitschrift zu einer Quelle.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <returns>Die gewünschte Liste.</returns>
        internal IEnumerable <ProgramGuideEntry> GetEntries(SourceIdentifier source)
        {
            // Find the real holder
            var entries = LeafEntries;

            if (null == entries)
            {
                entries = new ProgramGuideEntries();
            }

            // Report
            return(entries.GetEntries(source));
        }
        /// <summary>
        /// Erzeugt eine exakte Kopie dieser Verwaltungsinstanz.
        /// </summary>
        /// <returns>Die gewünschte Kopie.</returns>
        public ProgramGuideEntries Clone()
        {
            // Create
            var clone = new ProgramGuideEntries();

            // Process
            foreach (var list in m_Events)
            {
                clone.m_Events[list.Key] = list.Value.Clone();
            }

            // Report
            return(clone);
        }
 /// <summary>
 /// Merge another package into this one.
 /// </summary>
 /// <param name="events">The package to merge in.</param>
 public void Merge(ProgramGuideEntries events)
 {
     // Fill
     if (events != null)
     {
         foreach (var ordered in events.m_Events.Values)
         {
             foreach (var entry in ordered)
             {
                 Add(entry);
             }
         }
     }
 }