/// <summary> /// Startet eine Aufzeichnung oder eine Aufgabe. /// </summary> /// <param name="item">Die Beschreibung der Aufgabe.</param> /// <returns>Gesetzt, wenn der Vorgang erfolgreich war.</returns> public bool Start(IScheduleInformation item) { // Validate if (item is ScheduleInformation) { VCRServer.LogError(Properties.Resources.BadScheduleInformation, item.Definition.UniqueIdentifier, item.Definition.Name); } // Try start if (!m_manager.Start(item)) { return(false); } // Remember m_started.Add(item.Definition.UniqueIdentifier, new ScheduleInformation(item)); // Did it return(true); }
/// <summary> /// Erstellt eine neue Planung. /// </summary> /// <param name="site">Die zugehörige Arbeitsumgebung.</param> private RecordingPlanner(IRecordingPlannerSite site) { // Remember m_site = site; // Process all profiles foreach (var profileName in site.ProfileNames) { // Look up the profile var profile = ProfileManager.FindProfile(profileName); if (profile == null) { continue; } // Create the resource for it var profileResource = ProfileScheduleResource.Create(profileName); // Remember m_resources.Add(profileName, profileResource); // See if this is a leaf profile if (!string.IsNullOrEmpty(profile.UseSourcesFrom)) { continue; } // See if we should process guide updates var guideTask = site.CreateProgramGuideTask(profileResource, profile); if (guideTask != null) { m_tasks.Add(guideTask); } // See if we should update the source list var scanTask = site.CreateSourceScanTask(profileResource, profile); if (scanTask != null) { m_tasks.Add(scanTask); } } // Make sure we report all errors try { // Create the manager m_manager = ResourceManager.Create(site.ScheduleRulesPath, ProfileManager.ProfileNameComparer); } catch (Exception e) { // Report VCRServer.LogError(Properties.Resources.BadRuleFile, e.Message); // Use standard rules m_manager = ResourceManager.Create(ProfileManager.ProfileNameComparer); } // Safe configure it try { // All all resources foreach (var resource in m_resources.Values) { m_manager.Add(resource); } } catch (Exception e) { // Cleanup Dispose(); // Report VCRServer.Log(e); } }