private static MemberDoc ParseMemberDoc(XElement m) { var newMember = new MemberDoc { Id = m.Attribute("id").Value, Name = m.Element("name").Value, ReturnType = m.Element("type").Value, Description = m.Element("briefdescription").Value, MemberType = m.Attribute("kind").Value == "function" ? MemberType.Function : MemberType.Field, Const = m.Attribute("const") != null && m.Attribute("const").Value == "yes", Args = new List <FunctionArg>() }; if (!string.IsNullOrEmpty(newMember.Description)) { newMember.Description = newMember.Description.Capitalize(); } if (m.Element("type").Element("ref") != null) { newMember.ReturnTypeRefId = m.Element("type").Element("ref").Attribute("refid").Value; } var returnDesc = m.Descendants("simplesect").Where(s => s.Attribute("kind").Value == "return").SingleOrDefault(); if (returnDesc != null) { newMember.ReturnDescription = returnDesc.Value.Capitalize(); } if (newMember.MemberType == MemberType.Function) { foreach (var a in m.Elements("param")) { if (a.Element("type").Value == "void") { continue; } var newArg = new FunctionArg() { Name = a.Element("declname").Value, Type = a.Element("type").Value, Description = string.Empty }; if (a.Element("type").Element("ref") != null) { newArg.TypeRefId = a.Element("type").Element("ref").Attribute("refid").Value; } var parameterItem = m.Descendants("parameteritem").SingleOrDefault(p => p.Descendants("parametername").First().Value == newArg.Name); if (parameterItem != null) { newArg.Description = parameterItem .Element("parameterdescription") .Element("para") .Value.Capitalize(); } newMember.Args.Add(newArg); } } return(newMember); }
private ResultType GetMemberType(MemberDoc member) { switch (member.Kind) { case MemberKind.Class: return(ResultType.Class); case MemberKind.Constant: return(ResultType.Constant); case MemberKind.Delegate: return(ResultType.Delegate); case MemberKind.Enum: return(ResultType.Enum); case MemberKind.EnumMember: return(ResultType.EnumInstance); case MemberKind.Event: return(ResultType.Event); case MemberKind.Field: return(ResultType.Field); case MemberKind.Function: return(ResultType.Function); case MemberKind.Instance: return(ResultType.Instance); case MemberKind.Method: return(ResultType.Method); case MemberKind.Module: return(ResultType.Module); case MemberKind.Namespace: return(ResultType.Namespace); case MemberKind.Property: return(ResultType.Property); default: return(ResultType.Unknown); } }
public void UploadSingleFile(MemberDocDto memberDocDto) { var memberDoc = new MemberDoc() { NameDoc = memberDocDto.NameDoc, Document = memberDocDto.Document, DocumentMimeType = memberDocDto.DocumentMimeType, Description = memberDocDto.Description, MemberId = memberDocDto.MemberId }; _database.MemberDocRepository.Insert(memberDoc); _database.Save(); }
private static MemberDoc _ConvertToMember(MemberInfo memberInfo, XmlDocumentation member, string fileName) { var link = LinkCache.SetLink(memberInfo.GetLinkKey(), (memberInfo.IsStatic() ?? false) ? $"{memberInfo.DeclaringType.Name}.{memberInfo.Name}" : memberInfo.Name, fileName); MarkdownGenerator.UpdateLinkForMember(link, memberInfo); var doc = new MemberDoc { AssociatedMember = memberInfo, MemberType = member.MemberType }; doc.Tags.AddRange(member.Data.Select(_ConvertToTag)); return(doc); }