Bamboo.Prevalence.Implementation.PendingCommandsEnumerator.NextLogStream C# (CSharp) Method

NextLogStream() private method

private NextLogStream ( ) : FileStream
return System.IO.FileStream
		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;
		}