Ejemplo n.º 1
0
        /// <summary>
        /// Parse the entire perfmon xml config blob and build a collection of
        /// perfmon definitions.  Note the rootnode is a "config" element and the
        /// child elements are "variable".
        /// </summary>
        private static PerfmonDefinition[] GetPerfmonDefinitions(string xml)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);

                XmlNode parentNode = doc.FirstChild;

                List <PerfmonDefinition> perfmonDefinitions = new List <PerfmonDefinition>();

                foreach (XmlNode node in parentNode.ChildNodes)
                {
                    try
                    {
                        var def = new PerfmonDefinition(node);
                        if (def.HasValueSet)
                        {
                            perfmonDefinitions.Add(def);
                        }
                    }
                    catch (Exception e)
                    {
                        log.Debug($"Exception unmarshalling perfmon definition '{node.OuterXml}'", e);
                    }
                }

                return(perfmonDefinitions.ToArray());
            }
            catch (Exception e)
            {
                log.Debug(e, e);
                return(new PerfmonDefinition[0]);
            }
        }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            PerfmonDefinition other = obj as PerfmonDefinition;

            if (other == null)
            {
                return(false);
            }

            return(other.name == name &&
                   other.alarmTriggerLevel == alarmTriggerLevel &&
                   other.alarmTriggerPeriod == alarmTriggerPeriod &&
                   other.alarmAutoInhibitPeriod == alarmAutoInhibitPeriod);
        }
Ejemplo n.º 3
0
        public void Populate(PerfmonDefinition perfmon)
        {
            Debug.Assert(XapiToGuiTriggerLevel != null && XapiToGuiTriggerPeriod != null && XapiToGuiAlertInterval != null);

            if (perfmon.HasValueSet)
            {
                m_checkBox.Checked = true;
                m_upDownTriggerLevel.Value = XapiToGuiTriggerLevel(perfmon.AlarmTriggerLevel);
                m_upDownTriggerPeriod.Value = XapiToGuiTriggerPeriod(perfmon.AlarmTriggerPeriod);
            }

            try
            {
                m_upDownAlertInterval.Value = XapiToGuiAlertInterval(perfmon.AlarmAutoInhibitPeriod);
            }
            catch
            {
                m_upDownAlertInterval.Value = 60;
            }

            StoreOriginalSetting();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Parse the entire perfmon xml config blob and build a collection of
        /// perfmon definitions.  Note the rootnode is a "config" element and the
        /// child elements are "variable".
        /// </summary>
        private static PerfmonDefinition[] GetPerfmonDefinitions(string xml)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);

                XmlNode parentNode = doc.FirstChild;

                List<PerfmonDefinition> perfmonDefinitions = new List<PerfmonDefinition>();

                foreach (XmlNode node in parentNode.ChildNodes)
                {
                    try
                    {
                        var def = new PerfmonDefinition(node);
                        if (def.HasValueSet)
                            perfmonDefinitions.Add(def);
                    }
                    catch (Exception e)
                    {
                        log.DebugFormat("Exception unmarshalling perfmon definition '{0}'", node.OuterXml);
                        log.Debug(e, e);
                    }
                }

                return perfmonDefinitions.ToArray();
            }
            catch (Exception e)
            {
                log.Debug(e, e);
                return new PerfmonDefinition[0];
            }
        }