BF2Statistics.MedalData.MedalDataParser.ReadPythonFile C# (CSharp) Method

ReadPythonFile() public static method

Simple easy way to get the contents of a file, excluding empty lines.
public static ReadPythonFile ( string file ) : string
file string
return string
        public static string ReadPythonFile(string file)
        {
            List<string> Lines = new List<string>();

            using (FileStream Fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
            using (StreamReader FsReader = new StreamReader(Fs))
            {
                while (FsReader.Peek() >= 0)
                {
                    string Line = FsReader.ReadLine().Trim('\t', '\r', '\n', ' ');

                    if (string.IsNullOrWhiteSpace(Line) || Line[0] == '#')
                        continue;

                    Lines.Add(Line);
                }
            }

            return string.Join("\r\n", Lines);
        }