/// <summary> Remove a division type from this profile </summary>
 /// <param name="Division_Config"> Division type to remove </param>
 public void Remove_Division_Type( QualityControl_Division_Config Division_Config )
 {
     divisionTypes.Remove(Division_Config);
     divisionTypeLookup.Remove(Division_Config.TypeName);
 }
        private static void read_qc_profiles(XmlReader readerXml)
        {
            bool inPackage = false;
            bool inDivision = false;
            bool inFile = false;
            bool inDmdSec = true;
            QualityControl_Profile profile = null;
            int unnamed_profile_counter = 1;

            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    switch (readerXml.Name.ToLower())
                    {
                        case "profile":
                            profile = new QualityControl_Profile();
                            XmlReader child_readerXml = readerXml.ReadSubtree();
                            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++;
                            }

                            while (child_readerXml.Read())
                            {
                                if (child_readerXml.NodeType == XmlNodeType.Element && child_readerXml.Name.ToLower() == "divisiontype")

                                    //  while (readerXml.ReadToNextSibling("DivisionType"))
                                {
                                    if (child_readerXml.Name.ToLower() == "divisiontype")
                                    {
                                        QualityControl_Division_Config thisConfig = new QualityControl_Division_Config();
                                        if (child_readerXml.MoveToAttribute("type"))
                                        {
                                            thisConfig.TypeName = child_readerXml.Value;
                                        }
                                        if (child_readerXml.MoveToAttribute("isNameable"))
                                            thisConfig.isNameable = Convert.ToBoolean(child_readerXml.Value);
                                        profile.Add_Division_Type(thisConfig);

                                    }
                                }
                            }
                            Add_Profile(profile);
                   //         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;
                    }
                }
            }
        }
 /// <summary> Add a new division type to this profile </summary>
 /// <param name="Division_Config"> New division type to add </param>
 public void Add_Division_Type(QualityControl_Division_Config Division_Config )
 {
     divisionTypes.Add(Division_Config);
     divisionTypeLookup[Division_Config.TypeName] = Division_Config;
 }
 /// <summary> Remove a division type from this profile </summary>
 /// <param name="Division_Config"> Division type to remove </param>
 public void Remove_Division_Type( QualityControl_Division_Config Division_Config )
 {
     divisionTypes.Remove(Division_Config);
 }
        // Set the default profile with the default values
        public static void Set_Default_Values()
        {
            // Clear everything, just in case
            Clear();

            // Create the default profile
            QualityControl_Profile newProfile = new QualityControl_Profile();
            newProfile.Default_Profile = true;
            newProfile.Profile_Name = "System Default";
            newProfile.Profile_Description = "Default profile used when no config file is present";
            Add_Profile(newProfile);

            // Add back cover
            QualityControl_Division_Config div1 = new QualityControl_Division_Config();
            div1.ID = 1;
            div1.TypeName = "Back Cover";
            div1.isActive = true;
            div1.isNameable = false;
            div1.BaseTypeName = "Cover";
            div1.Add_Translation(Web_Language_Enum.Spanish, "Portada Posterior");
            div1.Add_Translation(Web_Language_Enum.French, "Couverture Arrière");
            newProfile.Add_Division_Type(div1);

            // Add back matter
            QualityControl_Division_Config div2 = new QualityControl_Division_Config();
            div2.ID = 2;
            div2.TypeName = "Back Matter";
            div2.isActive = true;
            div2.isNameable = false;
            div2.Add_Translation(Web_Language_Enum.Spanish, "Materia Posterior");
            div2.Add_Translation(Web_Language_Enum.French, "Matière Arrière");
            newProfile.Add_Division_Type(div2);

            // Add chapter ( misorder of the object names here and below matters not)
            QualityControl_Division_Config div4 = new QualityControl_Division_Config();
            div4.ID = 3;
            div4.TypeName = "Chapter";
            div4.isActive = true;
            div4.isNameable = true;
            div4.Add_Translation(Web_Language_Enum.Spanish, "Capítulo");
            div4.Add_Translation(Web_Language_Enum.French, "Chapitre");
            newProfile.Add_Division_Type(div4);

            // Add front cover
            QualityControl_Division_Config div3 = new QualityControl_Division_Config();
            div3.ID = 4;
            div3.TypeName = "Front Cover";
            div3.isActive = true;
            div3.isNameable = false;
            div3.BaseTypeName = "Cover";
            div3.Add_Translation(Web_Language_Enum.Spanish, "Portada Delantera");
            div3.Add_Translation(Web_Language_Enum.French, "Couverture Frente");
            newProfile.Add_Division_Type(div3);

            // Add front matter
            QualityControl_Division_Config div5 = new QualityControl_Division_Config();
            div5.ID = 5;
            div5.TypeName = "Front Matter";
            div5.isActive = true;
            div5.isNameable = false;
            div5.Add_Translation(Web_Language_Enum.Spanish, "Materia Delantera");
            div5.Add_Translation(Web_Language_Enum.French, "Préliminaires");
            newProfile.Add_Division_Type(div5);

            // Add index
            QualityControl_Division_Config div6 = new QualityControl_Division_Config();
            div6.ID = 6;
            div6.TypeName = "Index";
            div6.isActive = true;
            div6.isNameable = true;
            div6.Add_Translation(Web_Language_Enum.Spanish, "Indice");
            div6.Add_Translation(Web_Language_Enum.French, "Indice");
            newProfile.Add_Division_Type(div6);

            // Add introduction
            QualityControl_Division_Config div7 = new QualityControl_Division_Config();
            div7.ID = 7;
            div7.TypeName = "Introduction";
            div7.isActive = true;
            div7.isNameable = false;
            div7.BaseTypeName = "Chapter";
            div7.Add_Translation(Web_Language_Enum.Spanish, "Introducción");
            div7.Add_Translation(Web_Language_Enum.French, "Introduction");
            newProfile.Add_Division_Type(div7);

            // Add spine
            QualityControl_Division_Config div8 = new QualityControl_Division_Config();
            div8.ID = 8;
            div8.TypeName = "Spine";
            div8.isActive = true;
            div8.isNameable = false;
            div8.Add_Translation(Web_Language_Enum.Spanish, "Canto");
            div8.Add_Translation(Web_Language_Enum.French, "Épine de livre");
            newProfile.Add_Division_Type(div8);

            // Add table of contents
            QualityControl_Division_Config div9 = new QualityControl_Division_Config();
            div9.ID = 9;
            div9.TypeName = "Table of Contents";
            div9.isActive = true;
            div9.isNameable = false;
            div9.BaseTypeName = "Contents";
            div9.Add_Translation(Web_Language_Enum.Spanish, "Contenidos");
            div9.Add_Translation(Web_Language_Enum.French, "Table des Matières");
            newProfile.Add_Division_Type(div9);

            // Add title page
            QualityControl_Division_Config div10 = new QualityControl_Division_Config();
            div10.ID = 10;
            div10.TypeName = "Title Page";
            div10.isActive = true;
            div10.isNameable = false;
            div10.BaseTypeName = "Title";
            div10.Add_Translation(Web_Language_Enum.Spanish, "Titre");
            div10.Add_Translation(Web_Language_Enum.French, "Titulario");
            newProfile.Add_Division_Type(div10);
        }
        // Set the default profile with the default values
        public static void Set_Default_Values()
        {
            // Clear everything, just in case
            Clear();

            // Create the default profile
            QualityControl_Profile newProfile = new QualityControl_Profile();

            newProfile.Default_Profile     = true;
            newProfile.Profile_Name        = "System Default";
            newProfile.Profile_Description = "Default profile used when no config file is present";
            Add_Profile(newProfile);

            // Add back cover
            QualityControl_Division_Config div1 = new QualityControl_Division_Config();

            div1.ID           = 1;
            div1.TypeName     = "Back Cover";
            div1.isActive     = true;
            div1.isNameable   = false;
            div1.BaseTypeName = "Cover";
            div1.Add_Translation(Web_Language_Enum.Spanish, "Portada Posterior");
            div1.Add_Translation(Web_Language_Enum.French, "Couverture Arrière");
            newProfile.Add_Division_Type(div1);

            // Add back matter
            QualityControl_Division_Config div2 = new QualityControl_Division_Config();

            div2.ID         = 2;
            div2.TypeName   = "Back Matter";
            div2.isActive   = true;
            div2.isNameable = false;
            div2.Add_Translation(Web_Language_Enum.Spanish, "Materia Posterior");
            div2.Add_Translation(Web_Language_Enum.French, "Matière Arrière");
            newProfile.Add_Division_Type(div2);

            // Add chapter ( misorder of the object names here and below matters not)
            QualityControl_Division_Config div4 = new QualityControl_Division_Config();

            div4.ID         = 3;
            div4.TypeName   = "Chapter";
            div4.isActive   = true;
            div4.isNameable = true;
            div4.Add_Translation(Web_Language_Enum.Spanish, "Capítulo");
            div4.Add_Translation(Web_Language_Enum.French, "Chapitre");
            newProfile.Add_Division_Type(div4);

            // Add front cover
            QualityControl_Division_Config div3 = new QualityControl_Division_Config();

            div3.ID           = 4;
            div3.TypeName     = "Front Cover";
            div3.isActive     = true;
            div3.isNameable   = false;
            div3.BaseTypeName = "Cover";
            div3.Add_Translation(Web_Language_Enum.Spanish, "Portada Delantera");
            div3.Add_Translation(Web_Language_Enum.French, "Couverture Frente");
            newProfile.Add_Division_Type(div3);

            // Add front matter
            QualityControl_Division_Config div5 = new QualityControl_Division_Config();

            div5.ID         = 5;
            div5.TypeName   = "Front Matter";
            div5.isActive   = true;
            div5.isNameable = false;
            div5.Add_Translation(Web_Language_Enum.Spanish, "Materia Delantera");
            div5.Add_Translation(Web_Language_Enum.French, "Préliminaires");
            newProfile.Add_Division_Type(div5);

            // Add index
            QualityControl_Division_Config div6 = new QualityControl_Division_Config();

            div6.ID         = 6;
            div6.TypeName   = "Index";
            div6.isActive   = true;
            div6.isNameable = true;
            div6.Add_Translation(Web_Language_Enum.Spanish, "Indice");
            div6.Add_Translation(Web_Language_Enum.French, "Indice");
            newProfile.Add_Division_Type(div6);

            // Add introduction
            QualityControl_Division_Config div7 = new QualityControl_Division_Config();

            div7.ID           = 7;
            div7.TypeName     = "Introduction";
            div7.isActive     = true;
            div7.isNameable   = false;
            div7.BaseTypeName = "Chapter";
            div7.Add_Translation(Web_Language_Enum.Spanish, "Introducción");
            div7.Add_Translation(Web_Language_Enum.French, "Introduction");
            newProfile.Add_Division_Type(div7);

            // Add spine
            QualityControl_Division_Config div8 = new QualityControl_Division_Config();

            div8.ID         = 8;
            div8.TypeName   = "Spine";
            div8.isActive   = true;
            div8.isNameable = false;
            div8.Add_Translation(Web_Language_Enum.Spanish, "Canto");
            div8.Add_Translation(Web_Language_Enum.French, "Épine de livre");
            newProfile.Add_Division_Type(div8);

            // Add table of contents
            QualityControl_Division_Config div9 = new QualityControl_Division_Config();

            div9.ID           = 9;
            div9.TypeName     = "Table of Contents";
            div9.isActive     = true;
            div9.isNameable   = false;
            div9.BaseTypeName = "Contents";
            div9.Add_Translation(Web_Language_Enum.Spanish, "Contenidos");
            div9.Add_Translation(Web_Language_Enum.French, "Table des Matières");
            newProfile.Add_Division_Type(div9);

            // Add title page
            QualityControl_Division_Config div10 = new QualityControl_Division_Config();

            div10.ID           = 10;
            div10.TypeName     = "Title Page";
            div10.isActive     = true;
            div10.isNameable   = false;
            div10.BaseTypeName = "Title";
            div10.Add_Translation(Web_Language_Enum.Spanish, "Titre");
            div10.Add_Translation(Web_Language_Enum.French, "Titulario");
            newProfile.Add_Division_Type(div10);
        }
 /// <summary> Add a new division type to this profile </summary>
 /// <param name="Division_Config"> New division type to add </param>
 public void Add_Division_Type(QualityControl_Division_Config Division_Config )
 {
     divisionTypes.Add(Division_Config);
 }
 /// <summary> Remove a division type from this profile </summary>
 /// <param name="Division_Config"> Division type to remove </param>
 public void Remove_Division_Type(QualityControl_Division_Config Division_Config)
 {
     divisionTypes.Remove(Division_Config);
 }
 /// <summary> Add a new division type to this profile </summary>
 /// <param name="Division_Config"> New division type to add </param>
 public void Add_Division_Type(QualityControl_Division_Config Division_Config)
 {
     divisionTypes.Add(Division_Config);
 }
Ejemplo n.º 10
0
 /// <summary> Remove a division type from this profile </summary>
 /// <param name="Division_Config"> Division type to remove </param>
 public void Remove_Division_Type(QualityControl_Division_Config Division_Config)
 {
     divisionTypes.Remove(Division_Config);
     divisionTypeLookup.Remove(Division_Config.TypeName);
 }
Ejemplo n.º 11
0
 /// <summary> Add a new division type to this profile </summary>
 /// <param name="Division_Config"> New division type to add </param>
 public void Add_Division_Type(QualityControl_Division_Config Division_Config)
 {
     divisionTypes.Add(Division_Config);
     divisionTypeLookup[Division_Config.TypeName] = Division_Config;
 }
Ejemplo n.º 12
0
        private static void read_qc_profiles(XmlReader readerXml)
        {
            bool inPackage  = false;
            bool inDivision = false;
            bool inFile     = false;
            bool inDmdSec   = true;
            QualityControl_Profile profile = null;
            int unnamed_profile_counter    = 1;

            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    switch (readerXml.Name.ToLower())
                    {
                    case "profile":
                        profile = new QualityControl_Profile();
                        XmlReader child_readerXml = readerXml.ReadSubtree();
                        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++;
                        }



                        while (child_readerXml.Read())
                        {
                            if (child_readerXml.NodeType == XmlNodeType.Element && child_readerXml.Name.ToLower() == "divisiontype")

                            //  while (readerXml.ReadToNextSibling("DivisionType"))
                            {
                                if (child_readerXml.Name.ToLower() == "divisiontype")
                                {
                                    QualityControl_Division_Config thisConfig = new QualityControl_Division_Config();
                                    if (child_readerXml.MoveToAttribute("type"))
                                    {
                                        thisConfig.TypeName = child_readerXml.Value;
                                    }
                                    if (child_readerXml.MoveToAttribute("isNameable"))
                                    {
                                        thisConfig.isNameable = Convert.ToBoolean(child_readerXml.Value);
                                    }
                                    profile.Add_Division_Type(thisConfig);
                                }
                            }
                        }
                        Add_Profile(profile);
                        //         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;
                    }
                }
            }
        }