/// <summary> /// 初始化类<see cref="BlazorCodeBehindTransfer"/>。 /// </summary> /// <param name="file">当前文件信息。</param> public BlazorCodeBehindTransfer(FileInfo file) : base(file) { var source = new StringBuilder(); using var reader = new SourceReader(Source); var index = reader.IndexOf("@code"); if (index != -1) { reader.Offset(index + 5); reader.EscapeWhiteSpace(); if (reader.IsNext('{')) { source.Append(Source.Substring(0, index)); Code = reader.ReadQuoteBlock('{', '}'); source.Append(reader.ReadToEnd()); Source = source.ToString().Trim(); } } }