Exemple #1
0
        static string GetTypeName(Member member, SourceComment comment, UxMemberPropertiesViewModel uxProperties)
        {
            if (comment.Attributes.ScriptEvent != null)
            {
                return("JsEvent");
            }
            if (comment.Attributes.ScriptProperty != null)
            {
                return("JsProperty");
            }
            if (comment.Attributes.ScriptMethod != null)
            {
                return("JsMethod");
            }
            if (uxProperties != null && member.MemberType == MemberType.Event)
            {
                return("UxEvent");
            }
            if (uxProperties != null && member.MemberType == MemberType.Property)
            {
                return("UxProperty");
            }
            if (comment.Attributes.UxProperty && member.MemberType == MemberType.Event)
            {
                return("UxEvent");
            }
            if (comment.Attributes.UxProperty && member.MemberType == MemberType.Property)
            {
                return("UxProperty");
            }

            return(member.MemberType.ToString("G"));
        }
Exemple #2
0
 public CommentViewModel(SourceComment sourceComment)
 {
     Brief      = string.IsNullOrWhiteSpace(sourceComment?.Brief) ? null : sourceComment.Brief;
     Full       = string.IsNullOrWhiteSpace(sourceComment?.Full) ? null : sourceComment.Full;
     Remarks    = string.IsNullOrWhiteSpace(sourceComment?.Remarks) ? null : sourceComment.Remarks;
     Examples   = string.IsNullOrWhiteSpace(sourceComment?.Examples) ? null : sourceComment.Examples;
     Ux         = string.IsNullOrWhiteSpace(sourceComment?.Ux) ? null : sourceComment.Ux;
     Attributes = ParseAttributes(sourceComment);
 }
Exemple #3
0
        private DocumentIdViewModel BuildDataTypeId(DataType dataType, SourceComment comment)
        {
            var id = new DocumentIdViewModel(dataType.GetUri(),
                                             dataType.Parent.GetUri(),
                                             GetTypeName(dataType, comment),
                                             dataType.GetModifierNames());

            return(id);
        }
Exemple #4
0
 private static string GetTypeName(DataType dataType, SourceComment comment)
 {
     if (comment.Attributes.ScriptModule != null)
     {
         return("JsModule");
     }
     if (dataType.GetUxClassProperties() != null)
     {
         return("UxClass");
     }
     return(dataType.TypeType.ToString("G"));
 }
Exemple #5
0
        protected CommentAttributesViewModel ParseAttributes(SourceComment sourceComment)
        {
            if (sourceComment == null)
            {
                return(null);
            }

            var parameters = (sourceComment.Attributes.Params ?? new List <SourceComment.CommentAttributeParameter>())
                             .Select(e =>
            {
                var result = ParseCommentWithTypeHint(e.Description);
                return(new CommentAttributesViewModel.ParameterCommentViewModel(e.Name, result.Item1, result.Item2));
            })
                             .ToList();

            var scriptMethod = sourceComment.Attributes.ScriptMethod == null
                                       ? null
                                       : new CommentAttributesViewModel.ScriptMethodCommentViewModel(sourceComment.Attributes.ScriptMethod.Name,
                                                                                                     sourceComment.Attributes.ScriptMethod.Parameters);

            CommentAttributesViewModel.ReturnCommentViewModel returns = null;
            if (!string.IsNullOrWhiteSpace(sourceComment.Attributes.Returns))
            {
                var result = ParseCommentWithTypeHint(sourceComment.Attributes.Returns);
                returns = new CommentAttributesViewModel.ReturnCommentViewModel(result.Item1, result.Item2);
            }

            var seeAlso = new List <string>();

            if (sourceComment.Attributes.SeeAlso != null && sourceComment.Attributes.SeeAlso.Count > 0)
            {
                seeAlso.AddRange(sourceComment.Attributes.SeeAlso);
            }

            return(new CommentAttributesViewModel(sourceComment.Attributes.Advanced,
                                                  sourceComment.Attributes.ScriptModule,
                                                  scriptMethod,
                                                  sourceComment.Attributes.ScriptProperty,
                                                  sourceComment.Attributes.ScriptEvent,
                                                  returns,
                                                  sourceComment.Attributes.Published,
                                                  parameters,
                                                  seeAlso,
                                                  sourceComment.Attributes.Topic,
                                                  sourceComment.Attributes.Experimental,
                                                  sourceComment.Attributes.Deprecated));
        }
Exemple #6
0
 public MinimalCommentViewModel(SourceComment sourceComment)
 {
     Brief      = string.IsNullOrWhiteSpace(sourceComment?.Brief) ? null : sourceComment.Brief;
     Full       = string.IsNullOrWhiteSpace(sourceComment?.Full) ? null : sourceComment.Full;
     Attributes = ParseAttributes(sourceComment);
 }