Ejemplo n.º 1
0
        public Preferences(string sData)
        {
            XmlDocument cXmlDocument = new XmlDocument();

            cXmlDocument.LoadXml(sData);
            XmlNode cXmlNode = cXmlDocument.NodeGet("data");

            XmlNode cNodeChild = cXmlNode.NodeGet("playlist");

            _stMerging   = new MergingMethod(cNodeChild);
            _nLayer      = cNodeChild.AttributeGet <ushort>("layer");
            _nPlaylistID = cNodeChild.AttributeGet <long>("id");
            cNodeChild   = cNodeChild.NodeGet("area");
            _stArea      = new Area(
                cNodeChild.AttributeGet <short>("left"),
                cNodeChild.AttributeGet <short>("top"),
                cNodeChild.AttributeGet <ushort>("width"),
                cNodeChild.AttributeGet <ushort>("height")
                );
            _cDBCredentials = new DB.Credentials(cXmlNode.NodeGet("database"));
        }
Ejemplo n.º 2
0
        public Preferences(string sWorkFolder, string sData)
        {
            _sWorkFolder = sWorkFolder;

            XmlDocument cXmlDocument = new XmlDocument();

            cXmlDocument.LoadXml(sData);
            XmlNode cXmlNode = cXmlDocument.NodeGet("data");

            cDBCredentials = new DB.Credentials(cXmlNode.NodeGet("database"));

            bMessagesRelease = cXmlNode.AttributeOrDefaultGet <bool>("release", false);
            eBroadcastType   = cXmlNode.AttributeOrDefaultGet <BroadcastType>("type", BroadcastType.linear);
            nSMSQtty         = cXmlNode.AttributeGet <int>("queue");
            bAnotherAirError = cXmlNode.AttributeOrDefaultGet <bool>("another_air_err", false);

            XmlNode cNodeChild = cXmlNode.NodeGet("vip");

            if (null != cNodeChild)
            {
                cVIP = new VIP();
                XmlNode cXNPromos = cNodeChild.NodeGet("promos", false);
                if (null != cXNPromos)
                {
                    cVIP.tsPromoPeriod = cXNPromos.AttributeGet <TimeSpan>("period");
                    cVIP.aPromos       = new List <Promo>();
                    List <Promo>       aPromos = new List <Promo>();
                    List <WeeklyRange> aWeeklyRanges;
                    foreach (XmlNode cPromo in cXNPromos.NodesGet("promo", false))
                    {
                        aWeeklyRanges = new List <WeeklyRange>();
                        foreach (XmlNode cWeeklyRange in cPromo.NodesGet("weeklyrange", false))
                        {
                            aWeeklyRanges.Add(new WeeklyRange(
                                                  cWeeklyRange.AttributeValueGet("dayin"),
                                                  cWeeklyRange.AttributeValueGet("timein"),
                                                  cWeeklyRange.AttributeValueGet("dayout"),
                                                  cWeeklyRange.AttributeValueGet("timeout")
                                                  ));
                        }
                        aPromos.Add(new Promo()
                        {
                            nID          = cPromo.InnerXml.GetHashCode(),
                            aWeeklyRange = aWeeklyRanges,
                            bEnabled     = cPromo.AttributeGet <bool>("enabled"),
                            sText        = cPromo.NodeGet("text").InnerXml
                        });
                    }
                    cVIP.aPromos.AddRange(aPromos);
                }
                cVIP.sFile   = System.IO.Path.Combine(_sWorkFolder, "data/vip.dat");
                cVIP.sPrefix = "VIP";
                cVIP.cFont   = FontParse(cNodeChild.NodeGet("font"));
            }
            #region . ROLL .
            cNodeChild           = cXmlNode.NodeGet("roll");
            cRoll                = new Roll();
            cRoll.nLayer         = cNodeChild.AttributeGet <ushort>("layer");
            cRoll.nSpeed         = cNodeChild.AttributeGet <float>("speed");
            cRoll.nUseHistorySMS = cNodeChild.AttributeOrDefaultGet <int>("use_history", 0); // 0 is off
            string sEx = cNodeChild.AttributeOrDefaultGet <string>("exceptions", "");        // 0 is off
            cRoll.cExceptions = new Roll.HoursExceptions(sEx);
            cRoll.stMerging   = new MergingMethod(cNodeChild);
            XmlNode cXNGrandChild = cNodeChild.NodeGet("holds");
            cRoll.SecondsPerLineSet(cXNGrandChild.AttributeGet <float>("line"));
            cRoll.nSecondsPerPause = cXNGrandChild.AttributeGet <float>("pause");
            cXNGrandChild          = cNodeChild.NodeGet("masks");
            cRoll.sMaskPageSingle  = cXNGrandChild.NodeGet("single").InnerXml;
            cRoll.sMaskPageMulti   = cXNGrandChild.NodeGet("multi").InnerXml;
            cRoll.stSize           = SizeParse(cNodeChild.NodeGet("size"));

            cRoll.cSMSCommon = RollCategoryGet(cNodeChild.NodeGet("common"));
            cRoll.cSMSVIP    = RollCategoryGet(cNodeChild.NodeGet("vip"));
            cRoll.cSMSPromo  = RollCategoryGet(cNodeChild.NodeGet("promo"));
            cRoll.cSMSPhoto  = RollCategoryGet(cNodeChild.NodeGet("photo"));
            #endregion
            #region . CRAWL .
            cNodeChild = cXmlNode.NodeGet("crawl");
            cCrawl     = new Crawl();
            cCrawl.sInfoStringNight = System.IO.Path.Combine(sWorkFolder, "data/info_night.dat");
            cCrawl.sCrowlLastStart  = System.IO.Path.Combine(sWorkFolder, "data/crowl_last_start.dat");;
            cCrawl.stMerging        = new MergingMethod(cNodeChild);
            cCrawl.nSpeed           = cNodeChild.AttributeGet <float>("speed");
            cCrawl.nLayer           = cNodeChild.AttributeGet <ushort>("layer");
            cCrawl.nShiftTop        = cXmlNode.AttributeOrDefaultGet <short>("shift_top", 0);
            cCrawl.nPressBottom     = cXmlNode.AttributeOrDefaultGet <short>("press_bot", 0);
            cCrawl.bRenderFields    = cXmlNode.AttributeOrDefaultGet <bool>("render_fields", false);
            cCrawl.stSize           = SizeParse(cNodeChild.NodeGet("size"));
            cCrawl.sText            = cNodeChild.NodeGet("text").InnerXml;
            cCrawl.sRegistryInfo    = cNodeChild.NodeGet("registration").InnerXml;

            cCrawl.cFont         = FontParse(cNodeChild = cNodeChild.NodeGet("font"));
            cCrawl.stColor       = ColorParse(cNodeChild.NodeGet("color"));
            cNodeChild           = cNodeChild.NodeGet("border");
            cCrawl.nBorderWidth  = cNodeChild.AttributeGet <float>("width");
            cCrawl.stBorderColor = ColorParse(cNodeChild.NodeGet("color", false));
            #endregion
            #region . ANIMATION .
            cNodeChild       = cXmlNode.NodeGet("mat");
            cMat             = new Mat();
            cXNGrandChild    = cNodeChild.NodeGet("badge");
            cMat.nBadgeLayer = cXNGrandChild.AttributeGet <ushort>("layer");
            cMat.stBadgeSize = SizeParse(cXNGrandChild.NodeGet("size"));
            cMat.sBadgeIn    = cXNGrandChild.NodeGet("in").InnerXml;
            cMat.sBadgeLoop  = cXNGrandChild.NodeGet("loop").InnerXml;
            cMat.sBadgeOut   = cXNGrandChild.NodeGet("out").InnerXml;

            cXNGrandChild        = cNodeChild.NodeGet("show");
            cMat.nShowLayer      = cXNGrandChild.AttributeGet <ushort>("layer");
            cMat.stShowSize      = SizeParse(cXNGrandChild.NodeGet("size"));
            cMat.sShowLoop       = cXNGrandChild.NodeGet("loop").InnerXml;
            cMat.sShowOut        = cXNGrandChild.NodeGet("out").InnerXml;
            cMat.sShowTransition = cXNGrandChild.NodeGet("transition").InnerXml;

            cXNGrandChild           = cXNGrandChild.NodeGet("standby");
            cMat.sStandbyIn         = cXNGrandChild.NodeGet("in").InnerXml;
            cMat.sStandbyLoop       = cXNGrandChild.NodeGet("loop").InnerXml;
            cMat.sStandbyOut        = cXNGrandChild.NodeGet("out").InnerXml;
            cMat.sStandbyTransition = cXNGrandChild.NodeGet("transition").InnerXml;

            cXNGrandChild  = cNodeChild.NodeGet("out");
            cMat.nOutLayer = cXNGrandChild.AttributeGet <ushort>("layer");
            cMat.stOutSize = SizeParse(cXNGrandChild.NodeGet("size"));
            cMat.sOut      = cXNGrandChild.NodeGet("animation").InnerXml;
            #endregion
        }