@using ImageBoardServerApp.Data.Repository @using System.ComponentModel.DataAnnotations @using System.Text.RegularExpressions
@comment.Username @if (@role != "User" && !comment.shouldAnon) { ##@role  } else {   } @getTimeFromUnix(comment.CreatedAt) No.@comment.GET
@if (image != null) {
No Image found
}
@for (var y = 0; y < comment.Content.Split("\n").Length; y++) { var s = comment.Content.Split("\n")[y]; var className = ""; @if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}")) { className = "greenText"; }

@for (var x = 0; x < s.Split(" ").Length; x++) { var line = s.Split(" ")[x]; @if (@Regex.IsMatch(line, ">>\\d+")) { var className2 = ""; @line } else { @if (line.StartsWith("https://") || line.StartsWith("http://")) { @line } else { @line } @(" ") } }

}
@code { private ImageData image; private string role; private static DateTime getTimeFromUnix(double javaTimeStamp) { var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); dateTime = dateTime.AddMilliseconds(javaTimeStamp).ToLocalTime(); return dateTime; } protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); int i; try { i = (int)comment.ImageID; } catch (InvalidOperationException ioe) { i = -1; } if (i != null) { image = await ImagesRepository.getImageByIdAsync(i); } var cmt = await CommentsRepository.getCommentByIdAsync(comment.CommentID); role = cmt.User.Role; } [Parameter] [Required] public CommentData comment { get; set; } }