Exemple #1
0
 public void copy(DevModelConfig src)
 {
     this.firmwareVer         = src.firmwareVer;
     this.autoBasicInfo       = src.autoBasicInfo;
     this.autoRatingInfo      = src.autoRatingInfo;
     this.modelName           = src.modelName;
     this.portNum             = src.portNum;
     this.sensorNum           = src.sensorNum;
     this.bankNum             = src.bankNum;
     this.lineNum             = src.lineNum;
     this.bankCtrlflg         = src.bankCtrlflg;
     this.bankOpt_nameempty   = src.bankOpt_nameempty;
     this.switchable          = src.switchable;
     this.perportreading      = src.perportreading;
     this.perbankReading      = src.perbankReading;
     this.perlineReading      = src.perlineReading;
     this.leakCurrent         = src.leakCurrent;
     this.popNewRule          = src.popNewRule;
     this.popPrioritySupport  = src.popPrioritySupport;
     this.popReading          = src.popReading;
     this.popDefault          = src.popDefault;
     this.popUdefmax          = src.popUdefmax;
     this.doorReading         = src.doorReading;
     this.devcapacity         = src.devcapacity;
     this.deviceMeasureOpt    = src.deviceMeasureOpt;
     this.bankMeasureOpt      = src.bankMeasureOpt;
     this.outletMeasureOpt    = src.outletMeasureOpt;
     this.lineMeasureOpt      = src.lineMeasureOpt;
     this.maxDevThresholdOpt  = src.maxDevThresholdOpt;
     this.minDevThresholdOpt  = src.minDevThresholdOpt;
     this.maxBankThresholdOpt = src.maxBankThresholdOpt;
     this.minBankThresholdOpt = src.minBankThresholdOpt;
     this.maxPortThresholdOpt = src.maxPortThresholdOpt;
     this.minPortThresholdOpt = src.minPortThresholdOpt;
     this.maxLineThresholdOpt = src.maxLineThresholdOpt;
     this.minLineThresholdOpt = src.minLineThresholdOpt;
     this.bankStatusSupport   = src.bankStatusSupport;
     this.outletStatusSupport = src.outletStatusSupport;
     this.ampcapicity         = new System.Collections.Generic.List <stru_CommRange>();
     for (int i = 0; i < src.ampcapicity.Count; i++)
     {
         stru_CommRange src2 = src.ampcapicity[i];
         stru_CommRange item = default(stru_CommRange);
         item.copy(src2);
         this.ampcapicity.Add(item);
     }
     this.commonThresholdFlag           = src.commonThresholdFlag;
     this.energyboxVoltage              = src.energyboxVoltage;
     this.switchableOutlets             = src.switchableOutlets;
     this.killPowerDisableRebootOutlets = src.killPowerDisableRebootOutlets;
     this.perportreadingOutlets         = src.perportreadingOutlets;
     this.devThresholds = default(DevThreshold);
     this.devThresholds.copy(src.devThresholds);
     this.bankOutlets = new System.Collections.Generic.List <BankOutlets>();
     for (int j = 0; j < src.bankOutlets.Count; j++)
     {
         BankOutlets src3  = src.bankOutlets[j];
         BankOutlets item2 = default(BankOutlets);
         item2.copy(src3);
         this.bankOutlets.Add(item2);
     }
     this.m_FW = default(FW_stru);
     this.m_FW.copy(src.m_FW);
 }
Exemple #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);
 }
Exemple #3
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;
                }
            }
        }
Exemple #4
0
 private void getThresholds(ref DevModelConfig devinfo, XmlTextReader reader)
 {
     devinfo.devThresholds.ThresholdsFlg       = new System.Collections.Generic.List <ThresholdFlg>();
     devinfo.devThresholds.UIEditFlg           = new System.Collections.Generic.List <ThresholdFlg>();
     devinfo.devThresholds.currentThresholds   = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.voltageThresholds   = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.powerThresholds     = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.powerDissThresholds = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.tempThresholds      = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.HumiThresholds      = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.PressThresholds     = new System.Collections.Generic.List <stru_CommRange>();
     while (reader.Read())
     {
         XmlNodeType nodeType = reader.NodeType;
         if (nodeType != XmlNodeType.Element)
         {
             if (nodeType == XmlNodeType.EndElement)
             {
                 if (reader.Name.Equals("threshold"))
                 {
                     return;
                 }
             }
         }
         else
         {
             if (reader.Name.Equals("readVflag"))
             {
                 ThresholdFlg item = default(ThresholdFlg);
                 item.type = reader.GetAttribute("type");
                 item.flg  = System.Convert.ToInt32(reader.GetAttribute("flag"), 16);
                 devinfo.devThresholds.ThresholdsFlg.Add(item);
             }
             else
             {
                 if (reader.Name.Equals("UIeditflag"))
                 {
                     ThresholdFlg item2 = default(ThresholdFlg);
                     item2.type = reader.GetAttribute("type");
                     item2.flg  = System.Convert.ToInt32(reader.GetAttribute("flag"), 16);
                     devinfo.devThresholds.UIEditFlg.Add(item2);
                 }
                 else
                 {
                     if (reader.Name.Equals("current"))
                     {
                         stru_CommRange item3 = default(stru_CommRange);
                         item3.type  = reader.GetAttribute("type");
                         item3.id    = reader.GetAttribute("id");
                         item3.range = reader.GetAttribute("range");
                         devinfo.devThresholds.currentThresholds.Add(item3);
                     }
                     else
                     {
                         if (reader.Name.Equals("voltage"))
                         {
                             stru_CommRange item4 = default(stru_CommRange);
                             item4.type  = reader.GetAttribute("type");
                             item4.id    = reader.GetAttribute("id");
                             item4.range = reader.GetAttribute("range");
                             devinfo.devThresholds.voltageThresholds.Add(item4);
                         }
                         else
                         {
                             if (reader.Name.Equals("power"))
                             {
                                 stru_CommRange item5 = default(stru_CommRange);
                                 item5.type  = reader.GetAttribute("type");
                                 item5.id    = reader.GetAttribute("id");
                                 item5.range = reader.GetAttribute("range");
                                 devinfo.devThresholds.powerThresholds.Add(item5);
                             }
                             else
                             {
                                 if (reader.Name.Equals("powerDissipation"))
                                 {
                                     stru_CommRange item6 = default(stru_CommRange);
                                     item6.type  = reader.GetAttribute("type");
                                     item6.id    = reader.GetAttribute("id");
                                     item6.range = reader.GetAttribute("range");
                                     devinfo.devThresholds.powerDissThresholds.Add(item6);
                                 }
                                 else
                                 {
                                     if (reader.Name.Equals("temperature"))
                                     {
                                         stru_CommRange item7 = default(stru_CommRange);
                                         item7.type  = reader.GetAttribute("type");
                                         item7.id    = reader.GetAttribute("id");
                                         item7.range = reader.GetAttribute("range");
                                         devinfo.devThresholds.tempThresholds.Add(item7);
                                     }
                                     else
                                     {
                                         if (reader.Name.Equals("humidity"))
                                         {
                                             stru_CommRange item8 = default(stru_CommRange);
                                             item8.type  = reader.GetAttribute("type");
                                             item8.id    = reader.GetAttribute("id");
                                             item8.range = reader.GetAttribute("range");
                                             devinfo.devThresholds.HumiThresholds.Add(item8);
                                         }
                                         else
                                         {
                                             if (reader.Name.Equals("pressure"))
                                             {
                                                 stru_CommRange item9 = default(stru_CommRange);
                                                 item9.type  = reader.GetAttribute("type");
                                                 item9.id    = reader.GetAttribute("id");
                                                 item9.range = reader.GetAttribute("range");
                                                 devinfo.devThresholds.PressThresholds.Add(item9);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #5
0
 public void copy(stru_CommRange src)
 {
     this.type  = src.type;
     this.id    = src.id;
     this.range = src.range;
 }