Example #1
0
        public virtual void Write(ICodeFragment fragment, IOutputCache output)
        {
            CommentTemplate comment = (CommentTemplate)fragment;

            if (comment.IsEmpty())
            {
                return;
            }
            foreach (string line in this.SplitLines(comment.Description))
            {
                if (line.TrimStart().StartsWith("/*"))
                {
                    if (line.EndsWith("*/"))
                    {
                        output.Add(line);
                    }
                    else
                    {
                        output.Add(line.Replace("*/", "*/ //"));
                    }
                }
                else
                {
                    output.Add($"// {line}".Trim());
                }
                output.BreakLine();
            }
        }
Example #2
0
        public virtual void Write(ICodeFragment fragment, IOutputCache output)
        {
            CommentTemplate comment = (CommentTemplate)fragment;

            if (comment.IsEmpty())
            {
                return;
            }
            string[] lines = comment.Description.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            lines.ForEach(line => output.Add("// " + line).BreakLine());
        }
Example #3
0
        public IActionResult Update([FromBody] CommentTemplate comment)
        {
            try
            {
                var commentMap = _mapper.Map <Comment>(comment);
                _commentRepository.Update(commentMap);

                return(Ok(new ServiceResponse <CommentServiceResponse, CommentTemplate>(CommentServiceResponse.Success)));
            }
            catch (System.Exception ex)
            {
                _logger.Error($"Comment Update :{ex}");
                return(BadRequest(new ServiceResponse <CommentServiceResponse, CommentTemplate>(CommentServiceResponse.Exception)));
            }
        }
Example #4
0
        public override void Write(ICodeFragment fragment, IOutputCache output)
        {
            CommentTemplate comment = (CommentTemplate)fragment;

            if (comment.IsEmpty())
            {
                return;
            }

            if (comment.Type == CommentType.Summary)
            {
                output.Add("/// <summary>").BreakLine();
                this.SplitLines(comment.Description).ForEach(x => output.Add($"/// {x}".Trim()).BreakLine());
                output.Add("/// </summary>").BreakLine();
            }
            else
            {
                base.Write(fragment, output);
            }
        }
Example #5
0
        public override void Write(ICodeFragment fragment, IOutputCache output)
        {
            CommentTemplate comment = (CommentTemplate)fragment;

            if (comment.IsEmpty())
            {
                return;
            }

            if (comment.Type == CommentType.Summary)
            {
                output.Add("/// <summary>").BreakLine();
                string[] lines = comment.Description.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                lines.ForEach(x => output.Add("/// ").Add(x).BreakLine());
                output.Add("/// </summary>").BreakLine();
            }
            else
            {
                base.Write(fragment, output);
            }
        }
 public static bool IsEmpty(this CommentTemplate comment)
 {
     return(comment == null || string.IsNullOrEmpty(comment.Description));
 }