object read_file(object user_data)
{
string name = (string) user_data;
FileInfo file_info = new FileInfo (name);
if (!file_info.Exists) {
Report.Debug (DebugFlags.SourceFiles, "Can't find source file: " + name);
return null;
}
ArrayList contents = new ArrayList ();
try {
/* 28591 = Windows ISO Latin1 code page */
Encoding encoding = Encoding.GetEncoding (28591);
using (StreamReader reader = new StreamReader (file_info.OpenRead (), encoding)) {
string line;
while ((line = reader.ReadLine ()) != null)
contents.Add (line);
}
} catch {
return null;
}
return new SourceBuffer (name, contents);
}