Пример #1
0
 /// <summary>
 /// Ermittelt einen Geräteparameter.
 /// </summary>
 /// <param name="name">Der Name des Parameters.</param>
 /// <returns>Die gewünschten Informationen.</returns>
 /// <exception cref="ArgumentNullException">Es wurde kein Name angegeben.</exception>
 protected string GetDeviceAspect(string name)
 {
     // Validate
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     else
     {
         return(EffectiveDeviceAspects.GetDeviceAspect(name));
     }
 }
Пример #2
0
        /// <summary>
        /// Wandelt die Parameter von der alten Darstellung vor DVB.NET 4.0 in die aktuelle Darstellung um.
        /// </summary>
        /// <returns>Gesetzt, wenn die Umwandlung erfolgreich war.</returns>
        private bool Translate()
        {
            // Reset copy from profile - will reprocess
            EffectivePipeline.Clear();
            EffectiveDeviceAspects.Clear();

            // Translate parameters
            for (int i = EffectiveProfileParameters.Count; i-- > 0;)
            {
                // Attach to parameter
                var setting = EffectiveProfileParameters[i];
                if (setting == null)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(setting.Name))
                {
                    continue;
                }

                // Dispatch
                switch (setting.Name)
                {
                case "CaptureMoniker": EffectiveDeviceAspects.Add(new DeviceAspect {
                        Aspekt = Aspect_CaptureMoniker, Value = setting.Value
                    }); break;

                case "TunerMoniker": EffectiveDeviceAspects.Add(new DeviceAspect {
                        Aspekt = Aspect_TunerMoniker, Value = setting.Value
                    }); break;

                case "Capture": EffectiveDeviceAspects.Add(new DeviceAspect {
                        Aspekt = Aspect_CaptureName, Value = setting.Value
                    }); break;

                case "Tuner": EffectiveDeviceAspects.Add(new DeviceAspect {
                        Aspekt = Aspect_TunerName, Value = setting.Value
                    }); break;

                case "Type": break;

                case "DiSEqCProvider":
                {
                    // Check legacy providers
                    if (!string.IsNullOrEmpty(setting.Value))
                    {
                        // Load
                        string mapping;
                        if (!s_KnownDiSEqCProviders.TryGetValue(setting.Value, out mapping))
                        {
                            return(false);
                        }

                        // Remember DiSEqC
                        EffectivePipeline.Add(new PipelineItem {
                                SupportedOperations = PipelineTypes.DiSEqC, ComponentType = mapping ?? setting.Value
                            });

                        // Hauppauge special - DiSEqC implies DVB-S2 control which is separated starting with DVB.NET 4.0
                        if (setting.Value.Equals("JMS.DVB.Provider.NovaS2.NovaHDS2, JMS.DVB.Provider.NovaS2"))
                        {
                            EffectivePipeline.Add(new PipelineItem {
                                    SupportedOperations = PipelineTypes.DVBS2, ComponentType = HauppaugeNovaS2Modulation
                                });
                        }
                    }

                    // Remove from parameter
                    break;
                }

                case "PayTVProvider":
                {
                    // Check legacy providers
                    if (!string.IsNullOrEmpty(setting.Value))
                    {
                        // Load
                        string mapping;
                        if (!s_KnownPayTVProviders.TryGetValue(setting.Value, out mapping))
                        {
                            return(false);
                        }

                        // Remember CI/CAM
                        EffectivePipeline.Add(new PipelineItem {
                                SupportedOperations = PipelineTypes.CICAM, ComponentType = mapping ?? setting.Value
                            });
                    }

                    // Remove from parameter
                    break;
                }

                default: continue;
                }

                // Eaten up
                EffectiveProfileParameters.RemoveAt(i);
            }

            // Refill from original settings
            foreach (var item in Profile.Pipeline)
            {
                if (item.SupportedOperations != PipelineTypes.SignalInformation)
                {
                    return(false);
                }
                else if (string.IsNullOrEmpty(item.ComponentType))
                {
                    return(false);
                }
                else
                {
                    switch (item.ComponentType)
                    {
                    case "JMS.DVB.Provider.NovaS2.SignalExtension, JMS.DVB.Provider.NovaS2": EffectivePipeline.Add(new PipelineItem {
                            SupportedOperations = PipelineTypes.SignalInformation, ComponentType = HauppaugeNovaS2Signal
                        }); break;

                    case "JMS.DVB.Provider.TTBudget.SignalExtension, JMS.DVB.Provider.TTBudget": EffectivePipeline.Add(new PipelineItem {
                            SupportedOperations = PipelineTypes.SignalInformation, ComponentType = item.ComponentType
                        }); break;

                    default: return(false);
                    }
                }
            }

            // Did it
            return(true);
        }