private Profile createProfile(JObject json)
 {
     Profile profile = new Profile();
     for (int i = 0; i < Profile.NUM_PASSWORDS; i++)
     {
         int passwordNum = i + 1;
         String query = "pw" + passwordNum;
         JToken passwordTest = json.SelectToken(query);
         TestField testField = parseTestField(passwordTest);
         profile.passwordFields[i] = testField;
     }
     profile.textField = parseTestField(json.SelectToken("text"));
     return profile;
 }
        public bool loadProfile(String name)
        {
            Profile profile;

            if (profiles.TryGetValue(name, out profile))
            {
                if (profile == null)
                {
                    String line;
                    using (StreamReader sr = new StreamReader(profileDir + name + profileSuffix))
                    {
                        line = sr.ReadToEnd();
                    }
                    JObject json;
                    json = JObject.Parse(line);
                    profile = createProfile(json);
                    profiles[name] = profile;
                }
                currentProfile = profile;
                return true;
            }
            else
            {
                return false; // Name was not in the dictionary
            }
        }