Cim.Eap.RollingLogFileAppender.GetLastRollCount C# (CSharp) Method

GetLastRollCount() static private method

static private GetLastRollCount ( ) : int
return int
        static int GetLastRollCount() {
            Func<string, int> parser = str => {
                int result;
                return int.TryParse(str, out result) ? result : 0;
            };
            var c = from fi in new DirectoryInfo(LOG_DIR).GetFiles(string.Format("*_{0:yyyyMMdd}_*.log", DateTime.Now))
                    let _i = fi.FullName.LastIndexOf('_')
                    let dot = fi.FullName.LastIndexOf('.')
                    where _i != -1 && dot != -1 && dot > _i
                    let count = parser(fi.FullName.Substring(_i + 1, dot - _i - 1))
                    orderby count descending
                    select count;

            return c.FirstOrDefault();
        }