Example #1
0
 public void copy(DevCommonThreshold src)
 {
     this.voltage          = src.voltage;
     this.power            = src.power;
     this.powerDissipation = src.powerDissipation;
     this.temperature      = src.temperature;
     this.humidity         = src.humidity;
     this.pressure         = src.pressure;
 }
Example #2
0
 public void copy(DevThreshold src)
 {
     this.ThresholdsFlg = new System.Collections.Generic.List <ThresholdFlg>();
     for (int i = 0; i < src.ThresholdsFlg.Count; i++)
     {
         ThresholdFlg src2 = src.ThresholdsFlg[i];
         ThresholdFlg item = default(ThresholdFlg);
         item.copy(src2);
         this.ThresholdsFlg.Add(item);
     }
     this.UIEditFlg = new System.Collections.Generic.List <ThresholdFlg>();
     for (int j = 0; j < src.UIEditFlg.Count; j++)
     {
         ThresholdFlg src2 = src.UIEditFlg[j];
         ThresholdFlg item = default(ThresholdFlg);
         item.copy(src2);
         this.UIEditFlg.Add(item);
     }
     this.currentThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int k = 0; k < src.currentThresholds.Count; k++)
     {
         stru_CommRange src3  = src.currentThresholds[k];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.currentThresholds.Add(item2);
     }
     this.voltageThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int l = 0; l < src.voltageThresholds.Count; l++)
     {
         stru_CommRange src3  = src.voltageThresholds[l];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.voltageThresholds.Add(item2);
     }
     this.powerThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int m = 0; m < src.powerThresholds.Count; m++)
     {
         stru_CommRange src3  = src.powerThresholds[m];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.powerThresholds.Add(item2);
     }
     this.powerDissThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int n = 0; n < src.powerDissThresholds.Count; n++)
     {
         stru_CommRange src3  = src.powerDissThresholds[n];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.powerDissThresholds.Add(item2);
     }
     this.tempThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int num = 0; num < src.tempThresholds.Count; num++)
     {
         stru_CommRange src3  = src.tempThresholds[num];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.tempThresholds.Add(item2);
     }
     this.HumiThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int num2 = 0; num2 < src.HumiThresholds.Count; num2++)
     {
         stru_CommRange src3  = src.HumiThresholds[num2];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.HumiThresholds.Add(item2);
     }
     this.PressThresholds = new System.Collections.Generic.List <stru_CommRange>();
     for (int num3 = 0; num3 < src.PressThresholds.Count; num3++)
     {
         stru_CommRange src3  = src.PressThresholds[num3];
         stru_CommRange item2 = default(stru_CommRange);
         item2.copy(src3);
         this.PressThresholds.Add(item2);
     }
     this.commonThresholds = default(DevCommonThreshold);
     this.commonThresholds.copy(src.commonThresholds);
 }
Example #3
0
        private DevCommonThreshold getCommonThresholds(XmlTextReader reader)
        {
            DevCommonThreshold result = default(DevCommonThreshold);

            while (reader.Read())
            {
                if (reader.Name.Equals("threshold"))
                {
                    while (reader.Read())
                    {
                        XmlNodeType nodeType = reader.NodeType;
                        if (nodeType != XmlNodeType.Element)
                        {
                            if (nodeType == XmlNodeType.EndElement)
                            {
                                if (reader.Name.Equals("public"))
                                {
                                    return(result);
                                }
                            }
                        }
                        else
                        {
                            if (reader.Name.Equals("voltage"))
                            {
                                result.voltage = reader.GetAttribute("range");
                            }
                            else
                            {
                                if (reader.Name.Equals("power"))
                                {
                                    result.power = reader.GetAttribute("range");
                                }
                                else
                                {
                                    if (reader.Name.Equals("powerDissipation"))
                                    {
                                        result.powerDissipation = reader.GetAttribute("range");
                                    }
                                    else
                                    {
                                        if (reader.Name.Equals("temperature"))
                                        {
                                            result.temperature = reader.GetAttribute("range");
                                        }
                                        else
                                        {
                                            if (reader.Name.Equals("humidity"))
                                            {
                                                result.humidity = reader.GetAttribute("range");
                                            }
                                            else
                                            {
                                                if (reader.Name.Equals("pressure"))
                                                {
                                                    result.pressure = reader.GetAttribute("range");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #4
0
        private void ReadDevModelInfo(string xmlDir, ref string m_Vesion, ref int m_maxZoneNum, ref int m_maxRackNum, ref int m_maxDevNum, ref bool m_supportISG, ref int m_ISGtimeout, ref bool m_supportBillprot, ref bool m_isdebuglogExport, ref int m_supportOEMDev, ref int m_runEnv_type, ref int m_runEnv_dbusage, ref int m_PeakPowerMethod, ref int m_MySQLUseMajorVersionOnly)
        {
            DevModelConfig     devModelConfig = new DevModelConfig(string.Empty);
            DevCommonThreshold src            = default(DevCommonThreshold);
            string             text           = "";
            XmlTextReader      xmlTextReader  = new XmlTextReader(xmlDir);

            while (xmlTextReader.Read())
            {
                XmlNodeType nodeType = xmlTextReader.NodeType;
                switch (nodeType)
                {
                case XmlNodeType.Element:
                    if (xmlTextReader.Name.Equals("version"))
                    {
                        m_Vesion = xmlTextReader.GetAttribute("value");
                    }
                    else
                    {
                        if (xmlTextReader.Name.Equals("maxZoneNum"))
                        {
                            m_maxZoneNum = System.Convert.ToInt32(xmlTextReader.GetAttribute("value"));
                        }
                        else
                        {
                            if (xmlTextReader.Name.Equals("maxRackNum"))
                            {
                                m_maxRackNum = System.Convert.ToInt32(xmlTextReader.GetAttribute("value"));
                            }
                            else
                            {
                                if (xmlTextReader.Name.Equals("maxDevNum"))
                                {
                                    m_maxDevNum = System.Convert.ToInt32(xmlTextReader.GetAttribute("value"));
                                }
                                else
                                {
                                    if (xmlTextReader.Name.Equals("isdebuglogExportTRUE"))
                                    {
                                        m_isdebuglogExport = true;
                                    }
                                    else
                                    {
                                        if (xmlTextReader.Name.Equals("wantISGsupport"))
                                        {
                                            int    num       = 0;
                                            int    num2      = 0;
                                            string attribute = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                string[] array = attribute.Split(new char[]
                                                {
                                                    ','
                                                });
                                                int.TryParse(array[0], out num);
                                                int.TryParse(array[1], out num2);
                                                if (num == 13122)
                                                {
                                                    m_supportISG = true;
                                                    m_ISGtimeout = num2;
                                                }
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("wantBillProtsupport"))
                                        {
                                            int    num        = 0;
                                            string attribute2 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute2, out num);
                                                if (num == 1)
                                                {
                                                    m_supportBillprot = true;
                                                }
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("supportOEMDev"))
                                        {
                                            int    num        = 0;
                                            string attribute3 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute3, out num);
                                                m_supportOEMDev = num;
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("PowerMethod"))
                                        {
                                            int    num        = 0;
                                            string attribute4 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute4, out num);
                                                m_PeakPowerMethod = num;
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("MySQLUseMajorVersionOnly"))
                                        {
                                            int    num        = 0;
                                            string attribute5 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute5, out num);
                                                m_MySQLUseMajorVersionOnly = num;
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("runenv"))
                                        {
                                            try
                                            {
                                                string attribute6 = xmlTextReader.GetAttribute("type");
                                                if (attribute6 != null)
                                                {
                                                    int num;
                                                    int.TryParse(attribute6, out num);
                                                    m_runEnv_type = num;
                                                }
                                            }
                                            catch (System.Exception)
                                            {
                                            }
                                            try
                                            {
                                                string attribute7 = xmlTextReader.GetAttribute("dbusage");
                                                if (attribute7 != null)
                                                {
                                                    int num;
                                                    int.TryParse(attribute7, out num);
                                                    m_runEnv_dbusage = num;
                                                }
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("public"))
                                        {
                                            src = this.getCommonThresholds(xmlTextReader);
                                        }
                                        else
                                        {
                                            if (xmlTextReader.Name.Equals("device"))
                                            {
                                                devModelConfig = new DevModelConfig(string.Empty);
                                                devModelConfig.devThresholds.commonThresholds.copy(src);
                                                devModelConfig.modelName = xmlTextReader.GetAttribute("name");
                                                devModelConfig.modelName = devModelConfig.modelName.Trim();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
IL_35B:
                    text = xmlTextReader.Name;
                    if (text.Equals("threshold"))
                    {
                        this.getThresholds(ref devModelConfig, xmlTextReader);
                    }
                    else
                    {
                        if (text.Equals("ampcapacity"))
                        {
                            stru_CommRange item = default(stru_CommRange);
                            item.type  = xmlTextReader.GetAttribute("type");
                            item.id    = xmlTextReader.GetAttribute("id");
                            item.range = xmlTextReader.GetAttribute("range");
                            devModelConfig.ampcapicity.Add(item);
                        }
                        else
                        {
                            if (text.Equals("fwupgrade"))
                            {
                                int num;
                                if (int.TryParse(xmlTextReader.GetAttribute("validate"), out num))
                                {
                                    devModelConfig.FWvalidate = num;
                                }
                                devModelConfig.FWnms = ((xmlTextReader.GetAttribute("nms") == null) ? "" : xmlTextReader.GetAttribute("nms"));
                                devModelConfig.FWext = ((xmlTextReader.GetAttribute("ext") == null) ? "" : xmlTextReader.GetAttribute("ext"));
                            }
                        }
                    }
                    break;

                case XmlNodeType.Attribute:
                    break;

                case XmlNodeType.Text:
                    if (text.Equals("outletNumber"))
                    {
                        devModelConfig.portNum = System.Convert.ToInt32(xmlTextReader.Value);
                    }
                    else
                    {
                        if (text.Equals("sensorNumber"))
                        {
                            devModelConfig.sensorNum = System.Convert.ToInt32(xmlTextReader.Value);
                        }
                        else
                        {
                            if (text.Equals("bankNumber"))
                            {
                                this.getbankNumber(ref devModelConfig, xmlTextReader.Value);
                            }
                            else
                            {
                                if (text.Equals("bankOpt"))
                                {
                                    this.getbankOpt(ref devModelConfig, xmlTextReader.Value);
                                }
                                else
                                {
                                    if (text.Equals("outletCtrl"))
                                    {
                                        this.getoutletCtrl(ref devModelConfig, xmlTextReader.Value);
                                    }
                                    else
                                    {
                                        if (text.Equals("outletReading"))
                                        {
                                            devModelConfig.perportreadingOutlets = (ulong)System.Convert.ToUInt32(xmlTextReader.Value, 16);
                                            if (devModelConfig.perportreadingOutlets > 0uL)
                                            {
                                                devModelConfig.perportreading = 2;
                                            }
                                            else
                                            {
                                                devModelConfig.perportreading = 1;
                                            }
                                        }
                                        else
                                        {
                                            if (text.Equals("bankReading"))
                                            {
                                                this.getbankReading(ref devModelConfig, xmlTextReader.Value);
                                            }
                                            else
                                            {
                                                if (text.Equals("popReading"))
                                                {
                                                    this.getPopInfo(ref devModelConfig, xmlTextReader.Value);
                                                }
                                                else
                                                {
                                                    if (text.Equals("doorReading"))
                                                    {
                                                        this.getDoorInfo(ref devModelConfig, xmlTextReader.Value);
                                                    }
                                                    else
                                                    {
                                                        if (text.Equals("devcapacity"))
                                                        {
                                                            devModelConfig.devcapacity = xmlTextReader.Value;
                                                        }
                                                        else
                                                        {
                                                            if (text.Equals("commonThresholdFlag"))
                                                            {
                                                                devModelConfig.commonThresholdFlag = System.Convert.ToInt32(xmlTextReader.Value);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;

                default:
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (xmlTextReader.Name.Equals("device"))
                        {
                            string   modelName = devModelConfig.modelName;
                            string[] array2    = modelName.Split(new string[]
                            {
                                ","
                            }, System.StringSplitOptions.RemoveEmptyEntries);
                            if (array2.Length == 1)
                            {
                                this.devList.Add(devModelConfig.modelName, devModelConfig);
                            }
                            else
                            {
                                for (int i = 0; i < array2.Length; i++)
                                {
                                    array2[i] = array2[i].Trim();
                                    DevModelConfig value = new DevModelConfig(array2[i]);
                                    value.copy(devModelConfig);
                                    value.modelName = array2[i];
                                    this.devList.Add(value.modelName, value);
                                }
                            }
                            devModelConfig = new DevModelConfig(string.Empty);
                        }
                    }
                    break;
                }
            }
        }