public List<Node[]> getNodeMatch(string type, List<int> directions, XmlDocument xmlDocument, List<Node> nodeList, List<string> names)
        {
            List<Node[]> NodeMatch = new List<Node[]>();
            XmlNodeList wayNodes = xmlDocument.SelectNodes("//" + type);
            int i = 0;
            directions.Clear();
            names.Clear();
            foreach (XmlNode xmlNode in wayNodes)
            {
                Node[] matches = new Node[2];
                int nodeX1 = int.Parse(xmlNode.Attributes["X1"].Value);
                int nodeX2 = int.Parse(xmlNode.Attributes["X2"].Value);
                int nodeY1 = int.Parse(xmlNode.Attributes["Y1"].Value);
                int nodeY2 = int.Parse(xmlNode.Attributes["Y2"].Value);
                int nodedir = int.Parse(xmlNode.Attributes["dir"].Value);
                string name = xmlNode.Attributes["name"].Value;
                Node firstNode = new Node(nodeX1, nodeY1);
                Node secondNode = new Node(nodeX2, nodeY2);
                if (!listContainsNode(nodeList, firstNode))
                {
                    nodeList.Add(firstNode);
                    matches[0] = firstNode;
                }
                else
                {
                    foreach (Node node in nodeList)
                    {
                        if (firstNode.Equals(node))
                            matches[0] = node;
                    }
                }
                if (!listContainsNode(nodeList, secondNode))
                {
                    nodeList.Add(secondNode);
                    matches[1] = secondNode;
                }
                else
                {
                    foreach (Node node in nodeList)
                    {
                        if (secondNode.Equals(node))
                            matches[1] = node;
                    }

                }
                if (matches.Count() == 2)
                {
                    NodeMatch.Add(matches);
                    directions.Add(nodedir);
                    names.Add(name);
                    i++;
                }
            }

            return NodeMatch;
        }