Exemple #1
0
        public static void FromXml(XElement xStyleList, IList <FillStyleRGBA> fillStyles, IList <LineStyleRGBA> lineStyles)
        {
            var xFillStyles = xStyleList.RequiredElement("fillStyles");

            foreach (var xFillStyle in xFillStyles.Elements())
            {
                var fillStyle = XFillStyle.FromXmlRGBA(xFillStyle);
                fillStyles.Add(fillStyle);
            }

            var xLineStyles = xStyleList.RequiredElement("lineStyles");

            foreach (var xLineStyle in xLineStyles.Elements())
            {
                var lineStyle = XLineStyleRGBA.FromXml(xLineStyle);
                lineStyles.Add(lineStyle);
            }
        }
Exemple #2
0
        public static XElement ToXml(IList <FillStyleRGBA> fillStyles, IList <LineStyleRGBA> lineStyles)
        {
            var xStyleList = new XElement("StyleList");

            var xFillStyles = new XElement("fillStyles");

            xStyleList.Add(xFillStyles);

            var xLineStyles = new XElement("lineStyles");

            xStyleList.Add(xLineStyles);

            foreach (var fillStyle in fillStyles)
            {
                xFillStyles.Add(XFillStyle.ToXml(fillStyle));
            }
            foreach (var lineStyle in lineStyles)
            {
                xLineStyles.Add(XLineStyleRGBA.ToXml(lineStyle));
            }

            return(xStyleList);
        }