private System.IO.FileStream NextLogStream()
{
if (null == _fileFinder)
{
throw new ObjectDisposedException("PendingCommandsEnumerator");
}
CloseCurrentStream();
while (true)
{
System.IO.FileInfo nextLog = _fileFinder.NextPendingLog();
if (nextLog.Exists)
{
if (nextLog.Length > 0)
{
// Open the log file with
// FileShare.ReadWrite
// because the crashed prevalence engine might
// not have closed it
// TODO: Is this really necessary/desired?
return(nextLog.Open(
FileMode.Open, FileAccess.Read, FileShare.ReadWrite
));
}
}
else
{
break;
}
}
return(null);
}