Exemplo n.º 1
0
        static App()
        {
            var logLevel = MsixHeroLogLevel.Info;

            ExceptionGuard.Guard(() =>
            {
                var service = new LocalConfigurationService();
                var config  = service.GetCurrentConfiguration();

                logLevel = config.VerboseLogging ? MsixHeroLogLevel.Trace : MsixHeroLogLevel.Info;
            });

            LogManager.Initialize(logLevel);
        }
Exemplo n.º 2
0
        static Program()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskSchedulerOnUnobservedTaskException;

            var logLevel = MsixHeroLogLevel.Info;

            ExceptionGuard.Guard(() =>
            {
                var service = new LocalConfigurationService();
                var config  = service.GetCurrentConfiguration();

                logLevel = config.VerboseLogging ? MsixHeroLogLevel.Trace : MsixHeroLogLevel.Info;
            });

            LogManager.Initialize(logLevel);
        }
Exemplo n.º 3
0
        static async Task <int> Main(string[] args)
        {
            var logLevel = MsixHeroLogLevel.Trace;

            ExceptionGuard.Guard(() =>
            {
                var service = new LocalConfigurationService();
                var config  = service.GetCurrentConfiguration();

                logLevel = config.VerboseLogging ? MsixHeroLogLevel.Trace : MsixHeroLogLevel.Info;
            });

            LogManager.Initialize(logLevel);

            var console = new ConsoleImpl(Console.Out, Console.Error);

            try
            {
                // First argument is the "edit" verb.
                // Second argument is the path of the package.
                if (args.Length > 1 &&
                    string.Equals(args[0], "edit", StringComparison.OrdinalIgnoreCase) &&
                    !args[1].StartsWith("-", StringComparison.OrdinalIgnoreCase))
                {
                    return(await DoEditVerb(args[1], args.Skip(2), console));
                }

                return(await DoCommonVerbs(args, console));
            }
            catch (Exception e)
            {
                await console.WriteError(e.Message).ConfigureAwait(false);

                Environment.ExitCode = 1;
                return(1);
            }
        }