Example #1
0
        /// <summary>
        /// Erzeugt eine neue Beschreibung.
        /// </summary>
        /// <param name="collection">Die zugehörige Verwaltung der aktiven Geräteprofile.</param>
        /// <param name="profileName">Der Name des zugehörigen Geräteprofils.</param>
        public ProfileState(ProfileStateCollection collection, string profileName)
        {
            // Remember
            ProfileName = profileName;
            Collection  = collection;

            // Create program guide manager
            ProgramGuide = new ProgramGuideManager(Collection.Server.JobManager, profileName);
        }
Example #2
0
        /// <summary>
        /// Erstellt eine neue Beschreibung.
        /// </summary>
        /// <param name="guide">Die zugehörige Programmzeitschrift.</param>
        /// <returns>Die gewünschte Beschreibung.</returns>
        public static GuideInfo Create(ProgramGuideManager guide)
        {
            // Collectors
            var sources  = new HashSet <SourceIdentifier>();
            var stations = new HashSet <string>();
            var first    = default(DateTime? );
            var last     = default(DateTime? );

            // Process
            foreach (var entry in guide.LeafEntries.Events)
            {
                // Start time
                var start = entry.StartTime;
                if (!first.HasValue)
                {
                    first = start;
                }
                else if (start < first.Value)
                {
                    first = start;
                }
                if (!last.HasValue)
                {
                    last = start;
                }
                else if (start > last.Value)
                {
                    last = start;
                }

                // Add the source name
                var source     = entry.Source;
                var sourceInfo = VCRProfiles.FindSource(guide.ProfileName, source);
                if (sourceInfo != null)
                {
                    if (sources.Add(source))
                    {
                        stations.Add(sourceInfo.GetUniqueName());
                    }
                }
            }

            // Report
            return
                (new GuideInfo
            {
                SourceNames = stations.OrderBy(name => name).ToArray(),
                FirstStart = first,
                LastStart = last,
            });
        }
Example #3
0
        /// <summary>
        /// Erstellt eine neue Beschreibung.
        /// </summary>
        /// <param name="guide">Die zugehörige Programmzeitschrift.</param>
        /// <returns>Die gewünschte Beschreibung.</returns>
        public static GuideInfo Create( ProgramGuideManager guide )
        {
            // Collectors
            var sources = new HashSet<SourceIdentifier>();
            var stations = new HashSet<string>();
            var first = default( DateTime? );
            var last = default( DateTime? );

            // Process
            foreach (var entry in guide.LeafEntries.Events)
            {
                // Start time
                var start = entry.StartTime;
                if (!first.HasValue)
                    first = start;
                else if (start < first.Value)
                    first = start;
                if (!last.HasValue)
                    last = start;
                else if (start > last.Value)
                    last = start;

                // Add the source name
                var source = entry.Source;
                var sourceInfo = VCRProfiles.FindSource( guide.ProfileName, source );
                if (sourceInfo != null)
                    if (sources.Add( source ))
                        stations.Add( sourceInfo.GetUniqueName() );
            }

            // Report
            return
                new GuideInfo
                {
                    SourceNames = stations.OrderBy( name => name ).ToArray(),
                    FirstStart = first,
                    LastStart = last,
                };
        }