private void InitializeFromOneFile(string baseFile, string curFileName)
{
using (SecurityContext.Impersonate(this))
{
if (!curFileName.StartsWith(baseFile.GetFileNameWithoutExtension()) || curFileName.Equals(baseFile))
{
return;
}
}
int num1 = curFileName.LastIndexOf(".");
if (0 > num1)
{
return;
}
if (_staticLogFileName)
{
int num2 = curFileName.Length - num1;
string datePart;
using (SecurityContext.Impersonate(this))
{
datePart = ActivityLogFile.GetDatePart(curFileName);
}
if (baseFile.Length + num2 != curFileName.Length - datePart.Length - 1)
{
return;
}
}
if (_rollDate && !_staticLogFileName)
{
if (
!curFileName.StartsWith(baseFile +
_dateTime.Now.ToString(ActivityLogFile.FileDatePattern, DateTimeFormatInfo.InvariantInfo)))
{
LogLog.Debug("RollingFileAppender: Ignoring file [" + curFileName + "] because it is from a different date period");
return;
}
}
try
{
int val;
if (SystemInfo.TryParse(curFileName.Substring(num1 + 1), out val) && val > _curSizeRollBackups)
{
if (0 != _maxSizeRollBackups)
{
if (-1 == _maxSizeRollBackups)
{
_curSizeRollBackups = val;
}
else if (_countDirection >= 0)
{
_curSizeRollBackups = val;
}
else if (val <= _maxSizeRollBackups)
{
_curSizeRollBackups = val;
}
}
LogLog.Debug("RollingFileAppender: File name [" + curFileName + "] moves current count to [" + _curSizeRollBackups +
"]");
}
}
catch (FormatException)
{
LogLog.Debug("RollingFileAppender: Encountered a backup file not ending in .x [" + curFileName + "]");
}
}