You've already forked YY.EventLogReaderAssistant
mirror of
https://github.com/BDDSM/YY.EventLogReaderAssistant.git
synced 2025-07-16 22:24:15 +02:00
Исправил ошибки для методов перехода к конкретной позиции логов
This commit is contained in:
@ -178,18 +178,25 @@ namespace YY.EventLogAssistant
|
|||||||
long eventCount = Count();
|
long eventCount = Count();
|
||||||
if (eventCount >= eventNumber)
|
if (eventCount >= eventNumber)
|
||||||
{
|
{
|
||||||
|
long eventNumberToSkip = eventNumber - 1;
|
||||||
|
if (eventNumberToSkip <= 0)
|
||||||
|
{
|
||||||
|
_lastRowId = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
using (_connection = new SQLiteConnection(ConnectionString))
|
using (_connection = new SQLiteConnection(ConnectionString))
|
||||||
{
|
{
|
||||||
_connection.Open();
|
_connection.Open();
|
||||||
|
|
||||||
string queryText = String.Format(
|
string queryText = String.Format(
|
||||||
"Select\n" +
|
"Select\n" +
|
||||||
" el.RowId,\n" +
|
" el.RowId\n" +
|
||||||
"From\n" +
|
"From\n" +
|
||||||
" EventLog el\n" +
|
" EventLog el\n" +
|
||||||
"Where RowID > {0}\n" +
|
"Where RowID > {0}\n" +
|
||||||
"Order By rowID\n" +
|
"Order By rowID\n" +
|
||||||
"Limit 1 OFFSET {1}\n", _lastRowId, eventNumber);
|
"Limit 1 OFFSET {1}\n", _lastRowId, eventNumberToSkip);
|
||||||
|
|
||||||
using (SQLiteCommand cmd = new SQLiteCommand(queryText, _connection))
|
using (SQLiteCommand cmd = new SQLiteCommand(queryText, _connection))
|
||||||
{
|
{
|
||||||
@ -266,6 +273,8 @@ namespace YY.EventLogAssistant
|
|||||||
_lastRowId = 0;
|
_lastRowId = 0;
|
||||||
_lastRowNumberFromBuffer = 0;
|
_lastRowNumberFromBuffer = 0;
|
||||||
_readBuffer.Clear();
|
_readBuffer.Clear();
|
||||||
|
_currentFileEventNumber = 0;
|
||||||
|
_currentRow = null;
|
||||||
}
|
}
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
|
@ -230,9 +230,14 @@ namespace YY.EventLogAssistant
|
|||||||
_currentFileEventNumber = newPosition.EventNumber;
|
_currentFileEventNumber = newPosition.EventNumber;
|
||||||
|
|
||||||
InitializeStream(_defaultBeginLineForLGF, _indexCurrentFile);
|
InitializeStream(_defaultBeginLineForLGF, _indexCurrentFile);
|
||||||
|
long beginReadPosition =_stream.GetPosition();
|
||||||
|
|
||||||
|
long newStreamPosition = (long)newPosition.StreamPosition;
|
||||||
|
if(newStreamPosition < beginReadPosition)
|
||||||
|
newStreamPosition = beginReadPosition;
|
||||||
|
|
||||||
if (newPosition.StreamPosition != null)
|
if (newPosition.StreamPosition != null)
|
||||||
SetCurrentFileStreamPosition((long)newPosition.StreamPosition);
|
SetCurrentFileStreamPosition(newStreamPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override long Count()
|
public override long Count()
|
||||||
@ -252,6 +257,8 @@ namespace YY.EventLogAssistant
|
|||||||
}
|
}
|
||||||
|
|
||||||
_indexCurrentFile = 0;
|
_indexCurrentFile = 0;
|
||||||
|
_currentFileEventNumber = 0;
|
||||||
|
_currentRow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void NextFile()
|
public override void NextFile()
|
||||||
|
Reference in New Issue
Block a user