Added read support for Instance Attributes.

This isn't 100% finished yet. I intend to add some better API for reading specific attributes, as well as write support (of course!)
This commit is contained in:
CloneTrooper1019
2019-10-31 21:40:31 -05:00
parent fd8598c1b5
commit e14b092aa7
30 changed files with 580 additions and 95 deletions

View File

@ -1,5 +1,7 @@
using System;
using System.IO;
using System.Globalization;
using System.Text;
internal static class Formatting
{
@ -112,4 +114,15 @@ internal static class Formatting
{
return Math.Abs(a - b) < epsilon;
}
public static string ReadString(this BinaryReader reader, bool useIntLength)
{
if (!useIntLength)
return reader.ReadString();
int len = reader.ReadInt32();
byte[] buffer = reader.ReadBytes(len);
return Encoding.UTF8.GetString(buffer);
}
}