Ejemplo n.º 1
0
        void InitializeValues(NodeBase nb)
        {
            if (nb.isLeaf() && (nb is NodeData && !(nb is NodeDO)))
            {
                NodeData nd = nb as NodeData;
                if (nd.SCLServerModelObject != null)
                {
                    // Initial value exist (from SCL file)
                    DataAttribute da = (DataAttribute)nd.SCLServerModelObject;
                    if (nd.DataValue != null)
                    {
                        da.UpdateValue(server, nd.DataValue);
                    }
                    nd.DataType = (scsm_MMS_TypeEnum)da.GetMmsValueType();
                    logger.LogDebug("InitializeValues: " + nd.IecAddress + ", Type: " + nd.DataType.ToString());
                }

                /*else
                 * {
                 *  NodeBase arr = nd.findArray();
                 *  if (arr != null)
                 *  {
                 *      if (arr is NodeData)
                 *      {
                 *          // Array in Attribute
                 *          DataAttribute da = (DataAttribute)arr.SCLServerModelObject;
                 *      }
                 *      else
                 *      {
                 *          // Array in DataObject
                 *      }
                 *  }
                 * }*/
            }
            else
            {
                foreach (NodeBase child in nb.GetChildNodes())
                {
                    // Recursion
                    InitializeValues(child);
                }
            }
        }