コード例 #1
0
ファイル: Runtime.cs プロジェクト: visual14ph/f1livetiming
 //private readonly ILog _logger = LogManager.GetLogger("Runtime");
 /// <summary>
 /// Create the Runtime object to combine all the various components of the livetiming.
 /// </summary>
 /// <param name="liveStream">A stream used to represent the incoming data of the live stream.</param>
 /// <param name="authKeyService">Provider for authorization key requests.</param>
 /// <param name="keyFrameService">Provider for keyframes.</param>
 /// <param name="messageDispatch">A receiver for messages.</param>
 public Runtime(Stream liveStream, IAuthKey authKeyService, IKeyFrame keyFrameService, IMessageDispatch messageDispatch)
 {
     _decryptor = new DataDecryptor();
     _packetReader = new PacketReader(liveStream, new DecryptStreamDecorator(liveStream, _decryptor));
     _messageDispatch = messageDispatch;
     _authKeyService = authKeyService;
     _keyFrameService = keyFrameService;
 }
コード例 #2
0
        //private readonly ILog _logger = LogManager.GetLogger("Runtime");


        /// <summary>
        /// Create the Runtime object to combine all the various components of the livetiming.
        /// </summary>
        /// <param name="liveStream">A stream used to represent the incoming data of the live stream.</param>
        /// <param name="authKeyService">Provider for authorization key requests.</param>
        /// <param name="keyFrameService">Provider for keyframes.</param>
        /// <param name="messageDispatch">A receiver for messages.</param>
        public Runtime(Stream liveStream, IAuthKey authKeyService, IKeyFrame keyFrameService, IMessageDispatch messageDispatch)
        {
            _decryptor       = new DataDecryptor();
            _packetReader    = new PacketReader(liveStream, new DecryptStreamDecorator(liveStream, _decryptor));
            _messageDispatch = messageDispatch;
            _authKeyService  = authKeyService;
            _keyFrameService = keyFrameService;
        }
コード例 #3
0
ファイル: DispatchQueue.cs プロジェクト: thomasraynal/busy
 public void RunOrEnqueue(IMessageDispatch dispatch, IMessageHandlerInvoker invoker)
 {
     if (IsCurrentDispatchQueue)
     {
         RunSingle(dispatch, invoker);
     }
     else
     {
         Enqueue(dispatch, invoker);
     }
 }
コード例 #4
0
ファイル: DispatchQueue.cs プロジェクト: thomasraynal/busy
        private void RunSingle(IMessageDispatch dispatch, IMessageHandlerInvoker invoker)
        {
            if (!_isRunning)
            {
                return;
            }


            RunInternal(new List <DispatchQueueEntry> {
                new DispatchQueueEntry(dispatch, invoker)
            });
        }
コード例 #5
0
        public Task InvokeMessageHandler(IMessageDispatch message)
        {
            var handlers = _cache.GetHandlers(MessageHandlerType);

            foreach (var handler in handlers)
            {
                var invoker = _cache.GetMethodInfo(handler.GetType(), message.Message.GetType());
                invoker.Invoke(handler, new object[] { message.Message });
            }

            //refacto
            return(Task.CompletedTask);
        }
コード例 #6
0
        /// <summary>
        /// costruttore classe
        /// </summary>
        /// <param name="MessageDispatch"></param>
        public DocumentMonitor(IMessageDispatch MessageDispatch)
        {
            messageDispatch = MessageDispatch;

            try
            {
                fileWatcher = new FileSystemWatcher();
                fileWatcher.NotifyFilter          = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
                fileWatcher.Filter                = "*.*";
                fileWatcher.IncludeSubdirectories = true;

                fileWatcher.Created     += OnFolderCreatedOrChanged;
                fileWatcher.Changed     += OnFolderCreatedOrChanged;
                fileWatcher.Renamed     += OnFolderRenamed;
                fileWatcher.Deleted     += OnFolderDeleted;
                messageNotificationQueue = new Queue <DocumentMonitorData>();
            }
            catch (Exception ex)
            {
                logger.Error(ex, "public DocumentMonitor(IMessageDispatch MessageDispatch)");
            }
        }
コード例 #7
0
ファイル: DispatchQueue.cs プロジェクト: thomasraynal/busy
 public void Enqueue(IMessageDispatch dispatch, IMessageHandlerInvoker invoker)
 {
     _queue.Add(new DispatchQueueEntry(dispatch, invoker));
 }
コード例 #8
0
 public DispatchQueueEntry(IMessageDispatch dispatch, IMessageHandlerInvoker invoker)
 {
     Dispatch = dispatch;
     Invoker  = invoker;
 }