public static async Task Execute(string[] args) { LogConfigurator.EnableConsoleTarget(LogConfigurator.FriendlyLayout, LogLevel.Info); LogConfigurator.EnableSentryTarget("https://[email protected]/7"); LogConfigurator.EnableFileTarget(LogLevel.Trace); var container = ContainerBuilder.Container; IAppGetUpdateService updatedService = null; try { updatedService = container.Resolve <IAppGetUpdateService>(); updatedService.Start(); var commandExecutor = container.Resolve <ICommandExecutor>(); await commandExecutor.ExecuteCommand(args); } finally { if (updatedService != null) { await updatedService.Commit(); } } }
private static async Task <int> Run(string[] args) { IAppGetUpdateService updatedService = null; try { var container = ContainerBuilder.Container; LogConfigurator.EnableConsoleTarget(LogConfigurator.FriendlyLayout, LogLevel.Info); LogConfigurator.EnableSentryTarget("https://[email protected]/7"); LogConfigurator.EnableFileTarget(LogLevel.Trace); try { updatedService = container.Resolve <IAppGetUpdateService>(); updatedService.Start(); } catch (Exception e) { Logger.Error(e, "Failed to initilize update service."); } if (Debugger.IsAttached && !args.Any()) { args = TakeArgsFromInput().SkipWhile(c => c.ToLowerInvariant() == "appget").ToArray(); } var commandExecutor = container.Resolve <ICommandExecutor>(); await commandExecutor.ExecuteCommand(args); return(0); } catch (CommandLineParserException) { return(1); } catch (PackageNotFoundException e) { Logger.Warn(e.Message); if (e.Similar.Any()) { Console.WriteLine(""); Console.WriteLine("Suggestions:"); e.Similar.ShowTable(); } return(1); } catch (AppGetException ex) { Logger.Error(ex, null); return(1); } catch (NotImplementedException ex) { Logger.Error(ex, null); return(1); } catch (Exception ex) { Logger.Fatal(ex, null); return(1); } finally { if (updatedService != null) { await updatedService.Commit(); } } }
public CaliburnBootstrapper() { Initialize(); LogConfigurator.EnableSentryTarget("https://[email protected]/7"); LogConfigurator.EnableFileTarget(LogLevel.Trace); }