Add_METS_Writing_Profile() public method

Adds a new METS writing profile to this metadata configuration
public Add_METS_Writing_Profile ( METS_Writing_Profile NewProfile ) : void
NewProfile METS_Writing_Profile New metadata profile to add
return void
        private static void read_mets_writing_config(XmlReader ReaderXml, Dictionary<string, METS_Section_ReaderWriter_Config> ReaderWriters, Metadata_Configuration Config )
        {
            bool inPackage = false;
            bool inDivision = false;
            bool inFile = false;
            bool inDmdSec = true;
            METS_Writing_Profile profile = null;
            int unnamed_profile_counter = 1;

            while (ReaderXml.Read())
            {
                if (ReaderXml.NodeType == XmlNodeType.Element)
                {
                    switch (ReaderXml.Name.ToLower())
                    {
                        case "profile":
                            profile = new METS_Writing_Profile();
                            if (ReaderXml.MoveToAttribute("name"))
                                profile.Profile_Name = ReaderXml.Value.Trim();
                            if (ReaderXml.MoveToAttribute("description"))
                                profile.Profile_Description = ReaderXml.Value;
                            if (ReaderXml.MoveToAttribute("isDefault"))
                            {
                                bool tempValue;
                                if (bool.TryParse(ReaderXml.Value, out tempValue))
                                {
                                    profile.Default_Profile = tempValue;
                                }
                            }
                            // Enforce a name for this profile (should have one according to XSD)
                            if (profile.Profile_Name.Length == 0)
                            {
                                profile.Profile_Name = "Unnamed" + unnamed_profile_counter;
                                unnamed_profile_counter++;
                            }
                            // Does this profile already exist?
                            METS_Writing_Profile existingProfile = Config.Get_Writing_Profile(profile.Profile_Name);
                            if (existingProfile != null)
                            {
                                profile = existingProfile;

                            }
                            else
                            {
                                Config.Add_METS_Writing_Profile(profile);
                            }

                            break;

                        case "package_scope":
                            inPackage = true;
                            inDivision = false;
                            inFile = false;
                            break;

                        case "division_scope":
                            inPackage = false;
                            inDivision = true;
                            inFile = false;
                            break;

                        case "file_scope":
                            inPackage = false;
                            inDivision = false;
                            inFile = true;
                            break;

                        case "dmdsec":
                            inDmdSec = true;
                            break;

                        case "amdsec":
                            inDmdSec = false;
                            break;

                        case "readerwriterref":
                            if (ReaderXml.MoveToAttribute("ID"))
                            {
                                string id = ReaderXml.Value.ToUpper();
                                if ((ReaderWriters.ContainsKey(id)) && (profile != null))
                                {
                                    METS_Section_ReaderWriter_Config readerWriter = ReaderWriters[id];
                                    if (inPackage)
                                    {
                                        if (inDmdSec)
                                            profile.Add_Package_Level_DmdSec_Writer_Config(readerWriter);
                                        else
                                            profile.Add_Package_Level_AmdSec_Writer_Config(readerWriter);
                                    }
                                    else if (inDivision)
                                    {
                                        if (inDmdSec)
                                            profile.Add_Division_Level_DmdSec_Writer_Config(readerWriter);
                                        else
                                            profile.Add_Division_Level_AmdSec_Writer_Config(readerWriter);
                                    }
                                    else if (inFile)
                                    {
                                        if (inDmdSec)
                                            profile.Add_File_Level_DmdSec_Writer_Config(readerWriter);
                                        else
                                            profile.Add_File_Level_AmdSec_Writer_Config(readerWriter);
                                    }
                                }
                            }
                            break;
                    }
                }
            }
        }