internal GCodeConfig(Machines.Machine machine, Formatter formatter, double tolerance, TypedValue[] filter, Type[] availableTypes, string[] additionalArguments) { Machine = machine; Formatter = formatter; Tolerance = tolerance; AvailableTypes = availableTypes; Filter = filter; AdditionalArguments = new List <string>(additionalArguments); }
public static MachineStatus LoadFromConfig(XmlNode node, Machines.Machine machine) { try { MachineStatus status; XmlElement level1_item = (XmlElement)node; string strName = level1_item.GetAttribute("Name"); string strType = level1_item.GetAttribute("Type"); string strTag = level1_item.GetAttribute("Tag"); object defaultValue = null; if (level1_item.HasAttribute("DefaultValue")) { //参数有默认值 // 默认值只可以是整数或字符串类型 if (strType.ToLower() == "string") { defaultValue = level1_item.GetAttribute("DefaultValue"); } else if (strType.ToLower() == "int32") { defaultValue = Convert.ToInt32(level1_item.GetAttribute("DefaultValue")); } else { throw new Exception(string.Format("不支持机器状态{0}默认为此类型{1}", strName, strType)); } Tag tag = machine.GetTag(strTag); status = new MachineStatus(strName, strType, tag, defaultValue); } else {//参数无默认值 Tag tag = machine.GetTag(strTag); status = new MachineStatus(strName, strType, tag); } return(status); } catch (Exception ex) { LOG.Error(string.Format("从XML里装载参数失败:{0}", ex.Message)); return(null); } }
public MachinePerformance(Machines.Machine ownerMachine) { _owner = ownerMachine; }