public void LoadQualityConfig(QualityConfig QualityConfig)
        {
            this.QualityConfig = QualityConfig;
            bool emptyConfig = (QualityConfig == null);

            if (emptyConfig || QualityConfig.HttpErrorCount)
                AddAggregator(EventType.HttpError);
            if (emptyConfig || QualityConfig.ProcessCpuLoad)
                AddAggregator(EventType.ProcessCpuLoad);
            if (emptyConfig || QualityConfig.SystemCpuLoad)
                AddAggregator(EventType.SystemCpuLoad);
            if (emptyConfig || QualityConfig.DroppedFrames)
                AddAggregator(EventType.DroppedFramesPerSecond);
            if (emptyConfig || QualityConfig.RenderedFrames)
                AddAggregator(EventType.RenderedFramesPerSecond);
            if (emptyConfig || QualityConfig.PerceivedBandwidth)
                AddAggregator(EventType.PerceivedBandwidth);
            if (emptyConfig || QualityConfig.Bitrate || QualityConfig.BitrateChangeCount || QualityConfig.BitrateMax || QualityConfig.BitrateMaxDuration)
                AddAggregator(EventType.BitrateChanged);
            if (emptyConfig || QualityConfig.VideoBufferSize)
                AddAggregator(EventType.VideoBufferSize);
            if (emptyConfig || QualityConfig.VideoDownloadLatency)
                AddAggregator(EventType.VideoChunkDownload);
            if (emptyConfig || QualityConfig.AudioDownloadLatency)
                AddAggregator(EventType.AudioChunkDownload);
            if (emptyConfig || QualityConfig.AudioBufferSize)
                AddAggregator(EventType.AudioBufferSize);
            if (emptyConfig || QualityConfig.Buffering)
                AddAggregator(EventType.BufferingStateChanged);
            if (emptyConfig || QualityConfig.DvrOperationCount)
                AddAggregator(EventType.DvrOperation);
            if (emptyConfig || QualityConfig.FullScreenChangeCount)
                AddAggregator(EventType.FullScreenChanged);
        }
 public QualityAggregationAgent(TimeSpan SlidingWindowInterval, QualityConfig QualityConfig)
     : base(false, SlidingWindowInterval)
 {
     if (QualityConfig == null)
         LoadDefaultQualityConfig();
     else
         LoadQualityConfig(QualityConfig);
 }
 public QualitySnapshotAgent(TimeSpan SlidingWindowInterval, QualityConfig QualityConfig)
     : base(true, SlidingWindowInterval)
 {
     if (QualityConfig == null)
         LoadDefaultQualityConfig();
     else
         LoadQualityConfig(QualityConfig);
 }
 public QualityAggregationAgent(TimeSpan SlidingWindowInterval, QualityConfig QualityConfig)
     : base(false, SlidingWindowInterval)
 {
     if (QualityConfig == null)
     {
         LoadDefaultQualityConfig();
     }
     else
     {
         LoadQualityConfig(QualityConfig);
     }
 }
 public QualitySnapshotAgent(TimeSpan SlidingWindowInterval, QualityConfig QualityConfig)
     : base(true, SlidingWindowInterval)
 {
     if (QualityConfig == null)
     {
         LoadDefaultQualityConfig();
     }
     else
     {
         LoadQualityConfig(QualityConfig);
     }
 }
        public void LoadQualityConfig(QualityConfig QualityConfig)
        {
            this.QualityConfig = QualityConfig;
            bool emptyConfig = (QualityConfig == null);

            if (emptyConfig || QualityConfig.HttpErrorCount)
            {
                AddAggregator(EventType.HttpError);
            }
            if (emptyConfig || QualityConfig.ProcessCpuLoad)
            {
                AddAggregator(EventType.ProcessCpuLoad);
            }
            if (emptyConfig || QualityConfig.SystemCpuLoad)
            {
                AddAggregator(EventType.SystemCpuLoad);
            }
            if (emptyConfig || QualityConfig.DroppedFrames)
            {
                AddAggregator(EventType.DroppedFramesPerSecond);
            }
            if (emptyConfig || QualityConfig.RenderedFrames)
            {
                AddAggregator(EventType.RenderedFramesPerSecond);
            }
            if (emptyConfig || QualityConfig.PerceivedBandwidth)
            {
                AddAggregator(EventType.PerceivedBandwidth);
            }
            if (emptyConfig || QualityConfig.Bitrate || QualityConfig.BitrateChangeCount || QualityConfig.BitrateMax || QualityConfig.BitrateMaxDuration)
            {
                AddAggregator(EventType.BitrateChanged);
            }
            if (emptyConfig || QualityConfig.VideoBufferSize)
            {
                AddAggregator(EventType.VideoBufferSize);
            }
            if (emptyConfig || QualityConfig.VideoDownloadLatency)
            {
                AddAggregator(EventType.VideoChunkDownload);
            }
            if (emptyConfig || QualityConfig.AudioDownloadLatency)
            {
                AddAggregator(EventType.AudioChunkDownload);
            }
            if (emptyConfig || QualityConfig.AudioBufferSize)
            {
                AddAggregator(EventType.AudioBufferSize);
            }
            if (emptyConfig || QualityConfig.Buffering)
            {
                AddAggregator(EventType.BufferingStateChanged);
            }
            if (emptyConfig || QualityConfig.DvrOperationCount)
            {
                AddAggregator(EventType.DvrOperation);
            }
            if (emptyConfig || QualityConfig.FullScreenChangeCount)
            {
                AddAggregator(EventType.FullScreenChanged);
            }
        }
        public static QualityConfig Load(XmlReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            QualityConfig result = new QualityConfig();

            reader.GoToElement();
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                        case "DroppedFrames":
                            result.DroppedFrames = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "RenderedFrames":
                            result.RenderedFrames = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "ProcessCPULoad":
                            result.ProcessCpuLoad = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "SystemCPULoad":
                            result.SystemCpuLoad = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "Bitrate":
                            result.Bitrate = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "BitrateMax":
                            result.BitrateMax = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "BitrateMaxDuration":
                            result.BitrateMaxDuration = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "PerceivedBandwidth":
                            result.PerceivedBandwidth = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "VideoBufferSize":
                            result.VideoBufferSize = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "AudioBufferSize":
                            result.AudioBufferSize = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "Buffering":
                            result.Buffering = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "BitrateChangeCount":
                            result.BitrateChangeCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "VideoDownloadLatency":
                            result.VideoDownloadLatency = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "AudioDownloadLatency":
                            result.AudioDownloadLatency = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "DvrOperationCount":
                            result.DvrOperationCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "FullScreenChangeCount":
                            result.FullScreenChangeCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;
                        case "HttpErrorCount":
                            result.HttpErrorCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                reader.ReadEndElement();
            }
            else
                reader.Skip();

            return result;
        }
示例#8
0
        public static QualityConfig Load(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            QualityConfig result = new QualityConfig();

            reader.GoToElement();
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                    case "DroppedFrames":
                        result.DroppedFrames = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "RenderedFrames":
                        result.RenderedFrames = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "ProcessCPULoad":
                        result.ProcessCpuLoad = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "SystemCPULoad":
                        result.SystemCpuLoad = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "Bitrate":
                        result.Bitrate = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "BitrateMax":
                        result.BitrateMax = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "BitrateMaxDuration":
                        result.BitrateMaxDuration = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "PerceivedBandwidth":
                        result.PerceivedBandwidth = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "VideoBufferSize":
                        result.VideoBufferSize = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "AudioBufferSize":
                        result.AudioBufferSize = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "Buffering":
                        result.Buffering = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "BitrateChangeCount":
                        result.BitrateChangeCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "VideoDownloadLatency":
                        result.VideoDownloadLatency = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "AudioDownloadLatency":
                        result.AudioDownloadLatency = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "DvrOperationCount":
                        result.DvrOperationCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "FullScreenChangeCount":
                        result.FullScreenChangeCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "HttpErrorCount":
                        result.HttpErrorCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }

            return(result);
        }
        /// <summary>
        /// Creates an instance of the main diagnostic config object from an XmlReader
        /// </summary>
        public static DiagnosticsConfig Load(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            var result = new DiagnosticsConfig();
            List <EdgeServerRules> edgeServerRuleCollection = null;

            reader.GoToElement();
            reader.ReadStartElement();
            if (!reader.IsEmptyElement)
            {
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                    case "TraceMonitor":
                        result.TracingConfig = TracingConfig.Load(reader);
                        break;

                    case "EdgeServerRules":
                        if (!reader.IsEmptyElement)
                        {
                            if (edgeServerRuleCollection == null)
                            {
                                edgeServerRuleCollection        = new List <EdgeServerRules>();
                                result.EdgeServerRuleCollection = edgeServerRuleCollection;
                            }
                            edgeServerRuleCollection.Add(EdgeServerRules.Load(reader));
                        }
                        else
                        {
                            reader.Skip();
                        }
                        break;

                    case "Diagnostics":
                        if (!reader.IsEmptyElement)
                        {
                            reader.ReadStartElement();
                            while (reader.GoToSibling())
                            {
                                switch (reader.LocalName)
                                {
                                case "TrackQuality":
                                    result.TrackQuality = Convert.ToBoolean(reader.ReadElementContentAsInt());
                                    break;

                                case "TrackDownloadErrors":
                                    result.TrackDownloadErrors = Convert.ToBoolean(reader.ReadElementContentAsInt());
                                    break;

                                case "AggregationIntervalMilliseconds":
                                    result.AggregationInterval = TimeSpan.FromMilliseconds(reader.ReadElementContentAsInt());
                                    break;

                                case "TrackQualitySnapshot":
                                    result.TrackQualitySnapshot = Convert.ToBoolean(reader.ReadElementContentAsInt());
                                    break;

                                case "SnapshotIntervalMilliseconds":
                                    result.SnapshotInterval = TimeSpan.FromMilliseconds(reader.ReadElementContentAsInt());
                                    break;

                                case "LatencyAlertThreshold":
                                    result.LatencyAlertThreshold = reader.ReadElementContentAsFloat();
                                    break;

                                case "RecordTraceLogs":
                                    result.RecordTraceLogs = Convert.ToBoolean(reader.ReadElementContentAsInt());
                                    break;

                                case "QualityTracking":
                                    result.QualityConfig = QualityConfig.Load(reader);
                                    break;

                                default:
                                    reader.Skip();
                                    break;
                                }
                            }
                            reader.ReadEndElement();
                        }
                        else
                        {
                            reader.Skip();
                        }
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }

            return(result);
        }