我知道如何打破StreamReader
元素的值更改(中断属性更改),但是如果 private static int BufferSize = 32768;
using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (TextReader txtReader = new StreamReader(fs, Encoding.UTF8, true, BufferSize))
{
System.Text.RegularExpressions.Regex patternMatching = new System.Text.RegularExpressions.Regex(@"(?=\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})(.*?)(?=\n\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex dateStringMatch = new Regex(@"^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}");
char[] temp = new char[1048576];
while (txtReader.ReadBlock(temp, 0, 1048576) > 0)
{
StringBuilder parseString = new StringBuilder();
parseString.Append(temp);
if (temp[1023].ToString() != Environment.NewLine)
{
parseString.Append(txtReader.ReadLine());
while (txtReader.Peek() > 0 && !(txtReader.Peek() >= 48 && txtReader.Peek() <= 57))
{
parseString.Append(txtReader.ReadLine());
}
}
if (parseString.Length > 0)
{
string[] allRecords = patternMatching.Split(parseString.ToString());
foreach (var item in allRecords)
{
var contentString = item.Trim();
if (!string.IsNullOrWhiteSpace(contentString))
{
var matches = dateStringMatch.Matches(contentString);
if (matches.Count > 0)
{
var rowDatetime = DateTime.MinValue;
if (DateTime.TryParse(matches[0].Value, out rowDatetime))
{
if (rowDatetime >= startDate && rowDatetime < endDate)
{
if (contentString.ToLowerInvariant().Contains(searchText))
{
var result = new SearchResult
{
LogFileType = logFileType,
Message = string.Format(messageTemplateNew, item),
Timestamp = rowDatetime,
ComponentName = componentName,
FileName = filePath,
ServerName = serverName
};
searchResults.Add(result);
}
}
}
}
}
}
}
}
}
}
return searchResults;
DOM元素的值发生更改,我该如何中断,因为value属性是没有接触到HTML?