static void Main(string[] args) { InitializeServiceProvider(); IConsoleApp app = _serviceProvider.GetService <IConsoleApp>(); app.Run(); }
public void SetCurrentApplication(IConsoleApp app) { currentApp = app; if (currentApp.Console.Output is AppOutputStream console) { ConsoleManager.Controller.Active = console.Session; } }
public AppManager(ConsoleSession debug, IKeyboard keyboard, ServiceManager serviceManager) { this.ServiceManager = serviceManager; this.keyboard = keyboard; this.debug = debug; shell = new Shell(); currentApp = shell; }
public AppManager(ConsoleSession debug, IKeyboard keyboard) { this.keyboard = keyboard; this.debug = debug; shell = new Shell(); currentApp = shell; }
public void SetCurrentApplication(IConsoleApp app) { currentApp = app; var console = currentApp.Console.Output as AppOutputStream; if (console != null) { ConsoleManager.Controller.Active = console.Session; } }
public void StartApp(IConsoleApp app, Stream input, Stream output, bool enableEcho, string parameters) { if (input == null) { input = new AppInputStream(); } if (output == null) { var session = ConsoleManager.Controller.CreateSeason(); output = new AppOutputStream(session); } app.Console.Input = input; app.Console.Output = output; app.Console.EnableEcho = enableEcho; app.AppManager = this; SetCurrentApplication(app); app.Start(parameters); }
public static void Initialize() { /* * Application.EnableVisualStyles(); * Application.SetCompatibleTextRenderingDefault(false); */ ConsoleApp.ConsoleManager f = new ConsoleApp.ConsoleManager(); Thread thread = new Thread(() => { Application.Run(f); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); while (!f.Initialized) { Thread.Sleep(25); } consoleApp = f; return; }
/// <summary> /// Creates a console object, fills it from the default command-line arguments, then calls its Start method. Also supports Click-Once deployed URL arguments. /// </summary> /// <param name="options">Options for how to handle running the console app.</param> public static void Start <T>(BaConStartOptions options = null) where T : IConsoleApp, new() { if (options == null) { options = new BaConStartOptions(); } IConsoleApp consoleApp = null; try { var results = ParseArgs <T>(options.CmdLineOptions); consoleApp = results.Args; if (results.Title.HasValue()) { WriteLine(results.Title, Theme.AppTitleColor); } if (results.Description.HasValue()) { WriteLine(results.Description, Theme.AppDescriptionColor); } if (results.Copyright.HasValue()) { WriteLine(results.Copyright.Replace("©", "(c)"), Theme.AppDescriptionColor); // The © doesn't show up correctly in the console. } WriteLine(); // Put a line between the title and rest of the information. // Validate only after checking to see if they requested help // in order to prevent displaying errors when they request help. if (consoleApp.Help || results.Errors.Length > 0) { WriteHelp(results); if (!consoleApp.Help && results.Errors.Length > 0) { Environment.ExitCode = options.CmdLineOptions.InvalidArgsExitCode ?? 1; // There were errors, return exit code. } else { Environment.ExitCode = 0; } return; } Environment.ExitCode = consoleApp.Start(); } catch (Exception ex) { if (consoleApp == null || !consoleApp.Error(ex)) { WriteError(ex); Environment.ExitCode = options?.CmdLineOptions?.FatalErrorExitCode ?? -1; } } finally { if (consoleApp != null && consoleApp.Wait) { WriteLine(options.PressAnyKey); Console.ReadKey(); } // Dispose of the app if it is disposable. (consoleApp as IDisposable)?.Dispose(); } }
private void RunNgen(string cmdLine) { _ngenApp = new ConsoleApp(NgenExePath, cmdLine); _ngenApp.ConsoleOutput += OnConsoleOutput; _ngenApp.Exited += OnConsoleExited; _ngenApp.Run(); }
private void DisposeNgen() { if (_ngenApp != null) { _ngenApp.ConsoleOutput -= OnConsoleOutput; _ngenApp.Exited -= OnConsoleExited; _ngenApp.Dispose(); _ngenApp = null; } }
public ManualAddPortfolioCommand(ILogger logger, IConsoleApp consoleApp) { this.logger = logger; this.consoleApp = consoleApp; }
public ManualAddClientCommand(ILogger logger, IConsoleApp consoleApp) { this.logger = logger; this.consoleApp = consoleApp; }
public void StartApp(IConsoleApp app, Stream input, Stream output, bool enableEcho, string parameters) { if (input == null) { input = new AppInputStream(); } if (output == null) { var session = Mosa.Kernel.x86.ConsoleManager.Controller.CreateSeason(); output = new AppOutputStream(session); } app.Console.Input = input; app.Console.Output = output; app.Console.EnableEcho = enableEcho; app.AppManager = this; SetCurrentApplication(app); app.Start(parameters); }