private ApplicationExtensionDefinition ReadApplicationExtension(XmlReader reader, string baseDirectory)
        {
            //Move to <ApplicationExtension> element
            MoveToElement(reader, ApplicationExtensionElementName);

            //Prepare ApplicationExtension properties
            Guid uid = Guid.Empty;
            List <ExportDefinition>       exports       = new List <ExportDefinition>();
            List <LocalizationDefinition> localizations = new List <LocalizationDefinition>();
            List <AttributeDefinition>    attributes    = new List <AttributeDefinition>();

            //Read ApplicationExtension attributes
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case UidAttributeName:
                    uid = reader.ReadContentAsGuid();
                    break;
                }
            }

            //Move back to <ApplicationExtension> element
            reader.MoveToElement();

            //Read <ApplicationExtension> element content
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement &&
                    string.Equals(ApplicationExtensionElementName, reader.Name))
                {
                    break;
                }
                if (reader.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (reader.Name)
                {
                case ExportElementName:
                    ExportDefinition export = ReadExport(reader, baseDirectory);
                    exports.Add(export);
                    break;

                case LocalizationElementName:
                    LocalizationDefinition localization = ReadLocalization(reader);
                    localizations.Add(localization);
                    break;

                case AttributeElementName:
                    AttributeDefinition attribute = ReadAttribute(reader);
                    attributes.Add(attribute);
                    break;
                }
            }

            ApplicationExtensionDefinition definition = new ApplicationExtensionDefinition(uid, exports, localizations, attributes);

            return(definition);
        }
        private LocalizationDefinition ReadLocalization(XmlReader reader)
        {
            //Move to <Localization> element
            MoveToElement(reader, LocalizationElementName);

            //Prepare Localization properties
            CultureInfo cultureInfo = CultureInfo.InvariantCulture;
            string      name        = string.Empty;
            string      description = string.Empty;
            string      iconUri     = null;

            //Read Localization attributes
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case CultureAttributeName:
                    cultureInfo = reader.ReadContentAsCultureInfo();
                    break;

                case IconUriAttributeName:
                    iconUri = reader.ReadContentAsString();
                    break;
                }
            }

            //Move back to <Localization> element
            reader.MoveToElement();

            //Read <Localization> element content
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement &&
                    string.Equals(LocalizationElementName, reader.Name))
                {
                    break;
                }
                if (reader.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (reader.Name)
                {
                case NameElementName:
                    name = reader.ReadElementContentAsString();
                    break;

                case DescriptionElementName:
                    description = reader.ReadElementContentAsString();
                    break;
                }
            }

            LocalizationDefinition definition = new LocalizationDefinition(cultureInfo, name, description, iconUri);

            return(definition);
        }
        private ExtensionDefinition ReadExtension(XmlReader reader, string baseDirectory)
        {
            //Move to <Extension> element
            MoveToElement(reader, ExtensionElementName);

            //Prepare Extension properties
            Guid uid = Guid.Empty;
            List <ProfilingTypeDefinition>        profilingTypes        = new List <ProfilingTypeDefinition>();
            List <ProfilingTargetDefinition>      profilingTargets      = new List <ProfilingTargetDefinition>();
            List <FrameworkDefinition>            frameworks            = new List <FrameworkDefinition>();
            List <ProductivityDefinition>         productivities        = new List <ProductivityDefinition>();
            List <ApplicationExtensionDefinition> applicationExtensions = new List <ApplicationExtensionDefinition>();
            List <LocalizationDefinition>         localizations         = new List <LocalizationDefinition>();
            List <AttachmentDefinition>           attachments           = new List <AttachmentDefinition>();

            //Read Extension attributes
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case UidAttributeName:
                    uid = reader.ReadContentAsGuid();
                    break;
                }
            }

            //Move back to <Extension> element
            reader.MoveToElement();

            //Read <Extension> element content
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement &&
                    string.Equals(ExtensionElementName, reader.Name))
                {
                    break;
                }
                if (reader.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (reader.Name)
                {
                case ProfilingTypeElementName:
                    ProfilingTypeDefinition profilingType = ReadProfilingType(reader, baseDirectory);
                    profilingTypes.Add(profilingType);
                    break;

                case ProfilingTargetElementName:
                    ProfilingTargetDefinition profilingTarget = ReadProfilingTarget(reader, baseDirectory);
                    profilingTargets.Add(profilingTarget);
                    break;

                case FrameworkElementName:
                    FrameworkDefinition framework = ReadFramework(reader, baseDirectory);
                    frameworks.Add(framework);
                    break;

                case ProductivityElementName:
                    ProductivityDefinition productivity = ReadProductivity(reader, baseDirectory);
                    productivities.Add(productivity);
                    break;

                case ApplicationExtensionElementName:
                    ApplicationExtensionDefinition applicationExtension = ReadApplicationExtension(reader, baseDirectory);
                    applicationExtensions.Add(applicationExtension);
                    break;

                case LocalizationElementName:
                    LocalizationDefinition localization = ReadLocalization(reader);
                    localizations.Add(localization);
                    break;

                case AttachmentElementName:
                    AttachmentDefinition attachment = ReadAttachment(reader, baseDirectory);
                    attachments.Add(attachment);
                    break;
                }
            }
            ExtensionDefinition extensionDefinition = new ExtensionDefinition(uid, baseDirectory, profilingTypes, profilingTargets, frameworks, productivities, applicationExtensions, attachments, localizations);

            return(extensionDefinition);
        }
        private ProductivityDefinition ReadProductivity(XmlReader reader, string baseDirectory)
        {
            //Move to <Productivity> element
            MoveToElement(reader, ProductivityElementName);

            //Prepare Productivity properties
            Guid uid = Guid.Empty;
            Guid profilingTypeUid = Guid.Empty;
            List <ExportDefinition>       exports       = new List <ExportDefinition>();
            List <LocalizationDefinition> localizations = new List <LocalizationDefinition>();
            List <AttributeDefinition>    attributes    = new List <AttributeDefinition>();
            List <DependencyDefinition>   dependencies  = new List <DependencyDefinition>();

            //Read Productivity attributes
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case UidAttributeName:
                    uid = reader.ReadContentAsGuid();
                    break;

                case ProfilingTypeUidAttributeName:
                    profilingTypeUid = reader.ReadContentAsGuid();
                    break;
                }
            }

            //Move back to <Productivity> element
            reader.MoveToElement();

            //Read <Productivity> element content
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement &&
                    string.Equals(ProductivityElementName, reader.Name))
                {
                    break;
                }
                if (reader.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (reader.Name)
                {
                case ExportElementName:
                    ExportDefinition export = ReadExport(reader, baseDirectory);
                    exports.Add(export);
                    break;

                case LocalizationElementName:
                    LocalizationDefinition localization = ReadLocalization(reader);
                    localizations.Add(localization);
                    break;

                case AttributeElementName:
                    AttributeDefinition attribute = ReadAttribute(reader);
                    attributes.Add(attribute);
                    break;

                case DependencyElementName:
                    DependencyDefinition dependency = ReadDependency(reader);
                    dependencies.Add(dependency);
                    break;
                }
            }

            ProductivityDefinition definition = new ProductivityDefinition(uid, exports, dependencies, localizations, attributes);

            return(definition);
        }