Bamboo.Prevalence.Implementation.NumberedFileFinder.NextPendingLog C# (CSharp) Method

NextPendingLog() private method

private NextPendingLog ( ) : FileInfo
return System.IO.FileInfo
		internal FileInfo NextPendingLog()
		{
			FileInfo pendingLog = FormatFileInfo(LogFileNameFormat, _nextNumber + 1);
			if (pendingLog.Exists)
			{
				++_nextNumber;				
			}
			return pendingLog;
		}

Usage Example

Example #1
0
        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);
        }