added ReadAllLines() for stream; rewrote TerrainColorSet to use it

This commit is contained in:
Chris Forbes
2010-05-12 17:53:09 +12:00
parent 8cd38812d9
commit fb592b90d5
2 changed files with 31 additions and 36 deletions

View File

@@ -60,5 +60,18 @@ namespace OpenRA
return data;
}
}
public static IEnumerable<string> ReadAllLines(this Stream s)
{
using (var sr = new StreamReader(s))
for (; ; )
{
var line = sr.ReadLine();
if (line == null)
yield break;
else
yield return line;
}
}
}
}