Пример #1
0
    private void ConfigureBus(XElement busElement, XElement nodeElement)
    {
      if (busElement == null)
        throw new NodeConfigurationException("bus section not found");

      var ports = new List<Port>();

      foreach (var xport in busElement.Element("ports").Elements())
      {
        var port = (Port)GetConfiguredObject(xport);
        if (port != null)
          ports.Add(port);
        else
        {
          Log.Warn(string.Format("port {0} failed configuration", xport));
        }
      }


      var address = nodeElement != null && nodeElement.Element("address") != null ? Address.Parse(Convert.ToUInt32(nodeElement.Element("address").Value)) : Address.Empty;
      Bus = new BusController(address, ports.ToArray());

      Log.Debug(string.Format("Configured bus of type {0}", Bus.GetType().Name));
    }