public void TopicParserParseAssemblyTest() { var assemblyFile = @"C:\projects2010\Westwind.Utilities\Westwind.Utilities\bin\Release\net46\Westwind.Utilities.dll"; var proj = DocProjectManager.Current.LoadProject(TestConfiguration.Current.Paths .projectMarkdownMonsterHelpFile); var topic = new DocTopic(proj) { Title = "Class Reference", DisplayType = "header", }; topic.CreateRelativeSlugAndLink(topic); topic.Body = "Class Reference for " + assemblyFile; proj.Topics.Add(topic); topic.SaveTopicFile(); var parser = new DocHound.Importer.TypeTopicParser(proj, topic) { NoInheritedMembers = true, ClassesToImport = null }; parser.ParseAssembly(assemblyFile, topic, true); proj.SaveProject(); }
void UpdateMovedTopic(DocTopic topic) { // TODO: Get latest changes from Editor var editorTopic = Model.MarkdownMonsterModel.ActiveEditor?.Properties[Constants.EditorPropertyNames.KavaDocsTopic] as DocTopic; if (editorTopic == topic) { topic.Body = Model.MarkdownMonsterModel.ActiveEditor.GetMarkdown(); } else { // TODO: Check if the topic is open in another tab var tab = Model.MarkdownMonsterModel.Window.GetTabFromFilename(topic.GetTopicFileName()); if (tab != null) { topic = (tab.Tag as MarkdownDocumentEditor)?.Properties[Constants.EditorPropertyNames.KavaDocsTopic] as DocTopic; if (topic != null) { topic.Body = Model.MarkdownMonsterModel.ActiveEditor.GetMarkdown(); } } else { topic.LoadTopicFile(); // get latest from disk } } // delete the old file topic.DeleteTopicFile(); // delete in old location // create new link and slug topic.CreateRelativeSlugAndLink(); topic.SaveTopicFile(); // write in new location }
public DocTopic ParseProperty(ObjectProperty property, DocTopic parentClassTopic) { var topic = new DocTopic(_project) { Title = parentClassTopic.ClassInfo.Classname + "." + property.Name, //ListTitle = property.Name, DisplayType = "classproperty", ClassInfo = new ClassInfo { MemberName = property.Name, Signature = property.Signature, Scope = property.Scope, IsStatic = property.Static, Syntax = property.Syntax }, Remarks = property.Remarks, Example = property.Example, SeeAlso = property.SeeAlso, Parent = parentClassTopic, ParentId = parentClassTopic?.Id }; topic.Parent = parentClassTopic; topic.CreateRelativeSlugAndLink(topic); topic.Body = property.HelpText; return(topic); }
public DocTopic ParseClass(DotnetObject obj, DocTopic parentTopic) { var topic = new DocTopic(_project) { Title = $"{obj.FormattedName} Class", //ListTitle = obj.FormattedName, DisplayType = "classheader", ClassInfo = new ClassInfo { MemberName = obj.Name, Signature = obj.Signature, RawSignature = obj.RawTypeName, Namespace = obj.Namespace, Scope = obj.Scope, Syntax = obj.Syntax, Implements = obj.Implements, Inherits = obj.InheritsFrom, InheritanceTree = obj.InheritanceTree, Classname = obj.FormattedName, Assembly = obj.Assembly, }, Remarks = obj.Remarks, Example = obj.Example, SeeAlso = obj.SeeAlso, }; topic.Parent = parentTopic; topic.CreateRelativeSlugAndLink(topic); topic.Body = obj.HelpText; parentTopic?.Topics.Add(topic); foreach (var meth in obj.Methods.Where(m => m.IsConstructor)) { var childTopic = ParseMethod(meth, topic); parentTopic.Topics.Add(childTopic); } foreach (var meth in obj.Methods.Where(m => !m.IsConstructor).OrderBy(m => m.Name)) { var childTopic = ParseMethod(meth, topic); parentTopic.Topics.Add(childTopic); } foreach (var prop in obj.Properties.OrderBy(p => p.Name)) { var childTopic = ParseProperty(prop, topic); parentTopic.Topics.Add(childTopic); } //foreach (var ev in obj.Events) //{ // var childTopic = ParseEvent(ev, parentTopic); // parentTopic.Topics.Add(childTopic); //} return(topic); }
public DocTopic ParseMethod(ObjectMethod method, DocTopic parentClassTopic) { var topic = new DocTopic(_project) { Title = parentClassTopic.ClassInfo.Classname + "." + method.Name, //ListTitle = method.Name, DisplayType = method.IsConstructor ? "classconstructor" : "classmethod", ClassInfo = new ClassInfo { MemberName = method.Name, Signature = method.Signature, Exceptions = method.Exceptions, Scope = method.Scope, IsStatic = method.Static, Syntax = method.Syntax, Parameters = method.Parameters, IsConstructor = method.IsConstructor, IsInherited = method.IsInherited, }, Remarks = method.Remarks, Example = method.Example, SeeAlso = method.SeeAlso, ParentId = parentClassTopic?.Id }; topic.Parent = parentClassTopic; topic.CreateRelativeSlugAndLink(topic); topic.Body = method.HelpText; parentClassTopic?.Topics.Add(topic); return(topic); }