AppMetrics.DataReader.GetSessionsFromPath C# (CSharp) Method

GetSessionsFromPath() public static method

public static GetSessionsFromPath ( string dataPath, TimePeriod period ) : List
dataPath string
period TimePeriod
return List
        public static List<Session> GetSessionsFromPath(string dataPath, TimePeriod period)
        {
            var res = new List<Session>();

            if (Directory.Exists(dataPath))
            {
                foreach (var filePath in Directory.GetFiles(dataPath, "*.*.txt", SearchOption.AllDirectories))
                {
                    if (filePath.EndsWith(WebLogger.FileName, StringComparison.OrdinalIgnoreCase))
                        continue;

                    var session = ReadSession(filePath, period);
                    if (session != null)
                        res.Add(session);
                }

                res.Sort((x, y) => x.CreationTime.CompareTo(y.CreationTime));
            }

            return res;
        }