示例#1
0
        public string GetPropertyCommentPostfixed(TypeScriptProperty p)
        {
            var obsolete = p.Property.GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() as ObsoleteAttribute;

              var comments = new List<string>();

              if (obsolete != null)
              {
            comments.Add(string.Format("obsolete {0}", string.IsNullOrEmpty(obsolete.Message) ? "" : ": " + obsolete.Message));
              }

              var propertyComment = this.GetPropertyComment((dynamic)p.Type);

              if (propertyComment != null)
              {
            comments.Add(propertyComment);
              }

              if (comments.Any())
              {
            return "// " + string.Join(", ", comments);
              }

              return "";
        }
示例#2
0
        public string GetPropertyCommentPrefixed(TypeScriptProperty p)
        {
            var func = _options.CommentingOptions.PrefixedCommentGenerator;

              if (func != null)
              {
            var comment = func(p.Property);

            if (!string.IsNullOrEmpty(comment))
            {
              return "// " + comment;
            }
              }

              return null;
        }
示例#3
0
        private void Render(IndentedStringBuilder sb, TypeScriptProperty p)
        {
            var prefixComment = _propertyCommenter.GetPropertyCommentPrefixed(p);

              if (!string.IsNullOrEmpty(prefixComment))
              {
            sb.AppendLine(prefixComment);
              }

              sb.AppendLine("{0} : {1}{2}; {3}", p.Property.Name, _moduleNameGenerator.GetModuleName((dynamic)p.Type), _typeNameGenerator.GetTypeName((dynamic)p.Type), _propertyCommenter.GetPropertyCommentPostfixed(p));
        }
        private void Render(TypeScriptProperty p)
        {
            var prefixComment = _propertyCommenter.GetPropertyCommentPrefixed(p);

              if (!string.IsNullOrEmpty(prefixComment))
              {
            _sb.AppendLine(prefixComment);
              }

              _sb.AppendLine("{0}{3} : {1}{2}; {4}", p.Property.Name, _moduleNameGenerator.GetModuleName((dynamic)p.Type), _typeNameGenerator.GetTypeName((dynamic)p.Type), HandleOptional(p.Type), _propertyCommenter.GetPropertyCommentPostfixed(p));
        }