/// <summary> /// Führt die Aufgabe aus. /// </summary> /// <returns>Gesetzt, wenn die Aufgabe synchron abgeschlossen wurde.</returns> bool IPlugInControl.Start() { // Be safe try { // New profile to use Profile newProfile = null; // Check mode if (optSatellite.Checked) { // Just create newProfile = new SatelliteProfile(); } else if (optCable.Checked) { // Create newProfile = new CableProfile(); // Add placeholder location newProfile.Locations.Add(new CableLocation()); } else if (optTerrestrial.Checked) { // Create newProfile = new TerrestrialProfile(); // Add placeholder location newProfile.Locations.Add(new TerrestrialLocation()); } // Get the full path FileInfo path = new FileInfo(Path.Combine(JMS.DVB.ProfileManager.ProfilePath.FullName, txName.Text + "." + JMS.DVB.ProfileManager.ProfileExtension)); // Store it newProfile.Save(path); // Update managers list DVB.ProfileManager.Refresh(); // Prepare for selection m_Site.SelectProfile(txName.Text); // Auto-start configuration m_Site.SelectNextPlugIn(typeof(ProfileEditor)); } catch (Exception e) { // Report MessageBox.Show(this, e.Message, Properties.Resources.NewProfile_Error); } // Done return(true); }
/// <summary> /// Beginnt mit der Ausführung der Aufgabe. /// </summary> /// <returns>Gesetzt, wenn die Aufgabe synchron abgeschlossen wurde.</returns> bool IPlugInControl.Start() { // Set the driver type HardwareTypeItem item = (HardwareTypeItem)selType.SelectedItem; if (null == item) { m_PlugIn.Profile.HardwareType = null; } else { m_PlugIn.Profile.HardwareType = item.Type; } // See if we are using DVB-S SatelliteProfile satProfile = m_PlugIn.Profile as SatelliteProfile; if (null != satProfile) { satProfile.DisableS2Groups = ckDVBS2.Checked; } // Copy device data back to profile m_PlugIn.CurrentEditor.UpdateProfile(); // Copy flags m_PlugIn.Profile.DisableProgramGuide = ckDisableEPG.Checked; // Copy our data back to profile if (0 == selShare.SelectedIndex) { m_PlugIn.Profile.UseSourcesFrom = null; } else { m_PlugIn.Profile.UseSourcesFrom = (string)selShare.SelectedItem; } // Clear out recording parameters m_PlugIn.Profile.Parameters.RemoveAll(p => !string.IsNullOrEmpty(p.Name) && m_RecordingSettings.ContainsKey(p.Name)); // Add all m_PlugIn.Profile.Parameters.AddRange(m_RecordingSettings.Where(p => !string.IsNullOrEmpty(p.Value)).Select(p => new ProfileParameter(p.Key, p.Value))); // Check for rename if (0 == string.Compare(m_PlugIn.Profile.Name, txName.Text, true)) { // Just put to disk m_PlugIn.Profile.Save(); } else { // Attach to the current file position FileInfo oldPath = m_PlugIn.Profile.ProfilePath; // Make the new path FileInfo newPath = new FileInfo(Path.Combine(oldPath.DirectoryName, txName.Text + oldPath.Extension)); // Delete it silently newPath.Delete(); // Update file state oldPath.Refresh(); // See if files are the same bool isSameFile = !oldPath.Exists; // Restart the profile manager DVB.ProfileManager.Refresh(); // Try to save m_PlugIn.Profile.Save(newPath); // Delete the old path if we are not renaming in place if (!isSameFile) { oldPath.Delete(); } // Make it current m_Site.SelectProfile(txName.Text); } // See if we should configure the scan locations if (string.IsNullOrEmpty(m_PlugIn.Profile.UseSourcesFrom)) { if (m_PlugIn.Profile.ScanLocations.Count < 1) { m_Site.SelectNextPlugIn(typeof(Configuration)); } } // Did it return(true); }