Ejemplo n.º 1
0
        private async Task <IEnumerable <RoslynService> > GetServicesAsync(Solution solution)
        {
            var derivedClasses = await GetDerivedClassesAsync(solution, ReflectionNames.BASE_SERVICE_TYPE);

            return(derivedClasses.Select(dc => {
                var service = new RoslynService(dc);
                service.Fill();
                return service;
            }));
        }
Ejemplo n.º 2
0
        public static void Start()
        {
            Profiler.measure(">> Initialized: ", () => RoslynService.Init());

            try
            {
                var serverSocket = new TcpListener(IPAddress.Loopback, serverPort);
                serverSocket.Start();

                while (true)
                {
                    using (TcpClient clientSocket = serverSocket.AcceptTcpClient())
                    {
                        try
                        {
                            string request = clientSocket.ReadAllText();

                            if (request == "-exit")
                            {
                                try { clientSocket.WriteAllText("Bye"); } catch { }
                                break;
                            }

                            Profiler.measure(">> Processing client request: ", () =>
                            {
                                string response = RoslynService.process_build_remotelly_request(request);
                                clientSocket.WriteAllText(response);
                            });
                        }
                        catch (Exception e)
                        {
                            WriteLine(e.Message);
                        }
                    }
                }

                serverSocket.Stop();
                WriteLine(" >> exit");
            }
            catch (SocketException e)
            {
                if (e.ErrorCode == 10048)
                {
                    WriteLine(">" + e.Message);
                }
                else
                {
                    WriteLine(e.Message);
                }
            }
            catch (Exception e)
            {
                WriteLine(e);
            }
        }
Ejemplo n.º 3
0
        private void InitializeViewModel()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var outputWindow = GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            AssumePresent(outputWindow);

            var outputService = new OutputWindowOutputService(ConsolePaneId, outputWindow, "Code Connections");

            try
            {
                var dte = GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
                AssumePresent(dte);
                var documentsService = new DocumentsService(dte);
                SubscribeListeners(documentsService);

                var componentModel = GetService(typeof(SComponentModel)) as IComponentModel;
                AssumePresent(componentModel);
                var workspace     = componentModel.GetService <VisualStudioWorkspace>();
                var roslynService = new RoslynService(workspace).DisposeWith(_disposables);

                var solutionService = new SolutionService(dte);
                SubscribeListeners(solutionService);

                var gitService = new GitService(solutionService).DisposeWith(_disposables);

                var solutionPersistence     = (IVsSolutionPersistence)GetService(typeof(SVsSolutionPersistence));
                var solutionSettingsService = new SolutionSettingsService(solutionPersistence);
                var userSettingsService     = new DialogUserSettingsService(CodeConnectionsPackage.UserOptionsDialog ?? throw new InvalidOperationException("User options unavailable"));

                if (Content is DependencyGraphToolWindowControl content)
                {
                    content.DataContext = new DependencyGraphToolWindowViewModel(ThreadHelper.JoinableTaskFactory, documentsService, roslynService, gitService, solutionService, outputService, roslynService, solutionSettingsService, userSettingsService)
                                          .DisposeWith(_disposables);
                }
            }
            catch (Exception e)
            {
                outputService.WriteLine($"Failed to open Code Connections tool window.");
                outputService.WriteLine($"Error: {e}");

                throw;
            }
        }
Ejemplo n.º 4
0
 public CSharpModule(RoslynService roslyn, RootController root)
     : base(root)
 {
     _roslyn = roslyn;
 }