Beispiel #1
0
 public QueueService(MongoRepository repository, IScreenShotService screenShotService, ICaptureService сaptureService)
 {
     _factory = new ConnectionFactory()
     {
         HostName = ConfigurationManager.AppSettings["RabbitMQ.Host"]
     };
     _queueName         = ConfigurationManager.AppSettings["RabbitMQ.QueueName"];
     _repository        = repository;
     _screenShotService = screenShotService;
     _сaptureService    = сaptureService;
 }
Beispiel #2
0
 public UploadLogController(IBehaviorService behaviorService
                            , IJavascriptErrorService javascriptErrorService
                            , ICustomerPVService customerPVService
                            , ILoadPageService loadPageService
                            , IResourceLoadService resourceLoadService
                            , IHttpLogService httpLogService
                            , IExtendBehaviorService extendBehaviorService
                            , IScreenShotService screenShotService)
 {
     _behaviorService        = behaviorService;
     _javascriptErrorService = javascriptErrorService;
     _customerPVService      = customerPVService;
     _loadPageService        = loadPageService;
     _resourceLoadService    = resourceLoadService;
     _httpLogService         = httpLogService;
     _extendBehaviorService  = extendBehaviorService;
     _screenShotService      = screenShotService;
 }
        public void StartShare(IScreenShotService screenShotService)
        {
            IsStarted = true;

            _networkService.StartServer();

            IFormatter formatter = new BinaryFormatter();

            List <TcpClient> connections = null;

            _networkService.OnConnectionsChanged += (s, e) =>
            {
                connections = e.Connections.ToList();
            };

            Task.Factory.StartNew(() =>
            {
                while (IsStarted)
                {
                    if (connections == null || !connections.Any())
                    {
                        Task.Delay(1000).Wait();
                        continue;
                    }

                    for (int i = 0; i < connections.Count; i++)
                    {
                        TcpClient client = connections[i];

                        if (client != null && client.Connected)
                        {
                            try
                            {
                                formatter.Serialize(client.GetStream(), screenShotService.Capture());
                            }
                            catch { }
                        }
                    }
                }
            });
        }