CreateModel() public static méthode

public static CreateModel ( string xml, SyntaxLanguage language, ITripleSlashCommentParserContext context ) : TripleSlashCommentModel
xml string
language SyntaxLanguage
context ITripleSlashCommentParserContext
Résultat TripleSlashCommentModel
Exemple #1
0
 public static void FeedComments(MetadataItem item, ITripleSlashCommentParserContext context)
 {
     if (!string.IsNullOrEmpty(item.RawComment))
     {
         var commentModel = TripleSlashCommentModel.CreateModel(item.RawComment, item.Language, context);
         if (commentModel == null)
         {
             return;
         }
         item.Summary      = commentModel.Summary;
         item.Remarks      = commentModel.Remarks;
         item.Exceptions   = commentModel.Exceptions;
         item.Sees         = commentModel.Sees;
         item.SeeAlsos     = commentModel.SeeAlsos;
         item.Examples     = commentModel.Examples;
         item.CommentModel = commentModel;
     }
 }
        private static void PatchViewModel(MetadataItem item, string comment)
        {
            var context = new TripleSlashCommentParserContext
            {
                AddReferenceDelegate = (s, e) => { }
            };
            var commentModel = TripleSlashCommentModel.CreateModel(comment, SyntaxLanguage.CSharp, context);
            var summary      = commentModel.Summary;

            if (!string.IsNullOrEmpty(summary))
            {
                item.Summary = summary;
            }
            var remarks = commentModel.Remarks;

            if (!string.IsNullOrEmpty(remarks))
            {
                item.Remarks = remarks;
            }
            var exceptions = commentModel.Exceptions;

            if (exceptions != null && exceptions.Count > 0)
            {
                item.Exceptions = exceptions;
            }
            var sees = commentModel.Sees;

            if (sees != null && sees.Count > 0)
            {
                item.Sees = sees;
            }
            var seeAlsos = commentModel.SeeAlsos;

            if (seeAlsos != null && seeAlsos.Count > 0)
            {
                item.SeeAlsos = seeAlsos;
            }
            var examples = commentModel.Examples;

            if (examples != null && examples.Count > 0)
            {
                item.Examples = examples;
            }
            if (item.Syntax != null)
            {
                if (item.Syntax.Parameters != null)
                {
                    foreach (var p in item.Syntax.Parameters)
                    {
                        var description = commentModel.GetParameter(p.Name);
                        if (!string.IsNullOrEmpty(description))
                        {
                            p.Description = description;
                        }
                    }
                }
                if (item.Syntax.TypeParameters != null)
                {
                    foreach (var p in item.Syntax.TypeParameters)
                    {
                        var description = commentModel.GetTypeParameter(p.Name);
                        if (!string.IsNullOrEmpty(description))
                        {
                            p.Description = description;
                        }
                    }
                }
                if (item.Syntax.Return != null)
                {
                    var returns = commentModel.Returns;
                    if (!string.IsNullOrEmpty(returns))
                    {
                        item.Syntax.Return.Description = returns;
                    }
                }
            }
            // todo more.
        }