示例#1
0
        /// <summary>
        /// Construct a Profiles Database object by reading in all the Profiles from the CA directory
        /// Convert to a display-friendly format
        /// </summary>
        /// <param name="ProfilesLocation">Pathname of folder containg the profiles</param>
        public profileDB(string ProfilesLocation)
        {
            profiles = new List <ProfileDb>();

            string[] files = Directory.GetFiles(ProfilesLocation, "*.xml");

            foreach (string file in files)
            {
                XDocument profile = XDocument.Load(file);

                IEnumerable <XElement> records;

                // Ignore .xml files that are not profiles
                if (extensions.GetStringFromChildElement(profile.Element("OSCA"), "Profile") == "")
                {
                    continue;
                }

                records = profile.Element("OSCA").Descendants("Profile");
                if (records.Count() != 0)
                {
                    ProfileDb entry = new ProfileDb();
                    entry.profile = new Profile(profile);
                    entry.file    = file;
                    profiles.Add(entry);
                }
            }
        }
示例#2
0
 public void RemoveProfile(ProfileDb entry)
 {
     File.Delete(entry.file);
     profiles.Remove(entry);
 }
示例#3
0
 public void AddProfile(ProfileDb newEntry)
 {
     profiles.Add(newEntry);
 }
示例#4
0
 public void Remove(ProfileDb entry)
 {
     profiles.Remove(entry);
 }