NLog.Targets.FileTarget.GetArchiveFileNameBasedOnFileSize C# (CSharp) Method

GetArchiveFileNameBasedOnFileSize() private method

Gets the file name for archiving, or null if archiving should not occur based on file size.
private GetArchiveFileNameBasedOnFileSize ( string fileName, int upcomingWriteSize ) : string
fileName string File name to be written.
upcomingWriteSize int The size in bytes of the next chunk of data to be written in the file.
return string
        private string GetArchiveFileNameBasedOnFileSize(string fileName, int upcomingWriteSize)
        {
            if (this.ArchiveAboveSize == ArchiveAboveSizeDisabled)
            {
                return null;
            }

            fileName = GetPotentialFileForArchiving(fileName);

            if (fileName == null)
            {
                return null;
            }

            var length = this.fileAppenderCache.GetFileLength(fileName, true);
            if (length == null)
            {
                return null;
            }

            var shouldArchive = length.Value + upcomingWriteSize > this.ArchiveAboveSize;
            if (shouldArchive)
            {
                return fileName;
            }
            return null;

        }