Exemplo n.º 1
0
        public ConnectionContext(Socket acceptedSocket,
                                 string hostName,
                                 ProtocolManager protocolManager,
                                 DesignTimeWorkspace workspaceContext,
                                 IDictionary <int, ProjectManager> projects)
        {
            _hostName = hostName;
            _projects = projects;

            _queue            = new ProcessingQueue(new NetworkStream(acceptedSocket));
            _queue.OnReceive += message =>
            {
                if (protocolManager.IsProtocolNegotiation(message))
                {
                    message.Sender = this;
                    protocolManager.Negotiate(message);
                }
                else
                {
                    message.Sender = this;
                    ProjectManager projectManager;
                    if (!_projects.TryGetValue(message.ContextId, out projectManager))
                    {
                        projectManager = new ProjectManager(message.ContextId,
                                                            workspaceContext,
                                                            protocolManager);

                        _projects[message.ContextId] = projectManager;
                    }

                    projectManager.OnReceive(message);
                }
            };
        }
Exemplo n.º 2
0
        public ConnectionContext(Socket acceptedSocket,
            string hostName,
            ProtocolManager protocolManager,
            DesignTimeWorkspace workspaceContext,
            IDictionary<int, ProjectManager> projects)
        {
            _hostName = hostName;
            _projects = projects;

            _queue = new ProcessingQueue(new NetworkStream(acceptedSocket));
            _queue.OnReceive += message =>
            {
                if (protocolManager.IsProtocolNegotiation(message))
                {
                    message.Sender = this;
                    protocolManager.Negotiate(message);
                }
                else
                {
                    message.Sender = this;
                    ProjectManager projectManager;
                    if (!_projects.TryGetValue(message.ContextId, out projectManager))
                    {
                        projectManager = new ProjectManager(message.ContextId,
                                                           workspaceContext,
                                                           protocolManager);

                        _projects[message.ContextId] = projectManager;
                    }

                    projectManager.OnReceive(message);
                }
            };
        }
Exemplo n.º 3
0
        public ConnectionContext(Socket acceptedSocket,
                                 string hostName,
                                 ProtocolManager protocolManager,
                                 WorkspaceContext workspaceContext,
                                 IDictionary <int, ProjectContextManager> projectContextManagers,
                                 ILoggerFactory loggerFactory)
        {
            _hostName = hostName;
            _projectContextManagers = projectContextManagers;

            _queue            = new ProcessingQueue(new NetworkStream(acceptedSocket), loggerFactory);
            _queue.OnReceive += message =>
            {
                if (protocolManager.IsProtocolNegotiation(message))
                {
                    message.Sender = this;
                    protocolManager.Negotiate(message);
                }
                else
                {
                    message.Sender = this;
                    ProjectContextManager keeper;
                    if (!_projectContextManagers.TryGetValue(message.ContextId, out keeper))
                    {
                        keeper = new ProjectContextManager(message.ContextId,
                                                           loggerFactory,
                                                           workspaceContext,
                                                           protocolManager);

                        _projectContextManagers[message.ContextId] = keeper;
                    }

                    keeper.OnReceive(message);
                }
            };
        }