예제 #1
0
        public async void CheckPassword(string password, bool async)
        {
            Dictionary <string, string> passwords;
            string passwordHash        = PwndAPI.GetPasswordHash(password);
            string passwordOccurrences = string.Empty;

            if (async)
            {
                passwords = await PwndAPI.GetPwndPasswordsAsync(passwordHash).ConfigureAwait(false);
            }
            else
            {
                passwords = PwndAPI.GetPwndPasswords(passwordHash);
            }

            PasswordMatch       = passwords.TryGetValue(passwordHash.Substring(5), out passwordOccurrences);
            PasswordOccurrences = string.IsNullOrWhiteSpace(passwordOccurrences) ? "0" : passwordOccurrences;
        }
예제 #2
0
        public async void GetBreaches(string accountName, bool async)
        {
            List <Breach> breaches;

            if (async)
            {
                breaches = await PwndAPI.GetBreachesAsync(accountName).ConfigureAwait(false);
            }
            else
            {
                breaches = PwndAPI.GetBreaches(accountName);
            }

            Breaches.Clear();

            foreach (Breach breach in breaches)
            {
                Breaches.Add(breach);
            }
        }