/// <summary> /// Get Password List from file or from github. If downloaded from github it will save that new list to file /// </summary> /// <param name="redownload">Wheter or not to redownload the list from github</param> /// <returns></returns> public static List <string> GetPasswords(bool redownload = false) { Log.Output("Getting password list..."); JetPassword jet = new JetPassword(); List <string> passwords = new List <string>(); if (!jet.PasswordsFileExist() || redownload) { passwords = jet.CreatePasswordsList(); } else { passwords = jet.CreatePasswordsList(File.ReadAllText(jet.passwordsFilePath)); } JetPasswordEventArgs args = new JetPasswordEventArgs(); args.PasswordList = passwords; if (passwords != null && passwords.Count > 0) { jet.OnPasswordListAquired(args); } else { jet.OnFailedToAquirePasswordList(args); } return(passwords); }
/// <summary> /// Fired when the password list failed to be aquired. Passes password list as arg /// </summary> /// <param name="e">JetPasswordEvetnArgs takes the failed password list as an argument</param> public void OnFailedToAquirePasswordList(JetPasswordEventArgs e) { EventHandler <JetPasswordEventArgs> handler = FailedToAquirePasswordList; if (handler != null) { handler(this, e); } }
/// <summary> /// Fired when the password list was successfully aquired. Passes password list as arg /// </summary> /// <param name="e">JetPasswordEvetnArgs takes the aquired password list as an argument</param> public void OnPasswordListAquired(JetPasswordEventArgs e) { EventHandler <JetPasswordEventArgs> handler = AquiredPasswordList; if (handler != null) { handler(this, e); } }