Exemplo n.º 1
0
        public void Prepare()
        {
            try
            {
                DisCom.Init();

                _cRoll            = new Roll();
                _cRoll.eDirection = _cPreferences.eDirection;
                _cRoll.nSpeed     = _cPreferences.nSpeed;
                _cRoll.stArea     = _cPreferences.stArea;
                _cRoll.bCUDA      = _cPreferences.bRollCuda;
                _cRoll.nLayer     = _cPreferences.nLayer;
                _cRoll.bOpacity   = false;
                if (0 < _cPreferences.nPause)
                {
                    _cRoll.EffectIsOffScreen += _cRoll_EffectIsOffScreen;
                }
                _cRoll.Prepare();

                _ahItems          = new Dictionary <string, DateTime>();
                _cTimerRollResume = new System.Threading.Timer(TickRollResume);
                _cTimerRssRequest = new System.Threading.Timer(TickRssRequest);
                TickRssRequest(null);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Exemplo n.º 2
0
        static private void MergingWorker()
        {
            try
            {
                NamedPipeServerStream cServerPipeStream = new NamedPipeServerStream("DisComPipe-Merging-" + _nN);
                (new Logger("DisComExt-MergingWorker-" + _nN)).WriteNotice("PIPE Server [" + "DisComPipe-Merging - " + _nN + "] started and waiting for the discom client...");
                cServerPipeStream.WaitForConnection();
                (new Logger("DisComExt-MergingWorker-" + _nN)).WriteNotice("PIPE connection accepted");
                BinaryFormatter cBinFormatter = new BinaryFormatter();
                _nCopyInChunkSize = (int)cBinFormatter.Deserialize(cServerPipeStream);
                (new Logger("DisComExt-MergingWorker-" + _nN)).WriteNotice("chunk size got [" + _nCopyInChunkSize + "]");

                PixelsMap.Command.ID eComand = PixelsMap.Command.ID.Unknown;
                DisCom           cDisCom     = new DisCom();
                List <long>      aDPs;
                List <byte[]>    aByteArs = new List <byte[]>();
                DisCom.MergeInfo cMergeInfo;

                while (true)
                {
                    try
                    {
                        eComand = (PixelsMap.Command.ID)cServerPipeStream.ReadByte();
                        switch (eComand)
                        {
                        case PixelsMap.Command.ID.Merge:
                            aDPs = (List <long>)cBinFormatter.Deserialize(cServerPipeStream);
                            aByteArs.Clear();
                            foreach (long nID2 in aDPs)
                            {
                                lock (_ahBytesID_Bytes)
                                    aByteArs.Add(_ahBytesID_Bytes[nID2].aBytes);
                            }
                            cMergeInfo = (DisCom.MergeInfo)cBinFormatter.Deserialize(cServerPipeStream);
                            cDisCom.FrameMerge(cMergeInfo, aByteArs, false);
                            cMergeInfo.Dispose();
                            cServerPipeStream.WriteByte(1);
                            break;

                        default:
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        (new Logger("DisComExt-MergingWorker-" + _nN)).WriteError(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                (new Logger("DisComExt-MergingWorker-" + _nN)).WriteError("in MergingWorker", ex);
            }
            finally
            {
                (new Logger("DisComExt-MergingWorker-" + _nN)).WriteNotice("merging worker STOPPED!");
            }
        }