Beispiel #1
0
        public static void LoadXMLdata(ref MainClass.XMLDocData doc, ref EquipmentListHeadandFoot list)
        {
            EquipmentNode cur = list.Head;	//Assign Linked List Head
            EquipmentNode Next;				//Object to hold new EquipmentNode object
            foreach (XmlNode node in doc.XMLDoc.DocumentElement.SelectNodes("unit")) {

                //				Console.WriteLine (node.Name);

                Next = new EquipmentNode ();		//Create new Node object

                //Iterate through XML file and import data to Linked List
                if ((node) != null) {
                    cur.Next = Next;
                    cur = cur.Next;

                    cur.unit.ID = node.Attributes ["ID"].Value;
                    cur.unit.Type = node.Attributes ["Type"].Value;
                    cur.unit.Group = node.Attributes ["Group"].Value;
                    cur.unit.Contents = node.SelectSingleNode ("contents").InnerText;
                    cur.unit.Length = node.SelectSingleNode ("length").InnerText;
                    cur.unit.Width = node.SelectSingleNode ("width").InnerText;
                    cur.unit.Height = node.SelectSingleNode ("height").InnerText;
                    cur.unit.Weight = node.SelectSingleNode ("weight").InnerText;
                    cur.unit.Consumables = node.SelectSingleNode ("consumables").InnerText;
                    cur.unit.Companions = node.SelectSingleNode ("companions").InnerText;
                    cur.unit.Notes = node.SelectSingleNode ("notes").InnerText;
                    cur.unit.Shoplocation = node.SelectSingleNode ("shoplocation").InnerText;

                    list.Total++;
                }

            }
        }
Beispiel #2
0
 // Add a node to the linked list at the specified index
 public void XMLAdd(ref EquipmentListHeadandFoot list, ref EquipmentNode AddMe, int index)
 {
     EquipmentNode previous = NodeIterate (ref list, (index - 1));
     AddMe.Next = previous.Next;
     previous.Next = AddMe;
 }
Beispiel #3
0
 // Add a node to the end of the linked list
 public void XMLAppend(ref EquipmentListHeadandFoot list, EquipmentNode AddMe)
 {
     EquipmentNode last = NodeIterate (ref list, list.Total);
     last.Next = new EquipmentNode ();
     last.Next = AddMe;
 }
Beispiel #4
0
 public EquipmentListHeadandFoot()
 {
     myHead = new EquipmentNode ();
     myFoot = new EquipmentNode ();
     myFoot.Next = null;
     myFoot.unit = null;
     myHead.unit = null;
     myHead.Next = null;
     myTotal = 0;
 }