mirror of
https://github.com/BDDSM/YY.EventLogReaderAssistant.git
synced 2024-11-26 18:11:45 +02:00
Исправил чтение файла при подсчете количества событий.
Теперь работает с файлами журнала при работающей службе сервера.
This commit is contained in:
parent
b8b845ec68
commit
3eb641ca86
@ -617,9 +617,15 @@ namespace YY.EventLogAssistant
|
||||
|
||||
foreach (var logFile in _reader._logFilesWithData)
|
||||
{
|
||||
eventCount += File.ReadLines(logFile)
|
||||
.Where(lineInt => Regex.IsMatch(lineInt, @"^{\d{4}\d{2}\d{2}\d+,"))
|
||||
.LongCount();
|
||||
using (StreamReader logFileStream = new StreamReader(File.Open(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
{
|
||||
do
|
||||
{
|
||||
string logFileCurrentString = logFileStream.ReadLine();
|
||||
if (Regex.IsMatch(logFileCurrentString, @"^{\d{4}\d{2}\d{2}\d+,"))
|
||||
eventCount++;
|
||||
} while (!logFileStream.EndOfStream);
|
||||
}
|
||||
}
|
||||
|
||||
return eventCount;
|
||||
|
Loading…
Reference in New Issue
Block a user