nexusforever/Source/NexusForever.Shared/GameTable/StringTable.cs
2019-06-27 05:11:31 +12:00

30 lines
678 B
C#

using System;
using System.IO;
using System.Text;
namespace NexusForever.Shared.GameTable
{
public class StringTable : IDisposable
{
private readonly MemoryStream stream;
private readonly BinaryReader reader;
public StringTable(byte[] buffer)
{
stream = new MemoryStream(buffer);
reader = new BinaryReader(stream, Encoding.Unicode);
}
public void Dispose()
{
reader.Dispose();
stream.Dispose();
}
public string GetEntry(uint offset)
{
stream.Position = offset;
return reader.ReadWideString();
}
}
}