| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System;
- using BO.ProcessServer.Business;
- using BO.ProcessServer.Commands.Base;
- using Quadarax.Foundation.Core.NLog;
- using Quadarax.Foundation.Core.QConsole;
- using Quadarax.Foundation.Core.QConsole.Attributes;
- using Quadarax.Foundation.Core.Value;
- // ReSharper disable InconsistentNaming
- namespace BO.ProcessServer.Commands
- {
- [CommandDefinition]
- internal class RunCommand : BaseLocalCommand
- {
- #region *** Constants ***
- private const string CS_CMD_RUN_NAME = "run";
- private const string CS_CMD_RUN_DESCR = "Runs entire ProcessServer instance.";
- #endregion
- #region *** Properties ***
- public override string Name => CS_CMD_RUN_NAME;
- public override string Description => CS_CMD_RUN_DESCR;
- #endregion
- #region *** Private fields ***
- #endregion
- #region *** Constructors ***
- public RunCommand(Engine engine) : base(engine)
- {
- }
- #endregion
- #region *** EXECUTE ***
- protected override Result OnExecute()
- {
- using (var server = new Server(Configuration, FileSystem, LoggerFactory.Instance))
- {
- WriteInfo("Starting...");
- server.Start();
- WriteInfo("Started.");
- WriteCaption("Press Esc to exit.");
- var exit = false;
- while (!exit)
- {
- var keyInfo = Console.ReadKey();
- exit = keyInfo.Key == ConsoleKey.Escape;
- }
- server.Stop();
- }
- return new Result();
- }
- #endregion
- #region *** Private operations ***
- #endregion
- }
- }
|