Ejemplo n.º 1
0
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                bgWorker.ReportProgress(1, "Requesting Authenticator Token...");

                AuthAPI.Authenticator newAuthenticator = Settings.SettingsDatabase.SelectedAuthenticator.Clone() as AuthAPI.Authenticator;

                newAuthenticator.Name = authenticatorName;

                if (encryptionType != AuthAPI.Security.EncryptionProvider.EncryptionType.None)
                {
                    bgWorker.ReportProgress(1, "Encrypting Authenticator...");
                }

                newAuthenticator.Encrypt(encryptionType, userPassword);

                bgWorker.ReportProgress(2, "Saving Authenticator to File...");

                newAuthenticator.ToFile(savePath);

                bgWorker.ReportProgress(3, "Authenticator Exported!");

                System.Threading.Thread.Sleep(1000);

                e.Result = true;
            }
            catch (Exception)
            {
                e.Result = false;
            }
        }
Ejemplo n.º 2
0
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (encryptionType != AuthAPI.Security.EncryptionProvider.EncryptionType.None)
                {
                    bgWorker.ReportProgress(0, "Encrypting Authenticator...");
                }

                newAuthenticator.Encrypt(encryptionType, userPassword);
                newAuthenticator.Name = authenticatorName;

                bgWorker.ReportProgress(1, "Adding Authenticator to Database...");

                Settings.SettingsDatabase.Authenticators.Add(newAuthenticator);
                Settings.SettingsDatabase.Save();

                bgWorker.ReportProgress(2, "Authenticator Restored!");

                System.Threading.Thread.Sleep(1000);

                e.Result = true;
            }
            catch (Exception)
            {
                e.Result = false;
            }
        }
Ejemplo n.º 3
0
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                bgWorker.ReportProgress(0, "Requesting Authenticator Token...");

                newAuthenticator = AuthAPI.BlizzardAPI.RequestAuthenticator();

                if (newAuthenticator == null)
                {
                    e.Result = false;
                    return;
                }

                newAuthenticator.Name = authenticatorName;

                if (encryptionType != AuthAPI.Security.EncryptionProvider.EncryptionType.None)
                {
                    bgWorker.ReportProgress(1, "Encrypting Authenticator...");

                    newAuthenticator.Encrypt(encryptionType, userPassword);
                }

                bgWorker.ReportProgress(2, "Adding Authenticator to Database...");

                Settings.SettingsDatabase.Authenticators.Add(newAuthenticator);
                Settings.SettingsDatabase.Save();

                bgWorker.ReportProgress(3, "Authenticator Created!");

                System.Threading.Thread.Sleep(1000);

                e.Result = true;
            }
            catch (Exception)
            {
                e.Result = false;
            }
        }