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:
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user