Example #1
0
        private static void ParseColorToXml(XmlDocument xml, AreaTextures area, XmlNode root)
        {

            if (area == null) return;


            var thisNode = xml.CreateNode(XmlNodeType.Element, "Brush", xml.NamespaceURI);
            var Attribute = xml.CreateAttribute("Id");
            Attribute.Value = String.Format("{0:0000}", area.Index);
            thisNode.Attributes.Append(Attribute);

            Attribute = xml.CreateAttribute("Name");
            Attribute.Value = area.Name;
            thisNode.Attributes.Append(Attribute);


            foreach (var textureId in area.List)
            {
                var landNode = xml.CreateNode(XmlNodeType.Element, "Land", xml.NamespaceURI);
                Attribute = xml.CreateAttribute("ID");
                Attribute.Value = "0x" + textureId.ToString("X4");
                landNode.Attributes.Append(Attribute);
                thisNode.AppendChild(landNode);
            }

            foreach (var transition in area.AreaTransitionTexture.List)
            {
                var edgenode = xml.CreateNode(XmlNodeType.Element, "Edge", xml.NamespaceURI);
                Attribute = xml.CreateAttribute("To");
                Attribute.Value = String.Format("{0:0000}", transition.TextureIdTo);
                edgenode.Attributes.Append(Attribute);

                InsertEdgesToXml(xml, "DR", edgenode, transition.BorderSouthEast.List);
                InsertEdgesToXml(xml, "DL", edgenode, transition.BorderSouthWest.List);
                InsertEdgesToXml(xml, "UL", edgenode, transition.BorderNorthWest.List);
                InsertEdgesToXml(xml, "UR", edgenode, transition.BorderNorthEast.List);

                InsertEdgesToXml(xml, "LL", edgenode, transition.LineWest.List);
                InsertEdgesToXml(xml, "UU", edgenode, transition.LineNorth.List);

                thisNode.AppendChild(edgenode);
            }


            root.AppendChild(thisNode);
        }
Example #2
0
        private void ReParseColorToXml(XmlDocument xml, AreaTextures area)
        {

            if (area == null) return;

            foreach (var transition in area.AreaTransitionTexture.List)
            {
                var xpathquery = "//Brush[@Id=" + "'" + String.Format("{0:0000}", transition.TextureIdTo) + "'" + "]";
                var node = xml.SelectSingleNode(xpathquery);
                if (node == null) continue;
                var edgenode = xml.CreateNode(XmlNodeType.Element, "Edge", xml.NamespaceURI);
                var Attribute = xml.CreateAttribute("To");
                Attribute.Value = String.Format("{0:0000}", area.Index);
                edgenode.Attributes.Append(Attribute);
                
                InsertEdgesToXml(xml, "DR", edgenode, transition.EdgeNorthWest.List);
                InsertEdgesToXml(xml, "DL", edgenode, transition.EdgeNorthEast.List);
                InsertEdgesToXml(xml, "UL", edgenode, transition.EdgeSouthEast.List);
                InsertEdgesToXml(xml, "UR", edgenode, transition.EdgeSouthWest.List);

                InsertEdgesToXml(xml, "LL", edgenode, transition.LineEast.List);
                InsertEdgesToXml(xml, "UU", edgenode, transition.LineSouth.List);

                node.AppendChild(edgenode);
            }


        }
Example #3
0
        private void CommandAreaTextureAddExecuted()
        {
            try
            {
                var areatexture = new AreaTextures();
                areatexture.PropertyChanged += (s,e) => RaisePropertyChanged(null);
            CollectionAreaTexture.List.Add(areatexture);

                RaisePropertyChanged(null);
            }
            catch (Exception e)
            {
                AppMessages.DialogRequest.Send(new MessageDialogRequest(e.Message));
            }
           
        }