static StackObject *ReadBlockAsync_14(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @count = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Int32 @index = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Char[] @buffer = (System.Char[]) typeof(System.Char[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 4); System.IO.StreamReader instance_of_this_method = (System.IO.StreamReader) typeof(System.IO.StreamReader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.ReadBlockAsync(@buffer, @index, @count); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance)); } return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
private static async ValueTask <(bool, string)> ReadFileAsync(string filename, string nodata) { if (!System.IO.File.Exists(filename)) { return(false, "Record has been deleted."); } var sb = new StringBuilder(); using (var sr = new System.IO.StreamReader(filename)) { var arr = new char[1024]; var len = await sr.ReadBlockAsync(arr, 0, 1024); sb.Append(arr, 0, len); if (len >= 1024) { sb.Append("...\n[content display truncated after 1024B]"); } } var content = sb.ToString(); if (string.IsNullOrWhiteSpace(content)) { return(false, nodata); } return(true, content); }
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { if (!System.IO.File.Exists(FileName)) { output.TagName = "p"; output.TagMode = TagMode.StartTagAndEndTag; output.Attributes.Add("class", "nodata"); output.Content.Append("Record has been deleted."); return; } int len = 0; var arr = new char[2000]; using (var sr = new System.IO.StreamReader(FileName)) len = await sr.ReadBlockAsync(arr, 0, 2000); output.TagName = null; output.Content.AppendHtml("<table><tr><th>time</th><th>validator</th><th>submission<th></tr>\n"); ParseLog(new ReadOnlySpan <char>(arr, 0, len), output.Content); output.Content.AppendHtml("</table>\n"); if (len >= 2000) { output.Content.Append("[content display truncated after 2000B]"); } }