Example #1
0
        /// <summary>
        /// Create a copy of this instance.
        /// </summary>
        /// <returns>A new instance with the same properties as the current instance.</returns>
        public RunParameters Clone()
        {
            RunParameters newParameters = new RunParameters(parameterSet);

            if (parameterSet == ParameterSet.Collector)
            {
                if (selectedTuners != null)
                {
                    newParameters.selectedTuners = new Collection<int>();
                    foreach (int tuner in selectedTuners)
                        newParameters.selectedTuners.Add(tuner);
                }
            }

            newParameters.outputFileName = outputFileName;
            newParameters.wmcImportName = wmcImportName;
            newParameters.frequencyTimeout = frequencyTimeout;
            newParameters.lockTimeout = lockTimeout;
            newParameters.repeats = repeats;
            newParameters.countryCode = countryCode;
            newParameters.region = region;
            newParameters.inputLanguage = inputLanguage;
            newParameters.outputLanguage = outputLanguage;
            newParameters.timeZone = timeZone;
            newParameters.nextTimeZone = nextTimeZone;
            newParameters.nextTimeZoneChange = nextTimeZoneChange;
            newParameters.timeZoneSet = timeZoneSet;

            if (options != null)
            {
                newParameters.options = new Collection<string>();
                foreach (string option in options)
                    newParameters.options.Add(option);
            }

            if (traceIDs != null)
            {
                newParameters.traceIDs = new Collection<string>();
                foreach (string traceID in traceIDs)
                    newParameters.traceIDs.Add(traceID);
            }

            if (debugIDs != null)
            {
                newParameters.debugIDs = new Collection<string>();
                foreach (string debugID in debugIDs)
                    newParameters.debugIDs.Add(debugID);
            }

            newParameters.tsFileName = tsFileName;
            newParameters.channelBouquet = channelBouquet;
            newParameters.channelRegion = channelRegion;
            newParameters.diseqcIdentity = diseqcIdentity;
            newParameters.eitPid = eitPid;

            if (mhw1Pids != null)
                newParameters.mhw1Pids = (int[])mhw1Pids.Clone();

            if (mhw2Pids != null)
                newParameters.mhw2Pids = (int[])mhw2Pids.Clone();

            if (parameterSet == ParameterSet.Plugin)
            {
                if (pluginFrequency != null)
                    newParameters.pluginFrequency = pluginFrequency.Clone();
            }
            else
            {
                originalStations = new Collection<TVStation>();
                foreach (TVStation station in TVStation.StationCollection)
                    originalStations.Add(station.Clone());

                originalFrequencies = new Collection<TuningFrequency>();
                foreach (TuningFrequency frequency in TuningFrequency.FrequencyCollection)
                    originalFrequencies.Add(frequency.Clone());
            }

            originalTimeOffsets = new Collection<TimeOffsetChannel>();

            foreach (TimeOffsetChannel oldOffset in TimeOffsetChannel.Channels)
            {
                TimeOffsetChannel newOffset = new TimeOffsetChannel(oldOffset.SourceChannel, oldOffset.DestinationChannel, oldOffset.Offset);
                originalTimeOffsets.Add(newOffset);
            }

            if (ChannelFilterEntry.ChannelFilters == null)
                originalFilters = null;
            else
            {
                originalFilters = new Collection<ChannelFilterEntry>();

                foreach (ChannelFilterEntry oldFilterEntry in ChannelFilterEntry.ChannelFilters)
                {
                    ChannelFilterEntry newFilterEntry = new ChannelFilterEntry(oldFilterEntry.OriginalNetworkID,
                        oldFilterEntry.TransportStreamID, oldFilterEntry.StartServiceID, oldFilterEntry.EndServiceID);

                    originalFilters.Add(newFilterEntry);
                }
            }

            if (RepeatExclusion.Exclusions == null)
                originalRepeatExclusions = null;
            else
            {
                originalRepeatExclusions = new Collection<RepeatExclusion>();

                foreach (RepeatExclusion oldRepeatExclusion in RepeatExclusion.Exclusions)
                {
                    RepeatExclusion newRepeatExclusion = new RepeatExclusion(oldRepeatExclusion.Title, oldRepeatExclusion.Description);
                    originalRepeatExclusions.Add(newRepeatExclusion);
                }
            }

            if (RepeatExclusion.PhrasesToIgnore == null)
                originalPhrasesToIgnore = null;
            else
            {
                originalPhrasesToIgnore = new Collection<string>();

                foreach (string oldPhrase in RepeatExclusion.PhrasesToIgnore)
                    originalPhrasesToIgnore.Add(oldPhrase);
            }

            newParameters.MaxService = maxService;

            return (newParameters);
        }
Example #2
0
        private void processOffsetChannel(TimeOffsetChannel timeOffsetChannel)
        {
            Logger.Instance.Write("Processing time shift channel " + timeOffsetChannel.SourceChannel.Name + " to " + timeOffsetChannel.DestinationChannel.Name);

            TVStation sourceStation = TVStation.FindStation(timeOffsetChannel.SourceChannel.OriginalNetworkID,
                timeOffsetChannel.SourceChannel.TransportStreamID,
                timeOffsetChannel.SourceChannel.ServiceID);
            if (sourceStation == null)
            {
                Logger.Instance.Write("<e> Source channel not located: " + timeOffsetChannel.SourceChannel.Name);
                return;
            }

            TVStation destinationStation = TVStation.FindStation(timeOffsetChannel.DestinationChannel.OriginalNetworkID,
                timeOffsetChannel.DestinationChannel.TransportStreamID,
                timeOffsetChannel.DestinationChannel.ServiceID);
            if (destinationStation == null)
            {
                Logger.Instance.Write("<e> Destination channel not located: " + timeOffsetChannel.DestinationChannel.Name);
                return;
            }

            if (destinationStation.EPGCollection.Count != 0)
            {
                destinationStation.EPGCollection.Clear();
                Logger.Instance.Write("Destination channel existing EPG data cleared: " + timeOffsetChannel.DestinationChannel.Name);
            }

            foreach (EPGEntry epgEntry in sourceStation.EPGCollection)
            {
                EPGEntry newEntry = epgEntry.Clone();
                newEntry.StartTime += new TimeSpan(timeOffsetChannel.Offset, 0, 0);
                destinationStation.EPGCollection.Add(newEntry);
            }

            Logger.Instance.Write("Created time shifted channel " + timeOffsetChannel.DestinationChannel.Name + " with " +
                destinationStation.EPGCollection.Count + " EPG entries");
        }
Example #3
0
        private int processOffsetChannel(string parts)
        {
            string[] parameters = parts.Split(new char[] { ',' });
            if (parameters.Length != 9)
            {
                Logger.Instance.Write("INI file format error: An Offset line is wrong.");
                return (errorCodeFormatError);
            }

            try
            {
                TVStation sourceChannel = new TVStation(parameters[0].Trim().Replace("%%", ","));
                sourceChannel.OriginalNetworkID = Int32.Parse(parameters[1].Trim());
                sourceChannel.TransportStreamID = Int32.Parse(parameters[2].Trim());
                sourceChannel.ServiceID = Int32.Parse(parameters[3].Trim());

                TVStation destinationChannel = new TVStation(parameters[4].Trim().Replace("%%", ","));
                destinationChannel.OriginalNetworkID = Int32.Parse(parameters[5].Trim());
                destinationChannel.TransportStreamID = Int32.Parse(parameters[6].Trim());
                destinationChannel.ServiceID = Int32.Parse(parameters[7].Trim());

                TimeOffsetChannel channel = new TimeOffsetChannel(sourceChannel, destinationChannel, Int32.Parse(parameters[8].Trim()));
                TimeOffsetChannel.Channels.Add(channel);
            }
            catch (FormatException)
            {
                Logger.Instance.Write("INI file format error: An Offset line is wrong.");
                return (errorCodeFormatError);
            }
            catch (ArithmeticException)
            {
                Logger.Instance.Write("INI file format error: An Offset line is wrong.");
                return (errorCodeFormatError);
            }

            return (errorCodeNoError);
        }