diff --git a/GameRes/FormatCatalog.cs b/GameRes/FormatCatalog.cs index b41bc017..9135d527 100644 --- a/GameRes/FormatCatalog.cs +++ b/GameRes/FormatCatalog.cs @@ -313,6 +313,27 @@ namespace GameRes return reader.ReadInt32(); } } + + /// + /// Read text file from data directory, performing action on each line. + /// + public void ReadFileList (string filename, Action process_line) + { + var lst_file = Path.Combine (DataDirectory, filename); + if (!File.Exists (lst_file)) + return; + using (var input = new StreamReader (lst_file)) + { + string line; + while ((line = input.ReadLine()) != null) + { + if (line.Length > 0) + { + process_line (line); + } + } + } + } } ///