public void LoadFromXML(string pXmlString) { XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(pXmlString); XmlElement parent = xDoc.DocumentElement; XmlNodeList nodeList = parent.ChildNodes; foreach (XmlNode act in nodeList) { ActionSequence actionSeq = new ActionSequence(); ActionSequence preActionSeq = null; ushort bId = Convert.ToUInt16((act as XmlElement).GetAttribute("Id")); foreach (XmlNode list in act.ChildNodes) { ActionInfo actionInfo = new ActionInfo(); if (preActionSeq == null) { actionSeq.actionInfo = actionInfo; preActionSeq = actionSeq; } else { ActionSequence nextActionSeq = new ActionSequence(); preActionSeq.nextActionSequence = nextActionSeq; nextActionSeq.actionInfo = actionInfo; preActionSeq = nextActionSeq; } bool bIsFirst = true; foreach (XmlAttribute pEle in list.Attributes) { if (bIsFirst) { actionInfo.Id = Convert.ToUInt16(pEle.Value); bIsFirst = false; } else { ActionInfo nextActionInfo = new ActionInfo(); nextActionInfo.Id = Convert.ToUInt16(pEle.Value); actionInfo.nextActionInfo = nextActionInfo; actionInfo = nextActionInfo; } } } if (!ActionList.ContainsKey(bId)) { ActionList.Add(bId, actionSeq); } } }
public ActionSequence() { actionInfo = null; nextActionSequence = null; }