/// <summary>
        /// Erzeugt eine neue Instanz.
        /// </summary>
        /// <param name="rootDirectory">Das Arbeitsverzeichnis f?r die Auftragsverwaltung.</param>
        public VCRServer(DirectoryInfo rootDirectory)
        {
            // Report
            Tools.ExtendedLogging("Using Root Directory {0}", rootDirectory.FullName);

            // Prepare profiles
            VCRProfiles.Reset();

            // Create job manager and start it up
            JobManager = new JobManager(new DirectoryInfo(Path.Combine(rootDirectory.FullName, "Jobs")), this);

            // Create profile state manager and start it up
            Profiles = new ProfileStateCollection(this);

            // Register with power manager
            PowerManager.OnPowerUp += BeginNewPlan;
        }
        /// <summary>
        /// Ermittelt alle Quellen eines Ger?teprofils f?r die Nutzung durch den <i>LIVE</i> Zugang.
        /// </summary>
        /// <typeparam name="TTarget">Die Art der Zielklasse.</typeparam>
        /// <param name="profileName">Der Name des Ger?teprofils.</param>
        /// <param name="withTV">Gesetzt, wenn Fernsehsender zu ber?cksichtigen sind.</param>
        /// <param name="withRadio">Gesetzt, wenn Radiosender zu ber?cksichtigen sind.</param>
        /// <param name="factory">Eine Methode zum Erzeugen der Zielelemente aus den Daten einer einzelnen Quelle.</param>
        /// <returns></returns>
        public TTarget[] GetSources <TTarget>(string profileName, bool withTV, bool withRadio, Func <SourceSelection, TTarget> factory)
        {
            // Find the profile
            var profile = FindProfile(profileName);

            if (profile == null)
            {
                return(new TTarget[0]);
            }

            // Create matcher
            Func <Station, bool> matchStation;

            if (withTV)
            {
                if (withRadio)
                {
                    matchStation = station => true;
                }
                else
                {
                    matchStation = station => station.SourceType == SourceTypes.TV;
                }
            }
            else
            if (withRadio)
            {
                matchStation = station => station.SourceType == SourceTypes.Radio;
            }
            else
            {
                return(new TTarget[0]);
            }

            // Filter all we want
            return
                (VCRProfiles
                 .GetSources(profile.ProfileName, matchStation)
                 .Select(factory)
                 .ToArray());
        }
 /// <summary>
 /// Ermittelt den eindeutigen Namen einer Quelle.
 /// </summary>
 /// <param name="source">Die gewünschte Quelle.</param>
 /// <returns>Der eindeutige Name oder <i>null</i>, wenn die Quelle nicht
 /// bekannt ist.</returns>
 public static string GetUniqueName(this SourceSelection source)
 {
     // Forward
     return(VCRProfiles.GetUniqueName(source));
 }
 /// <summary>
 /// Ermittelt eine Quelle.
 /// </summary>
 /// <param name="profile">Das zu verwendende Ger?teprofil.</param>
 /// <param name="name">Der (hoffentlicH) eindeutige Name der Quelle.</param>
 /// <returns>Die Beschreibung der Quelle.</returns>
 public SourceSelection FindSource(string profile, string name)
 {
     // Process
     return(VCRProfiles.FindSource(profile, name));
 }