/// <summary> /// Generates the page contents /// </summary> public override void Generate() { if (!IsGenerated) { CRefPath crefPath = new CRefPath(_method); List <Block> parsedBlocks = Elements.Parser.Parse(_method.Assembly, _commentsXml, crefPath); if (!_commentsXml.Exists()) { Blocks.Add(new NoXmlComments(_method)); } Blocks.Add(new Elements.Header1(_method.GetDisplayName(false))); // Add the summary if it exists if (parsedBlocks != null) { Block summary = parsedBlocks.Find(currentBlock => currentBlock is Summary); if (summary != null) { Blocks.Add(summary); } } AddSyntaxBlock(_method); // Add the type parameters if they exist if (parsedBlocks != null) { List <Block> typeParams = parsedBlocks.FindAll(currentBlock => currentBlock is TypeParamEntry); if (typeParams.Count > 0) { TypeParamSection typeParamSection = new TypeParamSection(); foreach (GenericTypeRef genericType in _method.GenericTypes) { string name = genericType.Name; string description = string.Empty; foreach (TypeParamEntry current in typeParams) { if (current.Param == genericType.Name) { description = current.Description; } } typeParamSection.AddEntry(new TypeParamEntry(name, description)); } Blocks.Add(typeParamSection); } } AddParametersForMethod(_method, parsedBlocks); AddReturnDetails(parsedBlocks); // Add the exception table if it exists if (parsedBlocks != null) { Block exceptions = parsedBlocks.Find(currentBlock => currentBlock is ExceptionList); if (exceptions != null) { Blocks.Add(exceptions); } } if (parsedBlocks != null) { Block permissions = parsedBlocks.Find(current => current is PermissionList); if (permissions != null) { Blocks.Add(permissions); } } // Add the remarks if it exists if (parsedBlocks != null) { Block remarks = parsedBlocks.Find(currentBlock => currentBlock is Remarks); if (remarks != null) { Blocks.Add(remarks); } } // Add the example if it exists if (parsedBlocks != null) { Block summary = parsedBlocks.Find(currentBlock => currentBlock is Example); if (summary != null) { Blocks.Add(new Header2("Examples")); Blocks.Add(summary); } } // Add the seealso list if it exists AddSeeAlso(parsedBlocks); IsGenerated = true; } }
/// <summary> /// Generates the pages contents /// </summary> public override void Generate() { if (!this.IsGenerated) { CRefPath crefPath = new CRefPath(this._representedType); List <Block> parsedBlocks = Elements.Parser.Parse(this._representedType.Assembly, _commentsXml, crefPath); if (!this._commentsXml.Exists()) { this.Blocks.Add(new NoXmlComments(this._representedType)); } string classType = this._representedType.IsInterface ? " Interface" : " Class"; this.Blocks.Add(new Header1(this._representedType.GetDisplayName(false) + classType)); // Add the summary if it exists if (parsedBlocks != null) { Block summary = parsedBlocks.Find(currentBlock => currentBlock is Summary); if (summary != null) { this.Blocks.Add(summary); } } if (!this._representedType.IsInterface && !this._representedType.IsStructure) { this.AddInheritanceTree(this._representedType); } this.AddSyntaxBlock(this._representedType); // Add the type parameters if they exist if (parsedBlocks != null) { List <Block> typeParams = parsedBlocks.FindAll(currentBlock => currentBlock is TypeParamEntry); if (typeParams.Count > 0) { TypeParamSection typeParamSection = new TypeParamSection(); foreach (GenericTypeRef genericType in this._representedType.GenericTypes) { string name = genericType.Name; string description = string.Empty; foreach (TypeParamEntry current in typeParams) { if (current.Param == genericType.Name) { description = current.Description; } } typeParamSection.AddEntry(new TypeParamEntry(name, description)); } this.Blocks.Add(typeParamSection); } } if (parsedBlocks != null) { Block permissions = parsedBlocks.Find(current => current is PermissionList); if (permissions != null) { this.Blocks.Add(permissions); } } this.OutputMembersLists(); // Add the remarks if it exists if (parsedBlocks != null) { Block remarks = parsedBlocks.Find(currentBlock => currentBlock is Remarks); if (remarks != null) { this.Blocks.Add(remarks); } } // Add the example if it exists if (parsedBlocks != null) { Block summary = parsedBlocks.Find(currentBlock => currentBlock is Example); if (summary != null) { this.Blocks.Add(new Header2("Examples")); this.Blocks.Add(summary); } } this.AddSeeAlso(parsedBlocks); // Inform the application the page has been generated this.IsGenerated = true; } }
public override void Generate() { if (!this.IsGenerated) { CRefPath crefPath = new CRefPath(_representedType); List <Block> parsedBlocks = Elements.Parser.Parse(_representedType.Assembly, _commentsXml, crefPath); if (!this._commentsXml.Exists()) { this.Blocks.Add(new NoXmlComments(_representedType)); } this.Blocks.Add(new Header1(_representedType.GetDisplayName(false) + " Delegate")); // Add the summary if it exists if (parsedBlocks != null) { Block summary = parsedBlocks.Find(currentBlock => currentBlock is Summary); if (summary != null) { this.Blocks.Add(summary); } } this.AddSyntaxBlock(this._representedType); // Add the type parameters if they exist if (parsedBlocks != null) { List <Block> typeParams = parsedBlocks.FindAll(currentBlock => currentBlock is TypeParamEntry); if (typeParams.Count > 0) { TypeParamSection typeParamSection = new TypeParamSection(); foreach (GenericTypeRef genericType in this._representedType.GenericTypes) { string name = genericType.Name; string description = string.Empty; foreach (TypeParamEntry current in typeParams) { if (current.Param == genericType.Name) { description = current.Description; } } typeParamSection.AddEntry(new TypeParamEntry(name, description)); } this.Blocks.Add(typeParamSection); } } // Show the delegate parameters, this comes from the invoke method // Add the parameter information if available MethodDef invokeMethod = this._representedType.GetMethods().Find(m => m.Name == "Invoke"); this.AddParametersForMethod(invokeMethod, parsedBlocks); if (parsedBlocks != null) { Block permissions = parsedBlocks.Find(current => current is PermissionList); if (permissions != null) { this.Blocks.Add(permissions); } } // Add the remarks if it exists if (parsedBlocks != null) { Block remarks = parsedBlocks.Find(currentBlock => currentBlock is Remarks); if (remarks != null) { this.Blocks.Add(remarks); } } // Add the example if it exists if (parsedBlocks != null) { Block summary = parsedBlocks.Find(currentBlock => currentBlock is Example); if (summary != null) { this.Blocks.Add(new Header2("Examples")); this.Blocks.Add(summary); } } this.AddSeeAlso(parsedBlocks); this.IsGenerated = true; } }