示例#1
0
 // Iterate throigh entire linked list and print list to console
 private static void PrintList(ref EquipmentListHeadandFoot list)
 {
     EquipmentNode cur = list.Head;
     int i = 0;
     while (i < list.Total) {
     //			while(cur != list.Foot){
         cur = cur.Next;
         Console.Write (cur.unit.Group+", ");
         Console.Write (cur.unit.ID);
     //				Console.Write (cur.unit.Contents);
         Console.WriteLine();
         i++;
     }
 }
示例#2
0
        public static void Main(string[] args)
        {
            XMLDocData KnoxArray = new XMLDocData();
            EquipmentListHeadandFoot KnoxArrayEquipment = new EquipmentListHeadandFoot ();
            KnoxArray.path = "/Users/ethandahlke/Projects/ProductionOrganization/ProductionOrganization/Equipment.xml";
            LoadXMLdoc (ref KnoxArray);
            XML.LoadXMLdata (ref KnoxArray, ref KnoxArrayEquipment);
            PrintList (ref KnoxArrayEquipment);
            XML.XMLSave (ref KnoxArray.XMLDoc);

            //			xmldoc.Load ("../Projects/ProductionOrganization/ProductionOrganization/Equipment.xml");
            //			xmldoc.Load("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml");
            //			Console.WriteLine (xmldoc.DocumentElement.SelectSingleNode("weight").InnerText);
        }
示例#3
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++;
                }

            }
        }
示例#4
0
 // Iterate through linked list to index and return the node
 private static EquipmentNode NodeIterate(ref EquipmentListHeadandFoot list, int index)
 {
     EquipmentNode cur = list.Head.Next;
     int i;
     for (i=0; i<index; i++) {
         cur = cur.Next;
     }
     return cur;
 }
示例#5
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;
 }
示例#6
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;
 }