diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs
index c4eb6ca..7d9c490 100644
--- a/EduNetworkBuilder/NetworkBuilder.cs
+++ b/EduNetworkBuilder/NetworkBuilder.cs
@@ -1743,7 +1743,24 @@ namespace EduNetworkBuilder
}
else if (extension == ".enbu")
{
- CurrentUser = new PersonClass(filename);
+ int counter = 0;
+ PersonClass tUser = null;
+ while (counter < 3)
+ {
+ string tPass = NB.TextPromptBox("Enter a password", Properties.Resources.NBIco, true);
+ string tUserName = Path.GetFileNameWithoutExtension(filename);
+ string PasToUse = tUserName + tPass;
+ tUser = PersonClass.TryLoad(filename, PasToUse);
+ if (tUser != null) break;
+ counter++;
+ }
+ if(tUser == null)
+ {
+ //failed to load.
+ MessageBox.Show("Too many password failures. Exiting.");
+ return;
+ }
+ CurrentUser = tUser;
CurrentUser.filepath = Path.GetDirectoryName(filename); //store the directory
OurSettings = NB.GetSettings(); //Grab the new settings from the user
UpdateMenu();
diff --git a/EduNetworkBuilder/PersonClass.cs b/EduNetworkBuilder/PersonClass.cs
index 88b11a7..d5ef087 100644
--- a/EduNetworkBuilder/PersonClass.cs
+++ b/EduNetworkBuilder/PersonClass.cs
@@ -44,9 +44,8 @@ namespace EduNetworkBuilder
/// Used to determine if the user we are working with is the admin account.
///
public bool isAdmin { get; protected set; }
- ///
- /// EverCompletedPuzzles is a list of puzzles that they have completed once.
- ///
+
+ public string EncryptionPassword { get { return UserName + Password; } }
public List Projects = new List();
@@ -79,7 +78,20 @@ namespace EduNetworkBuilder
{
Load(reader);
}
-
+ ///
+ /// Try to load the specified filename. Return a new person record if it succeeds.
+ /// Return null if it fails to load. (bad password, bad file, etc)
+ ///
+ /// The filename to load
+ /// The password to try
+ ///
+ public static PersonClass TryLoad(string Filename, string password)
+ {
+ PersonClass pc = new PersonClass();
+ if (pc.Load(Filename, password))
+ return pc;
+ return null;
+ }
public void ChangePassword(string NewPassword)
{