public Tbl_Npc_Record(XmlElement _element)// : base(_element) { try{ XmlNode node = (XmlElement)_element; SetValue(ref m_Id, node, "ID"); SetValue(ref m_iNpcNameId, node, "NpcName"); SetValue(ref m_iNpcGNameId, node, "NpcGName"); SetValue<eNPCType>(ref m_NpcType, node, "NpcType"); SetValue(ref m_SpawnCheck, node, "SpawnCheck"); SetValue(ref m_SpawnTimeMin, node, "SpawnTime_Min"); SetValue(ref m_SpawnTimeMax, node, "SpawnTime_Max"); SetValue( ref m_LineIndex, node, "ChatBalloonIndex"); SetValue(ref m_ModelingPath, node, "ModelingPath"); SetValue(ref m_NpcIcon, node, "NpcIcon"); SetValue(ref m_fScale, node, "Scale"); SetValue(ref m_fPointScale, node, "PointScale"); SetValue(ref m_fCollisionRadius, node, "CollisionRadius"); SetValue(ref m_UseCheck, node, "UseCheck"); SetValue(ref m_fOrgSize, node, "OrgSize"); SetValue(ref m_RegenString, node, "RegenString"); SetValue(ref m_strNickColor, node, "NickColor"); SetValue(ref m_warpIndex, node, "WarpIndex"); m_fCollisionRadius = m_fCollisionRadius/ 100.0f; } catch(System.Exception e) { Debug.LogError(e); } }
public Tbl_PetLevel_Record(XmlElement _element) { try{ XmlNode node = (XmlElement)_element; SetAttribute(ref m_StarGrade, node, "StarGrade"); XmlNodeList nodes = node.ChildNodes; foreach(XmlNode node1 in nodes) { int lv = 1; int exp = 0; int passive = 0; int active = 0; int special = 0; SetAttribute(ref lv, node1, "Level"); SetAttribute(ref exp, node1, "Exp"); SetAttribute(ref passive, node1, "PassiveSkillLv"); SetAttribute(ref active, node1, "ActiveSkillLv"); SetAttribute(ref special, node1, "SpecialSkillLv"); m_listData.Add(lv, new PetLevelData(lv, exp, passive, active, special)); } } catch(System.Exception e) { Debug.LogError(e); } }
public Tbl_InsQuestGroup_Record(XmlElement _element) { try{ XmlNode node = (XmlElement)_element; m_Ins_QuestGroup_ID = int.Parse(node["Ins_QuestGroup_ID"].InnerText); m_Ins_Quest_ID = int.Parse(node["Ins_Quest_ID"].InnerText); m_Ins_Group_Rate = int.Parse(node["Ins_Group_Rate"].InnerText); m_Monster_Kind_ID1 = int.Parse(node["Monster_Kind_ID1"].InnerText); m_Monster1_Kill_Count = int.Parse(node["Monster1_Kill_Count"].InnerText); m_Monster_Kind_ID2 = int.Parse(node["Monster_Kind_ID2"].InnerText); m_Monster2_Kill_Count = int.Parse(node["Monster2_Kill_Count"].InnerText); m_Monster_Kind_ID3 = int.Parse(node["Monster_Kind_ID3"].InnerText); m_Monster3_Kill_Count = int.Parse(node["Monster3_Kill_Count"].InnerText); m_Exp_Reward = int.Parse(node["Exp_Reward"].InnerText); m_Gold_Reward = int.Parse(node["Gold_Reward"].InnerText); m_Knight_Reward = int.Parse(node["Knight_Reward"].InnerText); m_Knight_Reward_Count = int.Parse(node["Knight_Reward_Count"].InnerText); m_Magician_Reward = int.Parse(node["Magician_Reward"].InnerText); m_Magician_Reward_Count = int.Parse(node["Magician_Reward_Count"].InnerText); m_Cleric_Reward = int.Parse(node["Cleric_Reward"].InnerText); m_Cleric_Reward_Count = int.Parse(node["Cleric_Reward_Count"].InnerText); m_Hunter_Reward = int.Parse(node["Hunter_Reward"].InnerText); m_Hunter_Reward_Count = int.Parse(node["Hunter_Reward_Count"].InnerText); } catch(System.Exception e) { Debug.LogError("[Tbl_InsQuestGroup_Record] 'constructor': |" + e + "| error while parsing"); } }
public Conversation(XmlElement element, LineCatalogue catalogue) { persistentConversation = new PersistentConversation(); persistentConversation.name = element.GetAttribute("name"); if(SaveLoad.SaveExits()) { PersistentConversation tmp = (PersistentConversation)SaveLoad.ReadSaveFile(PersistentConversation.GetSaveFileName(persistentConversation.name)); if(tmp != null) { persistentConversation = tmp; } else { SaveLoad.ResetSave(); } } //Debug.Log("Conversation.Conversation() name=" + persistentConversation.name ); participants = new ArrayList(); XmlNodeList participantNodeList = element.GetElementsByTagName("participant"); foreach (XmlElement participantElement in participantNodeList){ string participantName = participantElement.GetAttribute("name"); participants.Add(CharacterManager.GetCharacter(participantName)); } XmlElement rootLineElement = (XmlElement)element.GetElementsByTagName("root_line").Item(0); rootLine = new RootLine(rootLineElement, catalogue, this); rootLine.ConnectLinks(catalogue); currentController = null; }
// Constructor public CssStylesheet(XmlElement htmlElement) { if (htmlElement != null) { this.DiscoverStyleDefinitions(htmlElement); } }
public Tbl_Lottery_Record(XmlElement _element) { System.Text.StringBuilder sbTemp = new System.Text.StringBuilder(); try { XmlNode node = (XmlElement)_element; SetValue( ref Index, node, "Index" ); SetValue( ref m_NeedEffect, node, "Eff_type" ); for( int i=1; i<=10; ++i ) { int _iIndex = 0; sbTemp.Length = 0; sbTemp.Append( "Rand_ID" ); sbTemp.Append( i ); SetValue( ref _iIndex, node, sbTemp.ToString() ); if( 0 != _iIndex && int.MaxValue != _iIndex ) { idlist.Add( _iIndex ); } else break; } } catch(System.Exception e) { Debug.LogError("[Tbl_Lottery_Record] 'constructor': |" + e.ToString() + "| error while parsing"); } }
//! initializes from passed-in xml element, in format <someelement x="..." y="..." z="..." s="..."/> public Rot( XmlElement xmlelement ) { x = Convert.ToDouble( xmlelement.GetAttribute( "x" ) ); y = Convert.ToDouble( xmlelement.GetAttribute( "y" ) ); z = Convert.ToDouble( xmlelement.GetAttribute( "z" ) ); s = Convert.ToDouble( xmlelement.GetAttribute( "s" ) ); }
public override void ParseElement(XmlElement element) { string tmpArgVal = ""; tmpArgVal = element.GetAttribute("type"); if (!string.IsNullOrEmpty(tmpArgVal)) { if (tmpArgVal.Equals("none")) transition.setType(Transition.TYPE_NONE); else if (tmpArgVal.Equals("fadein")) transition.setType(Transition.TYPE_FADEIN); else if (tmpArgVal.Equals("vertical")) transition.setType(Transition.TYPE_VERTICAL); else if (tmpArgVal.Equals("horizontal")) transition.setType(Transition.TYPE_HORIZONTAL); } tmpArgVal = element.GetAttribute("time"); if (!string.IsNullOrEmpty(tmpArgVal)) { transition.setTime(long.Parse(tmpArgVal)); } animation.getTransitions().Add(transition); }
/// <summary> /// cycle for normal items /// </summary> /// <param name="g"></param> /// <param name="importingElemList"></param> private void checkAppearanceFieldList(XmlElement g, List<ImportingElement> importingElemList) { XmlNodeList groupElements = g.ChildNodes; Debug.WriteLine("Found " + groupElements.Count + " elements in this group"); for (int j = 0; j < groupElements.Count; j++) { if (groupElements.Item(j).Name == "input") { Debug.WriteLine("Found an input node"); XmlElement node = (XmlElement)groupElements.Item(j); ImportingElement importingElem = checkAttributesRefInput(node); importingElemList.Add(importingElem); } if (groupElements.Item(j).Name == "select") { Debug.WriteLine("Found a select node"); XmlElement node = (XmlElement)groupElements.Item(j); ImportingElement importingElem = checkAttributesRefSelect(node); importingElemList.Add(importingElem); } if (groupElements.Item(j).Name == "select1") { Debug.WriteLine("Found a select1 node"); XmlElement node = (XmlElement)groupElements.Item(j); ImportingElement importingElem = checkAttributesRefSelect1(node); if (importingElem.typeAttribute != "currency") importingElemList.Add(importingElem); } } }
public Tbl_Promotion_Record( XmlElement _element) { try { XmlNode node = (XmlElement)_element; SetValue( ref m_Index, node, "Index"); SetValue( ref m_Priority, node, "Priority"); SetValue<Def_Promotion.eCondition>( ref m_Condition, node, "Condition"); SetValue<eCLASS>( ref m_Class, node, "Class"); SetValue( ref m_Level_Min, node, "Level_Min"); SetValue( ref m_Level_Max, node, "Level_Max"); SetValue( ref m_Item_Index, node, "Item_Index"); SetValue( ref m_String_Index, node, "String_Index"); SetValue<eCashStoreMenuMode>( ref m_Miracle_Page, node, "Miracle_Page"); SetValue( ref m_PromotionTime, node, "PromotionTime"); SetValue( ref m_Probability, node, "Probability"); SetValue( ref m_SubCategory, node, "Sub_Category"); } catch( System.Exception e) { Debug.LogError( e); } }
public void Test() { XmlElement xmlElement = new XmlElement("TestXml"); XmlElement xmlElement1 = new XmlElement("ChlidElement1"); xmlElement1.AddAttribute(new XmlAttribute("test", "12")); XmlElement addElement = xmlElement.AddElement(xmlElement1); string innerXml = xmlElement.InnerXml; string outterXml = xmlElement.OutterXml; XmlElement xmlElements = xmlElement.ChlidElements["ChlidElement1"][0]; XmlElement element = xmlElement.Find(x => Equals(x.ElementName, "ChlidElement1")); // element = xmlElement.Find(@"\XML\@aa"); XmlAttribute xmlAttributes = xmlElement1.Attributes["test"]; XmlAttribute xmlAttribute = new XmlAttribute("name", "lsong"); xmlElement.AddAttribute(xmlAttribute); XmlDocument xmlDocument = new XmlDocument(xmlElement); xmlDocument.SetRootElement(xmlElement); xmlDocument.SetVersion(new Version(1, 0, 0, 0)); xmlDocument.Encoding = System.Text.Encoding.UTF8; xmlDocument.Save("c:\\temp.xml"); xmlDocument.Load("c:\\temp.xml"); //xmlDocument.LoadXml("<xml />"); XmlElement rootElement = xmlDocument.RootElement; }
public Tbl_EntityTemplate_Record(XmlElement _element)// : base(_element) { try{ XmlNode nodes = (XmlElement)_element; m_EntityType = nodes.Attributes["Type"].Value; foreach(XmlNode node in nodes) { if(node.Name == "Component") { m_listComponent.Add(node.Attributes["Name"].Value); } if(node.Name == "AsProperty") { AsProperty prop = new AsProperty(); prop.name_ = node.Attributes["Name"].Value; prop.varType_ = node.Attributes["VarType"].Value; prop.default_ = node.Attributes["Default"].Value; m_listProperty.Add(prop); } } } catch(System.Exception e) { Debug.LogError("[Tbl_EntityTemplate_Record] 'constructor':|" + e + "| error while parsing"); } }
public void SerializeElement(XmlElement parent, IUnitTestElement element) { parent.SetAttribute("type", element.GetType().Name); var writableUnitTestElement = (ISerializableUnitTestElement)element; writableUnitTestElement.WriteToXml(parent); }
public static void GenerateXml() { Debug.Log("Processing.."); enXml = new XmlDocument(); ruXml = new XmlDocument(); XmlUtil.xmlId = 0; string enXmlPath = String.Format(@"{0}\{1}", Application.dataPath, "data_en.xml"); string ruXmlPath = String.Format(@"{0}\{1}", Application.dataPath, "data_ru.xml"); if(File.Exists(enXmlPath)) { enXml.Load(enXmlPath); ruXml.Load(ruXmlPath); XmlUtil.ruRootNode = (XmlElement)ruXml.FirstChild; XmlUtil.enRootNode = (XmlElement)enXml.FirstChild; } else { XmlUtil.enRootNode = (XmlElement)enXml.AppendChild(enXml.CreateElement("document")); XmlUtil.ruRootNode = (XmlElement)ruXml.AppendChild(ruXml.CreateElement("document")); } string startSearchPath = Application.dataPath; XmlUtil.GetAssets(startSearchPath); ///--- путь к ассетам XmlUtil.enXml.Save("data_en.xml"); XmlUtil.ruXml.Save("data_ru.xml"); }
public Tbl_UserLevel_Record(XmlElement _element)// : base(_element) { try{ XmlNode node = (XmlElement)_element; SetValue(ref m_Index, node, "Index"); SetValue<eCLASS>(ref m_Class, node, "Class"); SetValue(ref m_Level, node, "Level"); SetValue(ref m_TotalEXP, node, "TotalEXP"); SetValue(ref m_HPMax, node, "HPMax"); SetValue(ref m_MPMax, node, "MPMax"); SetValue(ref m_PhysicalAttack_Min, node, "PhysicalAttack_Min"); SetValue(ref m_PhysicalAttack_Max, node, "PhysicalAttack_Max"); SetValue(ref m_PhysicalDefense, node, "PhysicalDefense"); SetValue(ref m_MagicalAttack_Min, node, "MagicalAttack_Min"); SetValue(ref m_MagicalAttack_Max, node, "MagicalAttack_Max"); SetValue(ref m_MagicalResist, node, "MagicalResist"); SetValue(ref m_Resurrection_Cost, node, "Resurrection_Cost"); SetValue(ref m_Lv_Bonus, node, "Lv_Bonus"); SetValue(ref m_Lv_BonusCount, node, "Lv_BonusCount"); } catch(System.Exception e) { Debug.LogError(e); } }
public Tbl_Pet_Record(XmlElement _element) { try{ XmlNode node = (XmlElement)_element; SetValue(ref m_Index, node, "PetID"); SetValue(ref m_Name, node, "Name"); SetValue(ref m_Desc, node, "Desc"); SetValue(ref m_StarGrade, node, "StarGrade"); SetValue(ref m_PersonGroupID, node, "PersonGroupID"); SetValue(ref m_PassiveGroupID, node, "PassiveGroupID"); SetValue(ref m_ActiveGroupID, node, "ActiveGroupID"); SetValue(ref m_SpecialGroupID, node, "SpecialGroupID"); SetValue(ref m_UpgradeID, node, "UpgradeID"); SetValue(ref m_Class, node, "Class"); SetValue(ref m_Icon, node, "Icon"); SetValue(ref m_Model, node, "Model"); } catch(System.Exception e) { Debug.LogError(e); } }
public Tbl_ChargeRecord(XmlElement _element) { try { XmlNode node = (XmlElement)_element; foreach (XmlNode attribute in node.Attributes) { if (attribute.Name == "ProductID") itemID = attribute.Value; else if (attribute.Name == "Type") { if (attribute.Value == "SPHERE") chargeType = eCHARGETYPE.eCHARGETYPE_MIRACLE; else if (attribute.Value == "DAILY") chargeType = eCHARGETYPE.eCHARGETYPE_DAILY; else chargeType = eCHARGETYPE.eCHARGETYPE_NOTHING; } else if (attribute.Name == "DescriptionID") descriptionID = int.Parse(attribute.Value); else if (attribute.Name == "Icon") iconPath = attribute.Value; else if (attribute.Name == "UseTime") useTime = attribute.Value == "NONE" ? 0 : int.Parse(attribute.Value); } } catch (System.Exception e) { Debug.LogError(e); } }
private string readStringFromAttribute(XmlElement element, String attribute) { if(element.HasAttribute(attribute)) { return element.Attributes[attribute].Value; } return null; }
protected void Page_Load(object sender, EventArgs e) { string xmlPath = Graphite.Tools.GetXmlPath(""); string xmlFile = ""; if (xmlPath.IndexOf("/demos") == 0) { xmlFile = "demos.xml"; } else { xmlFile = "pages.xml"; } //litBreadcrumb.Text = Graphite.Tools.GetXmlPath(""); xmlDocument = new System.Xml.XmlDocument(); xmlDocument.Load(HttpContext.Current.Server.MapPath(@"~\App_Data\Graphite\Internal\Sitemaps\" + xmlFile)); xmlPath = xmlPath.Replace("default.aspx", ""); xmlPath = xmlPath.Substring(0, xmlPath.Length - 1); //Response.Write(xmlPath); xmlElement = xmlDocument.SelectSingleNode(xmlPath) as XmlElement; StringBuilder sbBreadCrumb = new StringBuilder(); XmlNode xmlNode = xmlElement as XmlNode; int nodeLevel = 0; while (xmlNode.Name != "#document") { sbBreadCrumb.AppendLine(getLink(xmlNode, nodeLevel)); xmlNode = xmlNode.ParentNode as XmlNode; nodeLevel++; } sbBreadCrumb.AppendLine(" ‹ <a href='/'>Start page</a>"); litBreadcrumb.Text = sbBreadCrumb.ToString(); }
public Tbl_Production_Record(XmlElement _element) { try { XmlNode node = (XmlElement)_element; SetValue(ref m_iIndex, node, "Index"); SetValue<eITEM_PRODUCT_TECHNIQUE_TYPE>(ref m_type, node, "Production_Technic"); SetValue(ref m_iLevel, node, "Production_Level"); SetValue(ref m_iItemID, node, "Production_Item_ID1"); SetValue(ref m_iItemCount, node, "Production_Item_Count1"); SetValue(ref itemTime, node, "Production_Item_Time"); itemTime *= 0.001f; SetValue(ref iExpertism , node, "Production_Item_Expertism"); SetValue(ref iExp , node, "Production_Item_EXP"); SetValue(ref iGold , node, "Production_Item_Gold"); SetValue(ref iBaseID , node, "Production_Item_Base"); SetValue(ref iBaseCount , node, "Production_Item_BaseCount"); SetValue(ref iSubID_1 , node, "Production_Item_Sub"); SetValue(ref iSubCount_1 , node, "Production_Item_SubCount"); SetValue(ref iSubID_2 , node, "Production_Item_Sub2"); SetValue(ref iSubCount_2 , node, "Production_Item_Sub2Count"); SetValue(ref iOpID , node, "Production_Item_Op"); SetValue(ref iOpCount , node, "Production_Item_OpCount"); SetValue(ref miracle, node, "Production_Item_Miracle"); } catch(System.Exception e) { Debug.LogError(e); } }
/// <summary> /// 从 body 字符串中解析,成功返回 true,否则 false /// </summary> /// <param name="str">body字符串</param> /// <param name="command">出参,对应 command 属性</param> /// <param name="cmd_node">出参,对应整个 cmd 节点</param> /// <param name="mcu_jid">出参,mcu jid</param> /// <param name="mcu_cid">出参,mcu cid</param> /// <returns></returns> public static bool parse(string str, out string command, out XmlElement cmd_node, out string mcu_jid, out int mcu_cid) { command = null; cmd_node = null; mcu_cid = 0; mcu_jid = null; try { XmlDocument doc = new XmlDocument(); doc.LoadXml(str); XmlElement node_zonekey = doc.DocumentElement; if (node_zonekey.Name == "zonekey") { XmlNode node_app = node_zonekey.Attributes.GetNamedItem("app"); if (node_app != null && node_app.NodeType == XmlNodeType.Attribute && ((XmlAttribute)node_app).Value == "record_livingcast_service") { // 找到 cmd 节点,和 mcu 节点 XmlNodeList cmds = doc.SelectNodes("/zonekey/cmd"); XmlNodeList mcus = doc.SelectNodes("/zonekey/mcu"); if (cmds.Count >= 1 && mcus.Count >= 1) { cmd_node = (XmlElement)cmds[0]; XmlElement mcu_node = (XmlElement)mcus[0]; XmlNode attr_command = cmd_node.Attributes.GetNamedItem("command"); if (attr_command != null) { command = attr_command.Value; int state = 0; foreach (XmlNode cn in mcu_node.ChildNodes) { if (cn.Name == "jid") { mcu_jid = cn.InnerText; state |= 1; } else if (cn.Name == "cid") { mcu_cid = int.Parse(cn.InnerText); state |= 2; } } return state == 3; // 拥有 mcu_jid, mcu_cid } } } } return false; } catch { return false; } }
public MonsterLineData( XmlElement _element) { try { XmlNode node = (XmlElement)_element; SetValue( ref groupIndex, node, "Index"); SetValue( ref eType, node, "BallonCondition"); SetValue( ref conditionValue, node, "BallonValue"); SetValue( ref probability, node, "BallonProb"); SetValue( ref lineIndex1, node, "BallonString1"); SetValue( ref lineIndex2, node, "BallonString2"); SetValue( ref lineIndex3, node, "BallonString3"); if( int.MaxValue == lineIndex2) lineIndex2 = lineIndex1; if( int.MaxValue == lineIndex3) lineIndex3 = lineIndex1; } catch( System.Exception e) { Debug.LogError(e); } }
public AsCharacterCreateGenderData( XmlElement _element) { XmlNode node = (XmlElement)_element; // <Type> SetValue( ref gender, node, "Type"); // <Property> XmlNode propertyNode = node[ "Property"]; // <HairType> XmlNode hairTypeNode = propertyNode[ "HairType"]; XmlNodeList hairTypeList = hairTypeNode.ChildNodes; foreach( XmlNode hairType in hairTypeList) { // <Type> int hairId = int.MaxValue; SetValue( ref hairId, hairType); hairTypes.Add( hairId); } // <HairColor> XmlNode hairColorNode = propertyNode[ "HairColor"]; XmlNodeList hairColorList = hairColorNode.ChildNodes; foreach( XmlNode hairColor in hairColorList) { // <Color> int colorId = int.MaxValue; SetValue( ref colorId, hairColor); hairColors.Add( colorId); } // <BodyColor> XmlNode bodyColorNode = propertyNode[ "BodyColor"]; XmlNodeList bodyColorList = bodyColorNode.ChildNodes; foreach( XmlNode bodyColor in bodyColorList) { // <Color> int colorId = int.MaxValue; SetValue( ref colorId, bodyColor); bodyColors.Add( colorId); } // <PointColor> XmlNode pointColorNode = propertyNode[ "PointColor"]; XmlNodeList pointColorList = pointColorNode.ChildNodes; foreach( XmlNode pointColor in pointColorList) { // <Color> int colorId = int.MaxValue; SetValue( ref colorId, pointColor); pointColors.Add( colorId); } // <GloveColor> XmlNode gloveColorNode = propertyNode[ "GloveColor"]; XmlNodeList gloveColorList = gloveColorNode.ChildNodes; foreach( XmlNode gloveColor in gloveColorList) { // <Color> int colorId = int.MaxValue; SetValue( ref colorId, gloveColor); gloveColors.Add( colorId); } }
public Tbl_SetItem_Record(XmlElement _element) { try { XmlNode node = (XmlElement)_element; SetValue( ref m_Index, node, "Set_ID" ); SetValue( ref m_iNameID, node, "Set_Name_ID" ); SetValue( ref m_iSkillID, node, "Set_Skill_ID" ); System.Text.StringBuilder sbTemp = new System.Text.StringBuilder(); for( int i=0; i<12; ++i ) { sbTemp.Length=0; sbTemp.Append( "Set_Item" ); sbTemp.Append( i+1 ); sbTemp.Append( "_Name_ID" ); SetValue( ref m_iItemNameIDList[i], node, sbTemp.ToString() ); m_iItemIDList[i] = new List<int>(); for( int k=0;k<3;++k ) { int _itemId = 0; sbTemp.Length=0; sbTemp.Append( "Set_Item" ); sbTemp.Append( i+1 ); sbTemp.Append( "-" ); sbTemp.Append( k+1 ); sbTemp.Append( "_ID" ); SetValue( ref _itemId, node, sbTemp.ToString() ); if( 0 == _itemId || int.MaxValue == _itemId ) continue; m_iItemIDList[i].Add( _itemId ); } } m_setApplys[0] = new CSetApply(); SetValue( ref m_setApplys[0].iApply, node, "Set_Apply1" ); SetValue( ref m_setApplys[0].iStringID, node, "Set_Apply1_String" ); m_setApplys[1] = new CSetApply(); SetValue( ref m_setApplys[1].iApply, node, "Set_Apply2" ); SetValue( ref m_setApplys[1].iStringID, node, "Set_Apply2_String" ); m_setApplys[2] = new CSetApply(); SetValue( ref m_setApplys[2].iApply, node, "Set_Apply3" ); SetValue( ref m_setApplys[2].iStringID, node, "Set_Apply3_String" ); } catch(System.Exception e) { Debug.LogError("[Tbl_SetItem_Record] 'constructor': |" + e + "| error while parsing"); } }
public void AppendSpriteTranslation(XmlElement parent) { Vector3 spritePosition = GetSpriteTranslation(); AppendXmlElement("x","" + spritePosition.x, parent); AppendXmlElement("y","" + spritePosition.y, parent); AppendXmlElement("depth","" + spritePosition.z, parent); }
public BasicContent(XmlElement message) : base(message) { this._raw_content = message; this._content = new Hashtable(); this._type = MessageContent.Type.Unknown; this.DisassembleContent(); }
// Dictionary<eSKILL_INPUT_TYPE , int > m_dicSkillInputType = new Dictionary<eSKILL_INPUT_TYPE, int>(); public Tbl_Class_Record(XmlElement _element)// : base(_element) { try{ XmlNode node = (XmlElement)_element; SetValue(ref m_Index, node, "Index"); SetValue<eRACE>(ref m_RaceId, node, "Race"); SetValue<eCLASS>(ref m_Class, node, "Class"); // SetValue<eGENDER>(ref m_Gender, node, "Gender"); SetValue(ref m_ModelingPath_Male, node, "ModelingPath_Male"); SetValue(ref m_ModelingPath_Female, node, "ModelingPath_Female"); SetValue(ref m_Portrait_Male, node, "ChatImage_Male"); SetValue(ref m_Portrait_Female, node, "ChatImage_Female"); SetValue(ref m_JobIcon, node, "JobIcon"); SetValue<eATTACK_TYPE>(ref m_AttackType, node, "AttackType"); SetValue(ref m_JobStep, node, "JobStep"); SetValue(ref m_BaseJob, node, "BaseJob"); // SetValue(ref m_ParentJob, node, "ParentJob"); SetValue(ref m_HpRecovery, node, "HPRecovery"); SetValue(ref m_MpRecovery, node, "MPRecovery"); SetValue(ref m_HpRecoveryBattle, node, "HPRecoveryBattle"); SetValue(ref m_MpRecoveryBattle, node, "MPRecoveryBattle"); SetValue(ref m_MoveSpeed, node, "MoveSpeed"); if(m_MoveSpeed == 0f || m_MoveSpeed == float.MaxValue) Debug.LogError("Tbl_Class_Record::constructor: m_MoveSpeed = " + m_MoveSpeed); SetValue(ref m_ViewDistance, node, "ViewDistance"); SetValue(ref m_AccuracyRatio, node, "AccuracyRatio"); SetValue(ref m_DodgeRatio, node, "DodgeRatio"); SetValue(ref m_AttackSpeedRatio, node, "AttackSpeedRatio"); SetValue(ref m_BaseAttackCycle, node, "BaseAttackCycle"); SetValue(ref m_CriticalRatio, node, "CriticalRatio"); #if false SetValue(ref m_FireAttack, node, "FireAttack"); SetValue(ref m_IceAttack, node, "IceAttack"); SetValue(ref m_LightAttack, node, "LightAttack"); SetValue(ref m_DarkAttack, node, "DarkAttack"); SetValue(ref m_NatureAttack, node, "NatureAttack"); SetValue(ref m_FireResist, node, "FireResist"); SetValue(ref m_IceResist, node, "IceResist"); SetValue(ref m_LightResist, node, "LightResist"); SetValue(ref m_DarkResist, node, "DarkResist"); SetValue(ref m_NatureResist, node, "NatureResist"); #endif } catch(System.Exception e) { Debug.LogError(e); } }
void PrintGeography (XmlElement currentNode, Geography geo, int level) { BasicGeographyDesignation[] officialdesignations = geo.GetGeographyDesignations(); XmlElement thisNode = currentNode; if (officialdesignations.Length == 0) { thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY"); } else if (officialdesignations[0].GeographyLevel == GeographyLevel.Municipality) { thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY"); } else if (officialdesignations[0].GeographyLevel == GeographyLevel.ElectoralCircuit) { thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY"); } if (thisNode != currentNode) { currentNode.AppendChild(thisNode); RoleLookup officers = RoleLookup.FromGeographyAndOrganization(geo.Identity, 1); thisNode.SetAttribute("name", geo.Name); thisNode.SetAttribute("hierlevel", level.ToString()); thisNode.SetAttribute("geographyid", geo.Identity.ToString()); if (officialdesignations.Length > 0) { thisNode.SetAttribute("level", ((int)officialdesignations[0].GeographyLevel).ToString()); if (valkretsbyte.ContainsKey(officialdesignations[0].Designation)) thisNode.SetAttribute("key", valkretsbyte[officialdesignations[0].Designation]); } if (officers[RoleType.LocalLead].Count > 0) { foreach (PersonRole r in officers[RoleType.LocalLead]) { GeneratePerson(thisNode, RoleType.LocalLead, r.Person); } } if (officers[RoleType.LocalDeputy].Count > 0) { foreach (PersonRole r in officers[RoleType.LocalDeputy]) { GeneratePerson(thisNode, RoleType.LocalDeputy, r.Person); } } } foreach (Geography subGeo in geo.Children) { PrintGeography(thisNode, subGeo, level+1); } }
public override void DumpContent(XmlDocument document, XmlElement element) { XmlElement elm = document.CreateElement("Response"); XmlAttribute attr = document.CreateAttribute("type"); attr.Value = this._rtype; elm.Attributes.Append(attr); base.DumpContent(document, elm); element.AppendChild(elm); }
public AsCharacterCreateItem( XmlElement _element) { XmlNode node = (XmlElement)_element; // <Id> SetValue( ref id, node, "Id"); // <Count> SetValue( ref count, node, "Count"); }
private static void DoParseAttributes( StudyLoaderArgs studyLoaderArgs, ParseResult result, string metaUri, XmlElement elem) { var collection = result.Attributes; collection.ValidateVrValues = false; collection.ValidateVrLengths = false; foreach (var node in elem) { var attrElem = node as XmlElement; if (attrElem == null) { continue; } if (!attrElem.Name.Equals("attr")) { continue; } var dcmTag = GetTagFromAttrElement(attrElem); DicomAttribute attr = collection[dcmTag]; DicomAttributeSQ sq = attr as DicomAttributeSQ; if (sq != null) { sq.ClearSequenceItems(); foreach (XmlNode itemNode in attrElem) { var itemElem = itemNode as XmlElement; if (itemElem != null) { if (itemElem.Name.Equals("item")) { var subResult = new ParseResult(); var subSequence = new DicomSequenceItem(); subResult.Attributes = subSequence; DoParseAttributes(studyLoaderArgs, subResult, metaUri, itemElem); sq.AddSequenceItem(subSequence); } } } } else { string val = null; if (attrElem.Attributes["val"] != null) { val = attrElem.Attributes["val"].Value; attr.SetStringValue(val); } else if (attrElem.Attributes["bid"] != null) { // TODO: This tag's value is binary. We're not interested in binary items other // than the pixel data so we ignore them -- they will be added to the // sequence but they will not have any value set. if (attr.Tag.TagValue == DicomTags.PixelData) { result.PixelDataBid = attrElem.Attributes["bid"].Value; } } else if (attrElem.Attributes["bytes"] != null) { // TODO: This tag's value is binary. We're not interested in binary items other // than the pixel data so we ignore them -- they will be added to the // sequence but they will not have any value set. ; } else if (attrElem.Attributes["bsize"] != null) { // TODO: Bulk binary loading can use this. } else { Platform.Log(LogLevel.Warn, "Attr element {0} missing ", attr.Tag, val); } } } }
/* * public int GetNumPointMasses() {return pointMassLoc.Count;} * public Vector3D GetPointMassLoc(int i) {return (Vector3D)pointMassLoc[i];} * public double GetPointMassWeight(int i) {return (double)pointMassWeight[i];} */ public void Load(XmlElement element) { double bixx, biyy, bizz, bixy, bixz, biyz; bixx = biyy = bizz = bixy = bixz = biyz = 0.0; foreach (XmlNode currentNode in element.ChildNodes) { if (currentNode.NodeType == XmlNodeType.Element) { XmlElement currentElement = (XmlElement)currentNode; if (currentElement.LocalName.Equals("ixx")) { bixx = FormatHelper.ValueAsNumberConvertTo(currentElement, "SLUG*FT2"); } else if (currentElement.LocalName.Equals("iyy")) { biyy = FormatHelper.ValueAsNumberConvertTo(currentElement, "SLUG*FT2"); } else if (currentElement.LocalName.Equals("izz")) { bizz = FormatHelper.ValueAsNumberConvertTo(currentElement, "SLUG*FT2"); } else if (currentElement.LocalName.Equals("ixy")) { bixy = FormatHelper.ValueAsNumberConvertTo(currentElement, "SLUG*FT2"); } else if (currentElement.LocalName.Equals("ixz")) { bixz = FormatHelper.ValueAsNumberConvertTo(currentElement, "SLUG*FT2"); } else if (currentElement.LocalName.Equals("iyz")) { biyz = FormatHelper.ValueAsNumberConvertTo(currentElement, "SLUG*FT2"); } else if (currentElement.LocalName.Equals("emptywt")) { emptyWeight = FormatHelper.ValueAsNumberConvertTo(currentElement, "LBS"); } else if (currentElement.LocalName.Equals("location")) { // Find all LOCATION elements that descend from this METRICS branch of the // config file. This would be CG location, eyepoint, etc. string element_name = currentElement.GetAttribute("name"); if (element_name.Equals("CG")) { vbaseXYZcg = FormatHelper.TripletConvertTo(currentElement, "IN"); } } else if (currentElement.LocalName.Equals("pointmass")) { // Find all POINTMASS elements that descend from this METRICS branch of the // config file. AddPointMass(currentElement); } } } SetAircraftBaseInertias(new Matrix3D(bixx, -bixy, -bixz, -bixy, biyy, -biyz, -bixz, -biyz, bizz)); }
[ExcludeFromCodeCoverage] // Just a wrapper o keep backward compatibility public Saml2Response(XmlElement xml, Saml2Id expectedInResponseTo) : this(xml, expectedInResponseTo, null) { }
public object Load(XmlElement element, object obj) { return(ProcessNode(element, obj)); }
/// <summary> /// 创建节点 /// </summary> /// <param name="xmlModel"></param> public void CreateNode(List <XmlModel> list) { foreach (XmlModel xmlModel in list) { string strFindNode = GetAttributeValue(xmlModel.AttributeValue); XmlNode node; //属性类 if (xmlModel.IsAttribute) { node = _xmlDoc.SelectSingleNode(xmlModel.NodePath); if (node != null) { SetAttribute((XmlElement)node, xmlModel.AttributeValue); } else { xmlModel.Message = "失败:节点" + xmlModel.NodePath + "不存在!"; } } else { node = _xmlDoc.SelectSingleNode(xmlModel.NodePath + strFindNode); if (node == null) { int index = xmlModel.NodePath.LastIndexOf("/"); string nodeName = xmlModel.NodePath.Remove(0, index + 1); string parentPath = xmlModel.NodePath.Remove(index); XmlElement xmlElement = _xmlDoc.CreateElement(nodeName); SetAttribute(xmlElement, xmlModel.AttributeValue); XmlNode parentNode = _xmlDoc.SelectSingleNode(parentPath); if (parentNode != null) { parentNode.AppendChild(xmlElement); } else { xmlModel.Message = "失败:父节点" + parentPath + "不存在!"; } } } } if (list != null && list.Count > 0) { //查询list中Message不为空的XmlModel XmlModel xmlModel = list.FirstOrDefault(x => !string.IsNullOrEmpty(x.Message)); if (xmlModel == null) { _xmlDoc.Save(_xmlPath); Console.WriteLine("配置成功!"); } else { Console.WriteLine("配置失败!"); Console.WriteLine(xmlModel.Message); } Console.ReadLine(); } }