private IAmpCProvider CreateSigleAmpCObject(XmlNode node, HardwareType hw) { if (node == null) { return(null); } XmlNode item = node.SelectSingleNode(hw.ToString()); if (item == null) { return(null); } if (hwLib.ContainsKey(hw) && hwLib[hw] is IAmpCProvider) { return((IAmpCProvider)hwLib[hw]); } try { XmlAttribute attr = item.Attributes["Type"]; Type type = Type.GetType(attr.Value, false);//反射获取对象类型 IAmpCProvider provider = Activator.CreateInstance(type) as IAmpCProvider; if (provider != null) { int dev = 0; XmlNode n = item.SelectSingleNode("Params"); int.TryParse(n.Attributes["Driver"].Value, out dev); provider.DevIndex = dev; int.TryParse(n.Attributes["Index"].Value, out dev); provider.AmpCIndex = dev; provider.Param = Serialize.XmlDeSerialize(n) as AxisParams; hwLib.Add(hw, provider); } return(provider); } catch (Exception ex) { LogHelper.WriteDebugException(ex); return(null); } }