private static async Task <int> Main(string[] args) { int exitCode = await AppStarter <Startup> .StartAsync( args, EnvironmentVariables.GetEnvironmentVariables().Variables); return(exitCode); }
private static int StartConsole(string[] args) { while (true) { Console.WriteLine("Введите номер пункта меню и нажмите Etner: "); Console.WriteLine("1. Установить службу TaskerService (Требуется запуск от имени Администратора."); Console.WriteLine("2. Удалить службу TaskerService (Требуется запуск от имени Администратора."); Console.WriteLine("3. Запустить TaskerService в консольном режиме для отладки. Для остановки нажать любую клавишу."); Console.WriteLine("4. Получить справку."); Console.WriteLine("5. Выйти."); var selectedItem = Console.ReadLine(); if (selectedItem != null && selectedItem.StartsWith("1")) { ServiceInstall.Install <TaskerServiceInstaller>(new[] { "Install" }); } if (selectedItem != null && selectedItem.StartsWith("2")) { ServiceInstall.Install <TaskerServiceInstaller>(new[] { "Uninstall" }); } if (selectedItem != null && selectedItem.StartsWith("3")) { Console.Clear(); AppStarter.Init(AppMode.ConsoleApplication); AppStarter.StartTasker(); Console.ReadKey(); AppStarter.StopTasker(); Console.WriteLine("Для продолжения нажмите любую клавишу..."); Console.ReadKey(); return(0); } if (selectedItem != null && selectedItem.StartsWith("4")) { Console.WriteLine("Для установки службы TaskerService необходимо запустить Tasker.Runner.exe с параметром -Install"); Console.WriteLine("Для удаления службы TaskerService необходимо запустить Tasker.Runner.exe с параметром -Uninstall"); Console.WriteLine("Запуск службы осуществляется стандартными инструментами Windows"); } if (selectedItem != null && selectedItem.StartsWith("5")) { return(0); } Console.WriteLine("Для продолжения нажмите любую клавишу..."); Console.ReadKey(); Console.Clear(); } }
public TestAppFixture() { var rnd = new Random(); var dbName = string.Format(DbTestName, DateTime.Now, rnd.Next()); var contentRoot = AppStarter.GetContentPath(ProjectName); var dbFileName = Path.GetFullPath(Path.Combine(contentRoot, dbName)); var conStr = $"Data Source={dbFileName};"; _starter = new AppStarter(null, "sqlite", conStr, ProjectName); var logger = Provider.GetRequiredService <ILogger <TestAppFixture> >(); logger.LogDebug("Test started..."); }
public void Setup() { _AppStarter = new AppStarter(); _Subscriber = new Mock<IStartable>(); _Subscriber.Setup(x => x.Start()); _Subscriber2 = new Mock<IStartable>(); _Subscriber2.Setup(x => x.Start()); _FailingSubscriber = new Mock<IStartable>(); _FailingSubscriber.Setup(x => x.Start()).Throws<ArgumentNullException>(); _FailingSubscriber.Setup(x => x.GetName()).Returns("Test"); }
public static async Task <int> Main(string[] args) { new LoggerConfiguration().WriteTo.Seq("http://localhost:5341"); byte[] key = TokenHelper.GenerateKey(); var agents = new List <string>() { "Agent1" }; var devConfiguration = new DevConfiguration { ServerUrl = "http://localhost:34343", Key = new KeyData(key) }; foreach (string agent in agents) { var agentId = new AgentId(agent); devConfiguration.Agents.Add(agentId, null); } var variables = EnvironmentVariables.GetEnvironmentVariables().Variables .ToDictionary(s => s.Key, s => s.Value); variables.Add("urn:milou:deployer:web:milou-authentication:default:bearerTokenIssuerKey", devConfiguration.Key.KeyAsBase64); variables.Add("urn:milou:deployer:web:milou-authentication:default:enabled", "true"); variables.Add("urn:milou:deployer:web:milou-authentication:default:bearerTokenEnabled", "true"); variables.Add(LoggingConstants.SerilogSeqEnabledDefault, "true"); variables.Add("urn:arbor:app:web:logging:serilog:default:seqUrl", "http://localhost:5341"); variables.Add("urn:arbor:app:web:logging:serilog:default:consoleEnabled", "true"); variables.Add(ConfigurationKeys.AllowPreReleaseEnvironmentVariable, "true"); using var cancellationTokenSource = new CancellationTokenSource(); var commonAssemblies = ApplicationAssemblies.FilteredAssemblies(new[] { "Arbor", "Milou" }); IReadOnlyCollection <Assembly> serverAssemblies = commonAssemblies .Where(assembly => !assembly.GetName().Name !.Contains("Agent.Host")).ToImmutableArray(); var serverTask = AppStarter.StartAsync(args, variables, cancellationTokenSource, serverAssemblies, new object[] { devConfiguration }); return(await serverTask); }
void Application_Startup(object sender, StartupEventArgs e) { /* This causes log4net to initalise. * We need this for the ClientLogging library * to be able to log using log4net. * It triggers reading the config etc. [DV] */ log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo("Log4Net.config")); Log.Info("Client starting."); /* To substitute the unity container with your own, enabling replacement * of the splash screen and shell etc, initialize the ServiceLocatorSingleton as shown. */ //ServiceLocatorSingleton.Instance.InitializeServiceLocator(new UnityContainer()); var starter = new AppStarter(); /* To customize the splash screen image use the StartupOptions as shown below. */ //starter.StartupOptions.SplashImagePackUri = new Uri("pack://application:,,,/YourAssembly;component/YourImage.jpg"); /* To exclude default modules use the ExcludedModules list. */ //starter.StartupOptions.ModuleCatalogOptions.ExcludedModules.Add(ModuleNames.OutputDisplay); //starter.StartupOptions.ModuleCatalogOptions.ExcludedModules.AddRange(ModuleNames.DefaultModuleNames); starter.Start(); }
public static void Main(string[] args) { var appStarter = new AppStarter(); appStarter.Start(); }
public static async Task <int> Main(string[] args) => await AppStarter.CreateAndStartAsync(args).ConfigureAwait(false);
public static Task <int> Main(string[] args) => AppStarter <AgentStartup> .StartAsync(args, EnvironmentVariables.GetEnvironmentVariables().Variables);
public void Test() { var contentRoot = AppStarter.GetContentPath(TestAppFixture.ProjectName); Console.WriteLine($"Content Root: {contentRoot}"); }
protected override void OnStop() { AppStarter.StopTasker(); }
protected override void OnStart(string[] args) { AppStarter.Init(AppMode.WindowsService); AppStarter.StartTasker(); }