Example #1
0
        public SolutionTest()
        {
            var path = Environment.CurrentDirectory + "/Solution/minimal/minimal.sln";

            _solution = new CSharpSolution(path, new Logger(Verbosity.Verbose));
            _solution.LoadSolution();
        }
Example #2
0
        private CSharpSolution LoadSolution(string solutionFile)
        {
            var solution = new CSharpSolution();

            solution.OnLoadingProject += (m) => ExecuteOnStepMessage(string.Format(_parserStrings.ReadingProject, m));
            solution.OnLoadedProject  += (t, i) => ExecuteOnStepProgress((int)(((double)i / (double)t) * 20));

            solution.LoadSolution(solutionFile);

            return(solution);
        }
Example #3
0
        public CSharpSolution LoadSolution()
        {
            _buildMessenger.ExecuteOnStepProgress(0);
            _buildMessenger.ExecuteOnBuildMessage(_sdBuildStrings.LoadingSolution);

            var solution = new CSharpSolution(_sdBuildStrings, _buildMessenger);

            solution.LoadSolution(_coreConfigSection.InputPath);
            PostSolutionLoadSummary(solution);

            _buildMessenger.ExecuteOnStepProgress(100);

            return(solution);
        }
Example #4
0
        private static void StartServer(string solutionPath, string clientPathMode, int port, Verbosity verbosity)
        {
            var logger = new Logger(verbosity);

            try
            {
                Configuration.ConfigurationLoader.Load(clientPathMode);

                var solution = new CSharpSolution(logger);
                Console.CancelKeyPress +=
                    (sender, e) =>
                {
                    solution.Terminated = true;
                    Console.WriteLine("Ctrl-C pressed");
                    e.Cancel = true;
                };
                var nancyHost = new NancyHost(new Bootstrapper(
                                                  solution,
                                                  new NativeFileSystem(),
                                                  logger),
                                              new HostConfiguration {
                    RewriteLocalhost = false
                },
                                              new Uri("http://localhost:" + port));

                nancyHost.Start();
                logger.Debug("OmniSharp server is listening");
                solution.LoadSolution(solutionPath.ApplyPathReplacementsForServer());
                logger.Debug("Solution has finished loading");
                while (!solution.Terminated)
                {
                    Thread.Sleep(1000);
                }

                Console.WriteLine("Quit gracefully");
                nancyHost.Stop();
            }
            catch (Exception e)
            {
                if (e is SocketException || e is HttpListenerException)
                {
                    logger.Error("Detected an OmniSharp instance already running on port " + port + ". Press a key.");
                    return;
                }
                throw;
            }
        }
Example #5
0
        private static void StartServer(string solutionPath, int port, bool verbose)
        {
            try
            {
                var solution = new CSharpSolution();
                Console.CancelKeyPress +=
                    (sender, e) =>
                {
                    solution.Terminated = true;
                    Console.WriteLine("Ctrl-C pressed");
                    e.Cancel = true;
                };

                var nancyHost = new NancyHost(new Bootstrapper(solution, new NativeFileSystem(), verbose), new HostConfiguration {
                    RewriteLocalhost = false
                }, new Uri("http://localhost:" + port));

                nancyHost.Start();
                Console.WriteLine("OmniSharp server is listening");
                solution.LoadSolution(solutionPath);
                Console.WriteLine("Solution has finished loading");
                while (!solution.Terminated)
                {
                    Thread.Sleep(1000);
                }

                Console.WriteLine("Quit gracefully");
                nancyHost.Stop();
            }
            catch (Exception e)
            {
                if (e is SocketException || e is HttpListenerException)
                {
                    Console.Error.WriteLine("Detected an OmniSharp instance already running on port " + port + ". Press a key.");
                    Console.ReadKey();
                    return;
                }
                throw;
            }
        }