public static ComponentDescriptor[] GetComponentDescriptors(XElement componentElement) { List <ComponentDescriptor> descriptors = new List <ComponentDescriptor>(); var componentsList = componentElement.Element(componentElement.Name.Namespace + NodeNames.Components); if (componentsList != null) { foreach (var compNode in componentsList.Elements()) { var cd = new ComponentDescriptor(compNode.Name.LocalName, PropertyCollection.FromAttributes(compNode.Attributes())); descriptors.Add(cd); } } return(descriptors.ToArray()); }
public static PropertyCollection[] GetComponentDataItems(XElement componentElement) { var itemsNode = componentElement.Element(componentElement.Name.Namespace + NodeNames.DataItems); if (itemsNode == null) { return(null); } List <PropertyCollection> propsList = new List <PropertyCollection>(); foreach (var item in itemsNode.Elements(componentElement.Name.Namespace + NodeNames.DataItem)) { propsList.Add(PropertyCollection.FromAttributes(item.Attributes())); } return(propsList.ToArray()); }
public static ComponentDescription GetComponentDescription(XElement componentElement) { var descriptionNode = componentElement.Element(componentElement.Name.Namespace + NodeNames.Description); if (descriptionNode == null) { return(null); } ComponentDescription desc = new ComponentDescription(); var attributes = PropertyCollection.FromAttributes(descriptionNode.Attributes()); desc.SerialNumber = attributes["serialNumber"]; desc.Manufacturer = attributes["manufacturer"]; desc.Station = attributes["station"]; desc.Description = descriptionNode.Value; return(desc); }
public static PropertyCollection GetDeviceProperties(XElement deviceElement) { var pc = PropertyCollection.FromAttributes(deviceElement.Attributes()); return(pc); }