private DependencyDefinition ReadDependency(XmlReader reader) { //Move to <Dependency> element MoveToElement(reader, DependencyElementName); //Prepare Dependency properties Guid uid = Guid.Empty; DependencyType dependencyType = DependencyType.Required; //Read Dependency attributes while (reader.MoveToNextAttribute()) { switch (reader.Name) { case UidAttributeName: uid = reader.ReadContentAsGuid(); break; case DependencyTypeAttributeName: dependencyType = reader.ReadContentAsEnum <DependencyType>(); break; } } //Move back to <Export> element reader.MoveToElement(); DependencyDefinition definition = new DependencyDefinition(uid, dependencyType); return(definition); }
private AttachmentDefinition ReadAttachment(XmlReader reader, string baseDirectory) { //Move to <ProfilingType> element MoveToElement(reader, AttachmentElementName); Guid targetUid = Guid.Empty; List <ExportDefinition> exports = new List <ExportDefinition>(); List <DependencyDefinition> dependencies = new List <DependencyDefinition>(); List <AttributeDefinition> attributes = new List <AttributeDefinition>(); //Read Attachment attributes while (reader.MoveToNextAttribute()) { switch (reader.Name) { case AttachmentTargetUidAttributeName: targetUid = reader.ReadContentAsGuid(); break; } } //Move back to <Attachment> element reader.MoveToElement(); //Read <Attachment> element content while (reader.Read()) { if (reader.NodeType == XmlNodeType.EndElement && string.Equals(AttachmentElementName, reader.Name)) { break; } if (reader.NodeType != XmlNodeType.Element) { continue; } switch (reader.Name) { case ExportElementName: ExportDefinition export = ReadExport(reader, baseDirectory); exports.Add(export); break; case DependencyElementName: DependencyDefinition dependency = ReadDependency(reader); dependencies.Add(dependency); break; case AttributeElementName: AttributeDefinition attribute = ReadAttribute(reader); attributes.Add(attribute); break; } } AttachmentDefinition definition = new AttachmentDefinition(targetUid, exports, dependencies, attributes); return(definition); }
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); }