public NewProfileForm()
 {
     InitializeComponent();
     newProfile         = null;
     Phrase             = Database.GeneratePhrase();
     phraseTextBox.Text = Phrase;
 }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(profileNameInput.Text) && !string.IsNullOrEmpty(profilePasswordInput.Text))
     {
         if (!string.IsNullOrEmpty(phraseInput.Text))
         {
             bool real        = true;
             var  profileName = profileNameInput.Text;
             if (!Database.IsProfile(profileName))
             {
                 var           profilePassword = profilePasswordInput.Text;
                 var           phrase          = phraseInput.Text.ToLower();
                 string[]      words           = phrase.Split(' ');
                 List <string> wordlist        = Properties.Resources.wordlist.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
                 if (words.Length != 12)
                 {
                     real = false;
                 }
                 foreach (string word in words)
                 {
                     if (!wordlist.Contains(word))
                     {
                         real = false;
                     }
                 }
                 if (real)
                 {
                     newDBProfile = Database.CreateProfile(profileName, profilePassword, phrase);
                     MessageBox.Show("Imported profile");
                     Close();
                 }
                 else
                 {
                     MessageBox.Show("That is not a valid phrase");
                 }
             }
             else
             {
                 MessageBox.Show("A profile by that name already exists.");
             }
         }
         else
         {
             MessageBox.Show("You must input a phrase.");
         }
     }
     else
     {
         MessageBox.Show("You must enter a profile name and password. These do not need to be the original profile name and password.");
     }
 }
 private void createButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(phraseConfirmTextBox.Text))
     {
         if (phraseConfirmTextBox.Text == Phrase)
         {
             newProfile = Database.CreateProfile(ProfileName, ProfilePassword, Phrase);
             MessageBox.Show("Created profile");
             Close();
         }
         else
         {
             MessageBox.Show("You entered an invalid phrase");
             tabControl1.SelectTab(tabPage3);
         }
     }
     else
     {
         MessageBox.Show("You must input a phrase");
     }
 }
Esempio n. 4
0
 public Profile(Database.DBProfile dbProfile)
 {
     _dbProfile  = dbProfile;
     ProfileName = _dbProfile.Name;
 }