//public XmlNode exportXMLnode() //{ // XmlDocument xmlDoc = new XmlDocument(); // StringWriter stringWriter = new StringWriter(); // XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); // XmlNode rootNode = null; // if (isNodeComment) // { // rootNode = xmlDoc.CreateComment(comment); // xmlDoc.AppendChild(rootNode); // return rootNode; // } // rootNode = xmlDoc.CreateElement(ennType.ToString()); // xmlDoc.AppendChild(rootNode); // foreach (string attr in arrAttributes) // { // XmlAttribute attrName = xmlDoc.CreateAttribute(attr); // attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this); // rootNode.Attributes.Append(attrName); // } // return rootNode; //} public XmlNode exportXMLnode() { XmlDocument xmlDoc = new XmlDocument(); StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); XmlNode rootNode = null; if (isNodeComment) { rootNode = xmlDoc.CreateComment(comment); xmlDoc.AppendChild(rootNode); return(rootNode); } rootNode = xmlDoc.CreateElement(ennType.ToString()); #region MasterType IEC61850 if (masterType == MasterTypes.IEC61850Client) { foreach (string attr in arrAttributes) { XmlAttribute attrName = xmlDoc.CreateAttribute(attr); attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this); rootNode.Attributes.Append(attrName); } XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType"); attr1.Value = Iec61850ResponseType.ToString(); rootNode.Attributes.Append(attr1); XmlAttribute attr2 = xmlDoc.CreateAttribute("Index"); attr2.Value = Iec61850Index.ToString(); rootNode.Attributes.Append(attr2); XmlAttribute attFC = xmlDoc.CreateAttribute("FC"); attFC.Value = FC.ToString(); rootNode.Attributes.Append(attFC); XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex"); attr3.Value = SubIndex.ToString(); rootNode.Attributes.Append(attr3); //XmlAttribute attr4 = xmlDoc.CreateAttribute("DataType"); //attr4.Value = DataType.ToString(); //rootNode.Attributes.Append(attr4); XmlAttribute attr5 = xmlDoc.CreateAttribute("Multiplier"); attr5.Value = Multiplier.ToString(); rootNode.Attributes.Append(attr5); XmlAttribute attr6 = xmlDoc.CreateAttribute("Constant"); attr6.Value = Constant.ToString(); rootNode.Attributes.Append(attr6); XmlAttribute attr7 = xmlDoc.CreateAttribute("Description"); attr7.Value = Description.ToString(); rootNode.Attributes.Append(attr7); } #endregion MasterType IEC61850 #region MasterType IEC103,ADR,IEC101,MODBUS,Virtual if ((masterType == MasterTypes.IEC103) || (masterType == MasterTypes.ADR) || (masterType == MasterTypes.IEC101) || (masterType == MasterTypes.MODBUS) || (masterType == MasterTypes.Virtual)) { foreach (string attr in arrAttributes) { XmlAttribute attrName = xmlDoc.CreateAttribute(attr); attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this); rootNode.Attributes.Append(attrName); } } #endregion MasterType IEC103,ADR,IEC101,MODBUS,Virtual return(rootNode); }
void OnGui() { if (info == true) { GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 200, 80), "Name: " + sname); GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 200, 80), "Type: " + Type.ToString()); // switch(Type) // { // case enType.Armor: // GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, +30, 200, 80), "Protection: " + Protection); // break; // case enType.Weapon: // GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 30, 200, 80), "Damage: " + Damage); // break; // case enType.Food: // GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 30, 200, 80), "Regeneratinn: " + Regen); // break; // case enType.Amulet: // GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 30, 200, 80), "Agility++: " + Agility); // break; //} } }