예제 #1
0
        public void Prepare()
        {
            try
            {
                DisCom.Init();

                _cRoll = new btl.Roll();
                _cRoll.eDirection = _cPreferences.eDirection;
                _cRoll.nSpeed = _cPreferences.nSpeed;
                _cRoll.stArea = _cPreferences.stArea;
                _cRoll.bCUDA = _cPreferences.bRollCuda;
                _cRoll.nLayer = _cPreferences.nLayer;
                _cRoll.bOpacity = false;
                _cRoll.Prepare();

                _aItems = new List<Item>();
                _cTimerRequest = new System.Threading.Timer(TickRequest);
                TickRequest(null);
				_cRollFeed = new Thread(RollFeed);
				_cRollFeed.IsBackground = true;
				_cRollFeed.Start();

                if (null != Prepared)
                    Plugin.EventSend(Prepared, this);
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
예제 #2
0
        public Preferences(string sData)
        {
            try
            {
                XmlDocument cXmlDocument = new XmlDocument();
                cXmlDocument.LoadXml(sData);
                XmlNode cXmlNode  = cXmlDocument.NodeGet("data");
                XmlNode cNodeRoll = cXmlNode.NodeGet("roll");

                _nRollPrerenderQueueMax = cNodeRoll.AttributeOrDefaultGet <int>("prerender_queue", 40);

                RollNode cRN = new RollNode(cNodeRoll);
                if (null != cRN.aTextItems.FirstOrDefault(o => o.nDuration < nRollPrerenderQueueMax * 2))
                {
                    throw new Exception("duration of any text must be > " + nRollPrerenderQueueMax * 2);
                }
                _aTextItems = cRN.aTextItems;
                _cPlaylist  = new Playlist(cRN.cNodePL);
                _cRoll      = new btl.Roll(cNodeRoll);
            }
            catch (Exception ex)
            {
                (new Logger()).WriteDebug("Preferences error: [error=" + ex.ToString() + "][source_xml=" + sData + "]");
                throw;
            }
        }
예제 #3
0
        public Preferences(string sData)
        {
            XmlDocument cXmlDocument = new XmlDocument();

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

            DataXML cSourceData = new DataXML(cXmlNode);

            _aWeatherItems = Data.WeatherItem.LoadItems(cSourceData.cYandexData);
            if (_aWeatherItems.Count < 2)
            {
                throw new Exception("There are must be more than 1 weather items. Add some other cities");
            }

            _cRoll = new Roll(cXmlNode.NodeGet("roll"));

            _ahItems = Item.DictionaryGet(cXmlNode);
        }
예제 #4
0
        public Preferences(string sData)
        {
            try
            {
                XmlDocument cXmlDocument = new XmlDocument();
                cXmlDocument.LoadXml(sData);
                XmlNode cXmlNode  = cXmlDocument.NodeGet("data");
                XmlNode cNodeRoll = cXmlNode.NodeGet("roll");

                RollNode cRN = new RollNode(cNodeRoll);
                cRN.MakeNodeRollFitInSize();

                _cRoll = new btl.Roll(cNodeRoll);
            }
            catch (Exception ex)
            {
                (new Logger()).WriteDebug("Preferences error: [error=" + ex.ToString() + "][source_xml=" + sData + "]");
                throw;
            }
        }
예제 #5
0
        public Preferences(string sData)
        {
            try
            {
                XmlDocument cXmlDocument = new XmlDocument();
                cXmlDocument.LoadXml(sData);
                XmlNode cXmlNode = cXmlDocument.NodeGet("data");
                _sRequest    = cXmlNode.AttributeOrDefaultGet <string>("request", "polls.zed");
                _nTemplate   = cXmlNode.AttributeOrDefaultGet <byte>("template", 0);
                _sWorkFolder = cXmlNode.AttributeGet <string>("work_folder");
                if (!System.IO.Directory.Exists(_sWorkFolder))
                {
                    throw new Exception("work foldeer doesn't exist! [folder=" + _sWorkFolder + "]");
                }
                _tsUpdateInterval       = cXmlNode.AttributeOrDefaultGet <TimeSpan>("update_interval", new TimeSpan(0, 0, 10));
                _nRollPrerenderQueueMax = cXmlNode.AttributeOrDefaultGet <int>("render_queue", 30);
                _cPoll = new Poll(cXmlNode.NodeGet("poll"));

                _cGlobalOffset = new Dock.Offset(cXmlNode.NodeGet("offset"));

                string  sName, sOuterXML, sHeadXML = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
                XmlNode cNodeRoll;
                foreach (XmlNode cNode in cXmlNode.NodesGet("roll"))
                {
                    sName = cNode.AttributeValueGet("name");

                    cNodeRoll = cNode;
                    switch (sName)
                    {
                    case "images":
                        cXmlDocument = new XmlDocument();
                        sOuterXML    = cNode.OuterXml.Replace("%%IMG_LEFT%%", System.IO.Path.Combine(_sWorkFolder, _cPoll.aCandidates[0].sImage));
                        sOuterXML    = sOuterXML.Replace("%%IMG_RIGHT%%", System.IO.Path.Combine(_sWorkFolder, _cPoll.aCandidates[1].sImage));
                        cXmlDocument.LoadXml(sHeadXML + sOuterXML);
                        cNodeRoll           = cXmlDocument.NodeGet("roll");
                        _nImagesLoopDur     = cNodeRoll.AttributeOrDefaultGet <int>("_loop_dur", 75);
                        _nImagesInterval    = cNodeRoll.AttributeOrDefaultGet <int>("_interval", 600);
                        _cRollImages        = new Roll(cNodeRoll);
                        _cRollImages.stArea = _cRollImages.stArea.Move(_cGlobalOffset);
                        break;

                    case "top":
                        PollUpdate();
                        cXmlDocument = new XmlDocument();
                        sOuterXML    = cNode.OuterXml.Replace("%%TOP_TXT1%%", _cPoll.aDescription[0].ForXML());
                        string sNameArt = _nTemplate == 0 ? _cPoll.aDescription[1] : _cPoll.aCandidates[0].sName;
                        sOuterXML = sOuterXML.Replace("%%TOP_TXT2_1%%", sNameArt.ForXML());
                        sOuterXML = sOuterXML.Replace("%%TOP_TXT2_2%%", _cPoll.aDescription[2].ForXML());
                        sNameArt  = _nTemplate == 0 ? _cPoll.aDescription[1] : _cPoll.aCandidates[1].sName;
                        sOuterXML = sOuterXML.Replace("%%TOP_TXT2_3%%", sNameArt.ForXML());
                        cXmlDocument.LoadXml(sHeadXML + sOuterXML);
                        cNodeRoll      = cXmlDocument.NodeGet("roll");
                        _nTextInTopGap = cNodeRoll.AttributeOrDefaultGet <int>("_text_in_top_gap", 30);
                        _nTopLoopDur   = cNodeRoll.AttributeOrDefaultGet <int>("_loop_dur", 200);
                        _cRollTop      = new Roll(cNodeRoll);
                        Text cInit = (Text)_cRollTop.EffectGet("top_init");
                        cInit.cDock.cOffset.nLeft += (short)((_cRollTop.stArea.nWidth - cInit.stArea.nWidth) / 2);
                        Text cLeft  = (Text)_cRollTop.EffectGet("top_left");
                        Text cMid   = (Text)_cRollTop.EffectGet("top_mid");
                        Text cRight = (Text)_cRollTop.EffectGet("top_right");

                        short nMidLeft = (short)((_cRollTop.stArea.nWidth - cMid.stArea.nWidth) / 2);
                        cMid.cDock.cOffset.nLeft += nMidLeft;
                        short nLeftLeft = (short)(nMidLeft - _nTextInTopGap - cLeft.stArea.nWidth);
                        cLeft.cDock.cOffset.nLeft += nLeftLeft;
                        short nRightLeft = (short)(nMidLeft + cMid.stArea.nWidth + _nTextInTopGap);
                        cRight.cDock.cOffset.nLeft += nRightLeft;

                        //int nWTotal = cLeft.stArea.nWidth + cMid.stArea.nWidth + cRight.stArea.nWidth + 2 * _nTextInTopGap;
                        //short nLeft = (short)((_cRollTop.stArea.nWidth - nWTotal) / 2);
                        //cLeft.cDock.cOffset.nLeft += nLeft;
                        //cMid.cDock.cOffset.nLeft += (short)(nLeft + cLeft.stArea.nWidth + _nTextInTopGap);
                        //cRight.cDock.cOffset.nLeft += (short)(nLeft + cLeft.stArea.nWidth + cMid.stArea.nWidth + 2 * _nTextInTopGap);

                        _cRollTop.stArea = _cRollTop.stArea.Move(_cGlobalOffset);
                        break;

                    case "bot":
                        cXmlDocument = new XmlDocument();
                        sOuterXML    = cNode.OuterXml.Replace("%%BOT_TXT_L%%", _cPoll.aCandidates[0].sDescription);
                        sOuterXML    = sOuterXML.Replace("%%BOT_TXT_R%%", _cPoll.aCandidates[1].sDescription);
                        cXmlDocument.LoadXml(sHeadXML + sOuterXML);
                        cNodeRoll            = cXmlDocument.NodeGet("roll");
                        _nBotBlueWindowWidth = cNodeRoll.AttributeOrDefaultGet <int>("_blue_window_width", 372);
                        _cRollBot            = new Roll(cNodeRoll);
                        Text cBLeft  = (Text)_cRollBot.EffectGet("bot_left");
                        Text cBRight = (Text)_cRollBot.EffectGet("bot_right");
                        cBLeft.cDock.cOffset.nLeft  += (short)((_nBotBlueWindowWidth - cBLeft.stArea.nWidth) / 2);
                        cBRight.cDock.cOffset.nLeft += (short)((_nBotBlueWindowWidth - cBRight.stArea.nWidth) / 2);
                        _cRollBot.stArea             = _cRollBot.stArea.Move(_cGlobalOffset);
                        break;

                    case "mid":
                        PollUpdate();
                        _cPoll.nMidGap          = cNode.AttributeOrDefaultGet <int>("_mid_gap", 46);
                        _cPoll.sOuterXMLMidRoll = cNode.OuterXml;
                        _cRollMid        = _cPoll.NewRollMidGet();
                        _cRollMid.stArea = _cRollMid.stArea.Move(_cGlobalOffset);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                (new Logger()).WriteNotice("Preferences error: [error=" + ex.ToString() + "][source_xml=" + sData + "]");
                throw;
            }
        }
예제 #6
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();
                lock (_oLock)
                {
                    if (_bPrepared)
                    {
                        (new Logger()).WriteWarning("Credits has already prepared!");
                        return;
                    }
                    _bPrepared = true;
                }
                (new Logger()).WriteDebug("prepare:in");
                btl.Roll cRoll = _cPreferences.cRoll;

                cRoll.Stopped += _cRoll_Stopped;
                btl.Text      cText;
                btl.Animation cAnim;
                //btl.Roll.Keyframe[] aKFHold = new btl.Roll.Keyframe[1] { new btl.Roll.Keyframe() { eType = Roll.Keyframe.Type.hold, nFrame = 0, nPosition = 0 } };



                bool bFirstTime = true;
                bool bLastTime  = false;
                int  nOdd       = 1;
                //cRoll.nDuration = 200;

                foreach (helpers.data.Data.WeatherItem cWI in _cPreferences.aWeatherItems)
                {
                    if (cWI == _cPreferences.aWeatherItems[_cPreferences.aWeatherItems.Count - 1])
                    {
                        bLastTime = true;
                    }
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_intro"].cVideo, null, false, false);
                        cRoll.Prepare(53);
                    }
                    // city
                    cText = (btl.Text)_cPreferences.ahItems["text_city_" + nOdd].cVideo;
                    cRoll.RemoveEffect(cText);
                    IdleEffect(cText);
                    cText.sText = cWI.sCity;
                    cText.iMask = _cPreferences.ahItems["mask_city_loop_" + nOdd].cVideo;
                    IdleEffect(cText.iMask);
                    cRoll.EffectAdd(cText, _cPreferences.ahItems["text_city_" + nOdd].aKFs[0], float.MinValue, false, 0, false, false);
                    cRoll.Prepare(3);
                    // time  81
                    cAnim = (btl.Animation)_cPreferences.ahItems["backgr_pink"].cVideo;
                    cRoll.RemoveEffect(cAnim);
                    IdleEffect(cAnim);
                    cRoll.EffectAdd(_cPreferences.ahItems["backgr_pink"].cVideo, null, false, false);

                    cText = (btl.Text)_cPreferences.ahItems["text_time"].cVideo;
                    cRoll.RemoveEffect(cText);
                    IdleEffect(cText);
                    cText.sText = cWI.sTime;
                    cText.iMask = _cPreferences.ahItems["mask_time"].cVideo;
                    IdleEffect(cText.iMask);
                    cRoll.EffectAdd(cText, _cPreferences.ahItems["text_time"].aKFs[0], float.MinValue, false, 0, false, false);
                    cRoll.Prepare(2);
                    // temperature
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_in"].cVideo, null, false, false);
                    }

                    cText = (btl.Text)_cPreferences.ahItems["text_temperature"].cVideo;
                    cRoll.RemoveEffect(cText);
                    cText.bWaitForOutDissolve = false;
                    IdleEffect(cText);
                    cText.sText = cWI.sTemperature.StartsWith("-") || cWI.sTemperature.StartsWith("+") ? cWI.sTemperature.Substring(0, 1) + " " + cWI.sTemperature.Substring(1) : cWI.sTemperature;
                    if (bFirstTime)
                    {
                        cText.iMask = _cPreferences.ahItems["mask_tempr_in"].cVideo;
                        IdleEffect(cText.iMask);
                    }
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[0], float.MinValue, false, 0, false, false);
                    }
                    else if (bLastTime)
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[1], float.MinValue, false, 0, false, false);
                    }
                    else
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[2], float.MinValue, false, 0, false, false);
                    }
                    cRoll.Prepare(2);
                    // icon
                    try
                    {
                        cAnim = (btl.Animation)btl.Effect.EffectGet(_cPreferences.ahItems["animation_icon"].XMLReplace("{%FOLDER%}", cWI.sIcon));
                        cRoll.EffectAdd(cAnim, _cPreferences.ahItems["animation_icon"].aKFs[0], float.MinValue, false, 0, false, false);
                    }
                    catch (Exception ex)
                    {
                        (new Logger()).WriteError("icon problem [icon=" + cWI.sIcon + "]<br>" + ex);
                    }
                    cRoll.Prepare(6);
                    // ---
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_loop"].cVideo, null, false, false);
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_final_loop"].cVideo, null, false, false);
                        bFirstTime = false;
                    }
                    cRoll.Prepare(68);

                    nOdd = nOdd == 1 ? 2 : 1;
                }
                //cRoll.Prepare(5);
                StopEffect(_cPreferences.ahItems["backgr_black_loop"].cVideo);
                cAnim = (btl.Animation)_cPreferences.ahItems["backgr_black_out"].cVideo;
                StopEffect(cAnim);
                cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_out"].cVideo, null, false, false);
                cText = (btl.Text)_cPreferences.ahItems["text_yandex"].cVideo;
                cRoll.EffectAdd(cText, null, false, false);
                cRoll.Prepare(110);
                cAnim = (btl.Animation)_cPreferences.ahItems["backgr_final_pink"].cVideo;
                StopEffect(cAnim);
                cRoll.EffectAdd(cAnim, null, false, false);
                cRoll.Prepare(8);
                StopEffect(_cPreferences.ahItems["backgr_final_loop"].cVideo);
                StopEffect(cText);
                cRoll.Prepare(20);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug("prepare:out");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
예제 #7
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();

                _cRoll                   = new btl.Roll();
                _cRoll.eDirection        = _cPreferences.eDirection;
                _cRoll.nSpeed            = _cPreferences.nSpeed;
                _cRoll.stArea            = _cPreferences.stArea;
                _cRoll.stMergingMethod   = _cPreferences.stRollMerging;
                _cRoll.nLayer            = _cPreferences.nLayer;
                _cRoll.bOpacity          = false;
                _cRoll.EffectIsOnScreen += _cRoll_EffectIsOnScreen;
                _nWaitAndStop            = 0;

                if (_cPreferences.cBackground != null)
                {
                    _stAreaComposite = new Area((short)(_cPreferences.stArea.nLeft - _cPreferences.cBackground.stArea.nLeft), (short)(_cPreferences.stArea.nTop - _cPreferences.cBackground.stArea.nTop), _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight);
                    _cRoll.stArea    = _cPreferences.cBackground.stArea;

                    _cAnimIn = new Animation(_cPreferences.cBackground.sIn, 1, false);
                    _cAnimIn.Prepare();
                    _cAnimLoop = new Animation(_cPreferences.cBackground.sLoop, 0, true);
                    _cAnimLoop.Prepare();
                    _cAnimOut = new Animation(_cPreferences.cBackground.sOut, 1, false);
                    _cAnimOut.Prepare();
                    _cPLBackground = new Playlist();
                    _cPLBackground.bStopOnEmpty = true;
                    _cPLBackground.EffectAdd(_cAnimIn);
                    _cPLBackground.EffectAdd(_cAnimLoop);
                    _cPLBackground.EffectAdd(_cAnimOut);
                    _cPLBackground.Prepare();

                    if (_cPreferences.cBackground.sMaskIn != null && _cPreferences.cBackground.sMaskIn.Length > 0)
                    {
                        _cMaskIn = new Animation(_cPreferences.cBackground.sMaskIn, 1, false);
                        _cMaskIn.Prepare();
                        _cMaskLoop = new Animation(_cPreferences.cBackground.sMaskLoop, 0, true);
                        _cMaskLoop.Prepare();
                        _cMaskOut = new Animation(_cPreferences.cBackground.sMaskOut, 1, false);
                        _cMaskOut.Prepare();
                        _cMaskAllOff = new Animation(_cPreferences.cBackground.sMaskAllOff, 0, true);
                        _cMaskAllOff.Prepare();
                        _cPLMask = new Playlist();
                        _cPLMask.bStopOnEmpty = false;
                        _cPLMask.EffectAdd(_cMaskIn);
                        _cPLMask.EffectAdd(_cMaskLoop);
                        _cPLMask.EffectAdd(_cMaskOut);
                        _cPLMask.EffectAdd(_cMaskAllOff);
                        _cPLMask.Prepare();
                    }
                }
                else
                {
                    _stAreaComposite = new Area(0, 0, _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight);
                }
                _cRoll.Prepare();


                _aItems        = new List <Item>();
                _cTimerRequest = new System.Threading.Timer(TickRequest);
                TickRequest(null);
                _cRollFeed = new Thread(RollFeed);
                _cRollFeed.IsBackground = true;
                _cRollFeed.Start();
                _cTimerStop = new System.Threading.Timer(AsyncStop);
                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }