Skip to content

Commit 07d00d1

Browse files
committed
Updated Utilities
1 parent c9f4d55 commit 07d00d1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Utilities/ByteUtils/ByteReader.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ public static string ReadAnsiString(Stream stream, int length)
128128
return ASCIIEncoding.GetEncoding(28591).GetString(buffer);
129129
}
130130

131+
public static string ReadUTF16String(Stream stream, int numberOfCharacters)
132+
{
133+
byte[] buffer = ReadBytes(stream, numberOfCharacters * 2);
134+
return Encoding.Unicode.GetString(buffer);
135+
}
136+
131137
public static string ReadNullTerminatedAnsiString(Stream stream)
132138
{
133139
StringBuilder builder = new StringBuilder();

Utilities/ByteUtils/LittleEndianWriter.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,17 @@ public static void WriteUInt32(Stream stream, uint value)
112112
byte[] bytes = LittleEndianConverter.GetBytes(value);
113113
stream.Write(bytes, 0, bytes.Length);
114114
}
115+
116+
public static void WriteInt64(Stream stream, long value)
117+
{
118+
byte[] bytes = LittleEndianConverter.GetBytes(value);
119+
stream.Write(bytes, 0, bytes.Length);
120+
}
121+
122+
public static void WriteUInt64(Stream stream, ulong value)
123+
{
124+
byte[] bytes = LittleEndianConverter.GetBytes(value);
125+
stream.Write(bytes, 0, bytes.Length);
126+
}
115127
}
116128
}

0 commit comments

Comments
 (0)