Remove BinaryReader from XccGlobalDatabase.

This commit is contained in:
Paul Chote
2016-04-01 17:21:50 +01:00
parent 728bad9565
commit bf61785f96

View File

@@ -20,22 +20,21 @@ namespace OpenRA.FileFormats
public XccGlobalDatabase(Stream s) public XccGlobalDatabase(Stream s)
{ {
var entries = new List<string>(); var entries = new List<string>();
var reader = new BinaryReader(s); while (s.Peek() > -1)
while (reader.PeekChar() > -1)
{ {
var count = reader.ReadInt32(); var count = s.ReadInt32();
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
var chars = new List<char>(); var chars = new List<char>();
char c; byte c;
// Read filename // Read filename
while ((c = reader.ReadChar()) != 0) while ((c = s.ReadUInt8()) != 0)
chars.Add(c); chars.Add((char)c);
entries.Add(new string(chars.ToArray())); entries.Add(new string(chars.ToArray()));
// Skip comment // Skip comment
while ((c = reader.ReadChar()) != 0) { } while ((c = s.ReadUInt8()) != 0) { }
} }
} }