///<summary> ///由基本属性、功能属性和功能属性个数来创建一个新的节点 ///用与内部使用 ///</summary> private XmlNode CreateNode(string[] BasicProperty, string[,] FunctionProperty, int ndex, string[] OtherPorperty) { XmlElement newFDToolBoxItem = CurrentDoc.CreateElement("FDToolBoxItem"); newFDToolBoxItem.SetAttribute("Type", "ControlTactic." + BasicProperty[7] + ",ControlTactic," + BasicProperty[2] + "," + BasicProperty[0]); //添加基本属性 XmlElement newBasicProperty = CurrentDoc.CreateElement("BasicProperty"); newFDToolBoxItem.AppendChild(newBasicProperty); if (BasicProperty[3] != "") //如果属性空则不创建此子节点 { XmlElement newModuleNameProperty = CurrentDoc.CreateElement("Property"); newModuleNameProperty.SetAttribute("name", "ModuleName"); newModuleNameProperty.InnerText = BasicProperty[3]; newBasicProperty.AppendChild(newModuleNameProperty); } if (BasicProperty[4] != "") { XmlElement newTextColorProperty = CurrentDoc.CreateElement("Property"); newTextColorProperty.SetAttribute("name", "TextColor"); newTextColorProperty.InnerText = BasicProperty[4]; newBasicProperty.AppendChild(newTextColorProperty); } if (BasicProperty[5] != "") { XmlElement newOutputNameProperty = CurrentDoc.CreateElement("Property"); newOutputNameProperty.SetAttribute("name", "OutputName"); newOutputNameProperty.InnerText = BasicProperty[5]; newBasicProperty.AppendChild(newOutputNameProperty); } if (BasicProperty[6] != "") { XmlElement newInputNameProperty = CurrentDoc.CreateElement("Property"); newInputNameProperty.SetAttribute("name", "InputName"); if (BasicProperty[6].Split(';').Length > 1) { string[] tempArray = BasicProperty[6].Split(';'); foreach (string InputInfo in tempArray) { string[] info = InputInfo.Split(','); XmlElement InputNode = CurrentDoc.CreateElement("InputValue"); InputNode.SetAttribute("name", info[0]); InputNode.InnerText = info[1]; newInputNameProperty.AppendChild(InputNode); } } else { newInputNameProperty.InnerText = BasicProperty[6]; } newBasicProperty.AppendChild(newInputNameProperty); } //模块颜色和模块类型是必加的节点属性 XmlElement newModuleColorProperty = CurrentDoc.CreateElement("Property"); newModuleColorProperty.SetAttribute("name", "ModuleColor"); newModuleColorProperty.InnerText = BasicProperty[1]; newBasicProperty.AppendChild(newModuleColorProperty); XmlElement newModuleSortProperty = CurrentDoc.CreateElement("Property"); newModuleSortProperty.SetAttribute("name", "ModuleSort"); newModuleSortProperty.InnerText = BasicProperty[2]; newBasicProperty.AppendChild(newModuleSortProperty); //添加功能属性 XmlElement newFunctionProperty = CurrentDoc.CreateElement("FunctionProperty"); newFDToolBoxItem.AppendChild(newFunctionProperty); for (int i = 0; i < ndex; i++) { XmlElement newProperty = CurrentDoc.CreateElement("Property"); newProperty.SetAttribute("name", FunctionProperty[i, 0]); newProperty.SetAttribute("varname", FunctionProperty[i, 1]); newProperty.SetAttribute("type", FunctionProperty[i, 2]); newProperty.SetAttribute("visible", FunctionProperty[i, 4]); newProperty.SetAttribute("exp", FunctionProperty[i, 5]); newProperty.SetAttribute("optype", FunctionProperty[i, 6]); newProperty.SetAttribute("opvalue", FunctionProperty[i, 7]); newProperty.SetAttribute("opnode", FunctionProperty[i, 8]); newProperty.SetAttribute("relate", FunctionProperty[i, 9]); newProperty.InnerText = FunctionProperty[i, 3]; newFunctionProperty.AppendChild(newProperty); } //添加其他属性 XmlElement newInfoPorperty = CurrentDoc.CreateElement("OtherInfo"); XmlElement newCodeinfo = CurrentDoc.CreateElement("Property"); newCodeinfo.SetAttribute("name", "CodeInfo"); newCodeinfo.InnerText = OtherPorperty[0]; XmlElement Description = CurrentDoc.CreateElement("Property"); Description.SetAttribute("name", "Description"); Description.InnerText = OtherPorperty[1]; XmlElement OptimizeInfo = CurrentDoc.CreateElement("Property"); OptimizeInfo.SetAttribute("name", "OptimizeInfo"); OptimizeInfo.InnerText = OtherPorperty[2]; newInfoPorperty.AppendChild(newCodeinfo); newInfoPorperty.AppendChild(Description); newInfoPorperty.AppendChild(OptimizeInfo); newFDToolBoxItem.AppendChild(newInfoPorperty); return(newFDToolBoxItem); }