Exemple #1
0
        public void parseSMNode(XmlNode smNode)
        {
            string strRoutineName = "parseSMNode";

            try
            {
                foreach (XmlNode node in smNode)       //We get 'IEC104'/'MODBUSSlave' slave map's
                {
                    if (!slaveExist(node))
                    {
                        continue;                     //Since slave entry is missing, we will ignore it's value in SlaveMapping...
                    }
                    if (node.Attributes != null)
                    {
                        XmlAttribute item    = node.Attributes[0];           //Get 'SlaveNum'
                        string       slaveID = node.Name + "_" + item.Value; //Ex. 'IEC104_1'
                        foreach (XmlNode mapNode in node)
                        {
                            if (mapNode.Name == "AIMap")
                            {
                                aicNode.parseAIMNode(item.Value, slaveID, mapNode);
                            }
                            else if (mapNode.Name == "AOMap")
                            {
                                aocNode.parseAIMNode(item.Value, slaveID, mapNode);
                            }
                            else if (mapNode.Name == "DIMap")
                            {
                                dicNode.parseDIMNode(item.Value, slaveID, mapNode);
                            }
                            else if (mapNode.Name == "DOMap")
                            {
                                docNode.parseDOMNode(item.Value, slaveID, mapNode);
                            }
                            else if (mapNode.Name == "ENMap")
                            {
                                encNode.parseENMNode(item.Value, slaveID, mapNode);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }