Пример #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);
                }
            };
        }
Пример #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);
                }
            };
        }
Пример #3
0
 public ProjectModelServerCommand(int port, string hostName)
 {
     _port = port;
     _hostName = hostName;
     _protocolManager = new ProtocolManager(maxVersion: 4);
     _workspaceContext = new DesignTimeWorkspace(ProjectReaderSettings.ReadFromEnvironment());
     _projects = new Dictionary<int, ProjectManager>();
 }
Пример #4
0
 public ProjectModelServerCommand(int port, string hostName)
 {
     _port             = port;
     _hostName         = hostName;
     _protocolManager  = new ProtocolManager(maxVersion: 4);
     _workspaceContext = new DesignTimeWorkspace(ProjectReaderSettings.ReadFromEnvironment());
     _projects         = new Dictionary <int, ProjectManager>();
 }
Пример #5
0
 public Program(int port, string hostName, ILoggerFactory loggerFactory)
 {
     _port = port;
     _hostName = hostName;
     _loggerFactory = loggerFactory;
     _protocolManager = new ProtocolManager(maxVersion: 4, loggerFactory: _loggerFactory);
     _workspaceContext = WorkspaceContext.Create();
     _projects = new Dictionary<int, ProjectManager>();
 }
Пример #6
0
 public Program(int port, string hostName, ILoggerFactory loggerFactory)
 {
     _port             = port;
     _hostName         = hostName;
     _loggerFactory    = loggerFactory;
     _protocolManager  = new ProtocolManager(maxVersion: 4, loggerFactory: _loggerFactory);
     _workspaceContext = WorkspaceContext.Create();
     _projects         = new Dictionary <int, ProjectManager>();
 }
Пример #7
0
        public ProjectManager(
            int contextId,
            DesignTimeWorkspace workspaceContext,
            ProtocolManager protocolManager)
        {
            Id = contextId;
            _workspaceContext = workspaceContext;
            _protocolManager  = protocolManager;

            _messengers = new List <Messenger <ProjectContextSnapshot> >
            {
                new ReferencesMessenger(Transmit),
                new DependenciesMessenger(Transmit),
                new DependencyDiagnosticsMessenger(Transmit),
                new CompilerOptionsMessenger(Transmit),
                new SourcesMessenger(Transmit)
            };

            _projectDiagnosticsMessenger = new ProjectDiagnosticsMessenger(Transmit);
            _globalErrorMessenger        = new GlobalErrorMessenger(Transmit);
            _projectInforamtionMessenger = new ProjectInformationMessenger(Transmit);
        }
Пример #8
0
        public ProjectContextManager(int contextId,
                                     ILoggerFactory loggerFactory,
                                     WorkspaceContext workspaceContext,
                                     ProtocolManager protocolManager)
        {
            Id   = contextId;
            _log = loggerFactory.CreateLogger <ProjectContextManager>();
            _workspaceContext = workspaceContext;
            _protocolManager  = protocolManager;

            _messengers = new List <Messenger <ProjectSnapshot> >
            {
                new DependencyDiagnosticsMessenger(Transmit),
                new DependenciesMessenger(Transmit),
                new CompilerOptionsMessenger(Transmit),
                new ReferencesMessenger(Transmit),
                new SourcesMessenger(Transmit)
            };

            _projectDiagnosticsMessenger = new ProjectDiagnosticsMessenger(Transmit);
            _globalErrorMessenger        = new GlobalErrorMessenger(TransmitDiagnostics);
            _projectInforamtionMessenger = new ProjectInformationMessenger(Transmit);
        }
Пример #9
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);
                }
            };
        }