int OnExecute() { MSBuildLocator.RegisterDefaults(); // needed to "configure" the design time build QsLanguageServer server = null; switch (Validate()) { case ConnectionMode.NamedPipe: server = ConnectNamedPipe(WriterPipeName, ReaderPipeName); break; case ConnectionMode.Socket: server = ConnectSocket(port: Port.Value); break; } Log("Waiting for shutdown..."); server.WaitForShutdown(); if (server.ReadyForExit) { Log("Exiting normally."); return(0); } else { Log("Exiting abnormally."); return(1); } }
static int Main(string[] args) { MSBuildLocator.RegisterDefaults(); // needed to "configure" the design time build Log("Called with command line arguments: " + String.Join(" ", args)); var options = new OptionSet { { "l|log=", "file to write log messages to.", l => logFile = l }, { "p|port=", "TCP port to connect to", (int p) => port = p }, { "w|writer=", "Named pipe to write to", w => writerPipeName = w }, { "r|reader=", "Named pipe to read from", r => readerPipeName = r } }; List <String> extra = null; try { extra = options.Parse(args); } catch (OptionException e) { Log(e.Message); } QsLanguageServer server = null; switch (Validate()) { case ConnectionMode.NamedPipe: server = ConnectNamedPipe(writerPipeName, readerPipeName); break; case ConnectionMode.Socket: server = ConnectSocket(port: port.Value); break; } Log("Waiting for shutdown..."); server.WaitForShutdown(); if (server.ReadyForExit) { Log("Exiting normally."); return(0); } else { Log("Exiting abnormally."); return(1); } }