public ControllerForUser(BootstrapperContext bootstrapper)
        {
            if (bootstrapper == null)
            {
                throw new ArgumentNullException(nameof(bootstrapper));
            }

            _bootstrapper = bootstrapper;
        }
        public ControllerForWebApp(BootstrapperContext bootstrapper)
        {
            if (bootstrapper == null)
            {
                throw new ArgumentNullException(nameof(bootstrapper));
            }

            _bootstrapper = bootstrapper;

            _packageManager = new GitHubPackageManager(_bootstrapper.UserAgent);
            _storageManager = new EngineStorageManager(_bootstrapper.Environment);
            _engineHost     = new EngineHost(_bootstrapper);
        }
Exemplo n.º 3
0
        static int Main(string[] args)
        {
            try
            {
                // Initializing the bootstrapper context and retrieving information
                // about the execution environment
                var context = new BootstrapperContext();

                IController controller;

                // The app behaves differently depending on the environment it was executed
                if (context.IsKuduEnvironment)
                {
                    // Azure Web App instance
                    controller = new ControllerForWebApp(context);
                }
                else
                {
                    // User's machine
                    controller = new ControllerForUser(context);
                }

                return(controller.Run().Result);
            }
            catch (BootstrapperException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Error.WriteLine("Error: " + ex.Message);
                Console.ResetColor();
                return((int)ExitCode.GeneralFailure);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Error.WriteLine(ex);
                Console.ResetColor();
                return((int)ExitCode.GeneralFailure);
            }
        }