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 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); }