/// <summary> /// emit all the documentation comments for an element's documentation child /// (if the element does not have a documentation child emit some standard "missing comments" comment /// </summary> /// <param name="element">the element whose documentation is to be displayed</param> /// <param name="commentCollection">the comment collection of the CodeDom object to be commented</param> public static void EmitSummaryComments(MetadataItem item, CodeCommentStatementCollection commentCollection) { Debug.Assert(item != null, "item parameter is null"); Debug.Assert(commentCollection != null, "commentCollection parameter is null"); Documentation documentation = GetDocumentation(item); string [] summaryComments = null; if (documentation != null && !MetadataUtil.IsNullOrEmptyOrWhiteSpace(documentation.Summary)) { // we have documentation to emit summaryComments = GetFormattedLines(documentation.Summary, true); } else { string summaryComment; // no summary content, so use a default switch (item.BuiltInTypeKind) { case BuiltInTypeKind.EdmProperty: summaryComment = Strings.MissingPropertyDocumentation(((EdmProperty)item).Name); break; case BuiltInTypeKind.ComplexType: summaryComment = Strings.MissingComplexTypeDocumentation(((ComplexType)item).FullName); break; default: { PropertyInfo pi = item.GetType().GetProperty("FullName"); if (pi == null) { pi = item.GetType().GetProperty("Name"); } object value = null; if (pi != null) { value = pi.GetValue(item, null); } if (value != null) { summaryComment = Strings.MissingDocumentation(value.ToString()); } else { summaryComment = Strings.MissingDocumentationNoName; } } break; } summaryComments = new string[] { summaryComment }; } EmitSummaryComments(summaryComments, commentCollection); EmitOtherDocumentationComments(documentation, commentCollection); }
public static object GetEnumMemberValue(MetadataItem enumMember) { Requires <ArgumentNullException> .IsNotNull(enumMember); var valueProperty = enumMember.GetType().GetProperty("Value"); return(valueProperty == null ? null : valueProperty.GetValue(enumMember, null)); }
public static string GetEnumMemberName(MetadataItem enumMember) { Requires <ArgumentNullException> .IsNotNull(enumMember); var nameProperty = enumMember.GetType().GetProperty("Name"); return(nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null)); }
public void StoreMetaDataItem(MetadataItem data) { var folderName = data.ValutaDatum.Year; Directory.CreateDirectory(FolderPath + "\\" + folderName); File.Copy(data.FilePath, FolderPath + "\\" + data.ValutaDatum.Year + "\\" + data.Guid + "_Content" + Path.GetExtension(data.FilePath)); data.NewFilePath = FolderPath + "\\" + data.ValutaDatum.Year + "\\" + data.Guid + "_Content" + Path.GetExtension(data.FilePath); using (var metaFile = File.Create(FolderPath + "\\" + folderName + "\\" + data.Guid + "_Metadata.xml")) { var writer = new XmlSerializer(data.GetType()); writer.Serialize(metaFile, data); } }