コード例 #1
0
        public Dictionary <string, ScrollerData> GetProjectList()
        {
            #if DEMO
            return(new Dictionary <string, ScrollerData>());
            #else
            Dictionary <string, ScrollerData> anouncements = new Dictionary <string, ScrollerData>();
            foreach (XmlNode xn in xd.DocumentElement.ChildNodes)
            {
                if (xn.Name == "Project")
                {
                    ScrollerData d = new ScrollerData();
                    d.name         = xn.Attributes["Name"].InnerText;
                    d.leftMessage  = xn["LeftMessage"].InnerText;
                    d.message      = xn["Message"].InnerText;
                    d.rightMessage = xn["RightMessage"].InnerText;

                    // Get font
                    if (xn["FontName"] == null)
                    {
                        d.font = new PresenterFont();
                        d.font.SizeInPoints = 12;
                    }
                    else
                    {
                        d.font = PresenterFont.FromXMLNode(xn);
                    }

                    anouncements.Add(d.name, d);
                }
            }
            return(anouncements);
            #endif
        }
コード例 #2
0
        public Dictionary <string, AnouncementData> GetAnouncements()
        {
            #if DEMO
            return(new Dictionary <string, AnouncementData>());
            #else
            Dictionary <string, AnouncementData> anouncements = new Dictionary <string, AnouncementData>();
            foreach (XmlNode xn in xd.DocumentElement.ChildNodes)
            {
                if (xn.Name == "Anouncement")
                {
                    AnouncementData d = new AnouncementData();
                    d.name    = xn.Attributes["Name"].InnerText;
                    d.imageId = int.Parse(xn["ImageId"].InnerText);
                    if (xn["Opacity"] != null)
                    {
                        d.opacity = int.Parse(xn["Opacity"].InnerText);
                    }

                    // Load all text regions
                    foreach (XmlNode xnc in xn.ChildNodes)
                    {
                        if (xnc.Name == "TextRegion")
                        {
                            GfxTextRegion textRegion = new GfxTextRegion();
                            string[]      parts      = xnc["Bounds"].InnerText.Split(",".ToCharArray());
                            if (parts.Length != 4)
                            {
                                continue;
                            }
                            textRegion.bounds  = new RectangleF(float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]), float.Parse(parts[3]));
                            textRegion.message = xnc["Message"].InnerText;
                            textRegion.font    = PresenterFont.FromXMLNode(xnc);

                            d.lTextRegions.Add(textRegion);
                        }
                    }

                    anouncements.Add(d.name, d);
                }
            }
            return(anouncements);
            #endif
        }