BF2Statistics.SnapshotViewForm.GetSnapshotFileInfos C# (CSharp) Method

GetSnapshotFileInfos() private method

Builds a list of SnapshotFile objects found within the specified file path
private GetSnapshotFileInfos ( string FilePath ) : List
FilePath string
return List
        private List<SnapshotFile> GetSnapshotFileInfos(string FilePath)
        {
            List<SnapshotFile> Files = new List<SnapshotFile>();

            // Grab all files with the .txt extension
            foreach (string File in Directory.EnumerateFiles(FilePath, "*.txt"))
            {
                try
                {
                    // Get filename
                    string fileName = Path.GetFileName(File);

                    // Check Formatting
                    if (!fileName.Contains('-') || !fileName.Contains('_'))
                        continue;

                    // Create new snapshot file into
                    Files.Add(new SnapshotFile(fileName));
                }
                catch
                {
                    continue;
                }
            }

            return Files;
        }