Esempio n. 1
0
        public override void Deserialize(Version documentVersion, XmlElement node)
        {
            base.Deserialize(documentVersion, node);

            if (node.HasAttribute("image_url"))
            {
                ImageUrl = node.GetAttribute("image_url");
            }
            SizeType     = ST.GetEnumValue(node.GetAttribute("size_type"), this.SizeType);
            OriginalSize = ST.GetValue(node.GetAttribute("original_size"), Size.Empty);

            if (ST.HasImageNode(node, "thumb"))
            {
                ThumbImage = ST.ReadImageNode(node, "thumb");
            }

            if (ST.HasImageNode(node))
            {
                Data = ST.ReadImageNode(node);
            }
            else if (ST.HasImageNode(node, "data"))
            {
                Data = ST.ReadImageNode(node, "data");
            }

            EmbedIn = ST.GetBool(node.GetAttribute("embed_in"), EmbedIn);
        }
Esempio n. 2
0
        public override void Deserialize(Version documentVersion, XmlElement node)
        {
            base.Deserialize(documentVersion, node);

            Maximum         = ST.GetInt(node.GetAttribute("max"), Maximum);
            Minimum         = ST.GetInt(node.GetAttribute("min"), Minimum);
            Value           = ST.GetFloat(node.GetAttribute("value"), Value);
            AutoCalculation = ST.GetBool(node.GetAttribute("auto_calculation"), AutoCalculation);
            //Visible = ST.GetBoolean(node.GetAttribute("visible"), Visible);
            ShowText  = ST.GetBool(node.GetAttribute("show_text"), ShowText);
            Color     = ST.GetColor(node.GetAttribute("color"), Color);
            BackColor = ST.GetColor(node.GetAttribute("back_color"), BackColor);
            ForeColor = ST.GetColor(node.GetAttribute("fore_color"), ForeColor);
        }
Esempio n. 3
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                string s = (string)value;
                bool?  b = ST.GetBool(s);
                if (b.HasValue)
                {
                    return(b.Value);
                }

                if (StringComparer.OrdinalIgnoreCase.Equals(s, Lang._("Yes")))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(base.ConvertFrom(context, culture, value));
        }
Esempio n. 4
0
        static Topic LoadNodes(XmlElement xmlNode)
        {
            if (xmlNode == null || xmlNode.Name != "node")
            {
                return(null);
            }

            // topic
            Topic topic = new Topic();

            topic.Text      = xmlNode.GetAttribute("TEXT");
            topic.ID        = xmlNode.GetAttribute("ID");
            topic.BackColor = ST.GetColor(xmlNode.GetAttribute("BACKGROUND_COLOR"), topic.BackColor);
            topic.ForeColor = ST.GetColor(xmlNode.GetAttribute("COLOR"), topic.BackColor);
            topic.Folded    = ST.GetBool(xmlNode.GetAttribute("FOLDED"), topic.Folded);
            topic.Padding   = new Padding(ST.GetInt(xmlNode.GetAttribute("HGAP"), 0),
                                          ST.GetInt(xmlNode.GetAttribute("VGAP"), 0),
                                          ST.GetInt(xmlNode.GetAttribute("HGAP"), 0),
                                          ST.GetInt(xmlNode.GetAttribute("VGAP"), 0));

            // font
            XmlElement node = xmlNode.SelectSingleNode("font") as XmlElement;

            if (node != null)
            {
                FontStyle fs = FontStyle.Regular;
                if (ST.GetBoolDefault(node.GetAttribute("BOLD")))
                {
                    fs |= FontStyle.Bold;
                }
                if (ST.GetBoolDefault(node.GetAttribute("ITALIC")))
                {
                    fs |= FontStyle.Italic;
                }
                topic.Font = new Font(node.GetAttribute("NAME"), ST.GetFloat(node.GetAttribute("SIZE"), 0), fs);
            }

            // note
            XmlElement noteNode = xmlNode.SelectSingleNode("richcontent[@TYPE='NOTE']") as XmlElement;

            if (noteNode != null)
            {
                topic.Remark = DeserializeRemark(noteNode);
            }

            // arrowlink
            XmlNodeList links = xmlNode.SelectNodes("arrowlink");

            foreach (XmlElement linkNode in links)
            {
                Link link = DeserializeLink(linkNode);
                topic.Links.Add(link);
            }

            // children
            XmlNodeList list = xmlNode.SelectNodes("node");

            foreach (XmlElement element in list)
            {
                Topic subTopic = LoadNodes(element);
                if (subTopic != null)
                {
                    topic.Children.Add(subTopic);
                }
            }

            return(topic);
        }