public static void RegisterApplication(EntityViewModel viewModel, StreamReader stdOut, StreamReader errOut) { new Thread(() => { while (!stdOut.EndOfStream) { string line = stdOut.ReadLine(); if (line != null) { ConsoleWriteLine?.Invoke(line, viewModel); if (line.Contains(@"WARN Advanced terminal features are not available in this environment")) { continue; } //bool used to generate green success message in console bool isSuccess = false; if (viewModel is ServerViewModel serverViewModel) { if (line.Contains("For help, type \"help\"")) { serverViewModel.CurrentStatus = ServerStatus.RUNNING; isSuccess = true; } serverViewModel.RoleInputHandler(line); } if (viewModel is NetworkViewModel networkViewModel) { if (waterfallStarted.Match(line).Success) { networkViewModel.CurrentStatus = ServerStatus.RUNNING; isSuccess = true; } } viewModel.AddToConsole(isSuccess ? new ConsoleMessage(line, ConsoleMessage.MessageLevel.SUCCESS) : new ConsoleMessage(line)); } } }) { IsBackground = true }.Start();