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);
}