forked from WolvenKit/WolvenKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtensionMethods.cs
33 lines (29 loc) · 969 Bytes
/
ExtensionMethods.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.IO;
namespace WolvenKit.W3SavegameEditor.Core
{
internal static class ExtensionMethods
{
public static string ReadString(this BinaryReader reader, int count)
{
return new string(reader.ReadChars(count));
}
public static string PeekString(this BinaryReader reader, int count)
{
long position = reader.BaseStream.Position;
string value = new string(reader.ReadChars(count));
reader.BaseStream.Position = position;
return value;
}
public static byte PeekByte(this BinaryReader reader)
{
long position = reader.BaseStream.Position;
byte value = reader.ReadByte();
reader.BaseStream.Position = position;
return value;
}
public static void Skip(this BinaryReader reader, int count)
{
reader.BaseStream.Position += count;
}
}
}