Beispiel #1
0
        /// <summary>
        /// Handles the login logic
        /// </summary>
        /// <param name="appSettings">The startup settings</param>
        /// <returns>The loginResult</returns>
        public static async Task <LoginResult> Login(AppSettings appSettings)
        {
            Console.WriteLine("...Login...");

            var         timer = new ExecutionTimer(true);
            LoginResult loginResult;

            try
            {
                if (RunModeHandler.IsDebugMode())
                {
                    bool fastLogin = bool.Parse(appSettings.GetByKey(AppSetting.FastLogin));
                    if (fastLogin)
                    {
                        loginResult = await FastLogin();
                    }
                    else
                    {
                        loginResult = await BitwardenUIAuthManager.Login();
                    }
                }
                else
                {
                    loginResult = await BitwardenUIAuthManager.Login();
                }

                return(loginResult);
            }
            finally
            {
                timer.StopAndWrite();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Checks the installations of the required packages (bitwarden, npm)
        /// </summary>
        /// <returns></returns>
        private static async Task CheckInstallations(AppSettings appSettings)
        {
            bool checkInstallations = bool.Parse(appSettings.GetByKey(AppSetting.CheckInstallations));

            if (!checkInstallations)
            {
                return;
            }

            var timer = new ExecutionTimer(true);
            var installationSuccess = await InstallationManager.CheckInstallations();

            timer.StopAndWrite();
            if (!installationSuccess.Sucess)
            {
                throw new ArgumentException($"The Installation of the following software failed: {installationSuccess}");
            }
        }
Beispiel #3
0
        public static async void Startup(AppSettings appSettings)
        {
            Console.WriteLine($"****** Startup begin ******");
            var timer = new ExecutionTimer(true);

            try
            {
                await RunStartup(appSettings);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Environment.Exit(1);
            }
            finally
            {
                timer.StopAndWrite();
                Console.WriteLine($"****** Startup ending ******");
            }
        }