Exemple #1
0
 public void Deserialize(Version documentVersion, XmlElement node)
 {
     BeginSide      = ST.GetEnumValue(node.GetAttribute("begin_side"), BeginSide);
     EndSide        = ST.GetEnumValue(node.GetAttribute("end_side"), EndSide);
     BeginRectangle = ST.GetRectangle(node.GetAttribute("begin_rect"), BeginRectangle);
     EndRectangle   = ST.GetRectangle(node.GetAttribute("end_rect"), EndRectangle);
 }
Exemple #2
0
        public override void Deserialize(Version documentVersion, System.Xml.XmlElement node)
        {
            base.Deserialize(documentVersion, node);

            Hyperlink = node.GetAttribute("hyperlink");
            Folded    = ST.GetBoolDefault(node.GetAttribute("folded"));

            //
            if (documentVersion >= Document.DV_3) // 新
            {
                CustomWidth  = ST.GetInt(node.GetAttribute("custom_width"));
                CustomHeight = ST.GetInt(node.GetAttribute("custom_height"));
            }
            else
            {
                CustomWidth  = ST.GetInt(node.GetAttribute("width"));
                CustomHeight = ST.GetInt(node.GetAttribute("height"));
            }

            TextBounds       = ST.GetRectangle(node.GetAttribute("text_b"), TextBounds);
            RemarkIconBounds = ST.GetRectangle(node.GetAttribute("remark_b"), RemarkIconBounds);
            FoldingButton    = ST.GetRectangle(node.GetAttribute("fold_btn_b"), FoldingButton);

            XmlElement styleNode = node.SelectSingleNode("style") as XmlElement;

            if (styleNode != null)
            {
                Style.Deserialize(documentVersion, styleNode);
            }

            //
            var linkNodes = node.SelectNodes("links/link");

            foreach (XmlElement linkNode in linkNodes)
            {
                Link link = new Link();
                link.Deserialize(documentVersion, linkNode);
                Links.Add(link);
            }

            //
            var widgetNodes = node.SelectNodes("widgets/widget");

            foreach (XmlElement widgetNode in widgetNodes)
            {
                var widget = Widget.DeserializeWidget(documentVersion, widgetNode);
                if (widget != null)
                {
                    Widgets.Add(widget);
                }
            }

            //
            XmlNodeList nodes = node.SelectNodes("nodes/node");

            foreach (XmlElement subNode in nodes)
            {
                Topic subTopic = new Topic();
                subTopic.Deserialize(documentVersion, subNode);
                Children.Add(subTopic);
            }

            //
            if (!Children.IsNullOrEmpty())
            {
                XmlNodeList lines = node.SelectNodes("lines/line");
                foreach (XmlElement lineNode in lines)
                {
                    var line = new TopicLine();
                    line.Deserialize(documentVersion, lineNode);

                    var targetID = lineNode.GetAttribute("target");
                    var target   = Children.Find(c => StringComparer.OrdinalIgnoreCase.Equals(c.ID, targetID));
                    if (target != null)
                    {
                        line.SetTarget(target);
                        Lines.Add(line);
                    }
                }
            }

            //
        }