|
static void | ReadBytes (this Stream stream, byte[] buf) |
|
static byte[] | ReadBytes (this Stream stream, int len) |
|
static byte[] | ReadBytes (this Stream stream, long len) |
|
static Item | ReadItem (this BinaryReader reader, bool readStack=false, bool readFavorite=false) |
|
static int | ReadVarInt (this BinaryReader reader) |
|
static void | SafeRead (this BinaryReader reader, Action< BinaryReader > read) |
|
static void | SafeWrite (this BinaryWriter writer, Action< BinaryWriter > write) |
|
static void | WriteItem (this BinaryWriter writer, Item item, bool readStack=false, bool readFavorite=false) |
|
static void | WriteVarInt (this BinaryWriter writer, int value) |
|
Definition at line 6 of file BinaryIO.cs.
static void Terraria.ModLoader.IO.BinaryIO.ReadBytes |
( |
this Stream |
stream, |
|
|
byte[] |
buf |
|
) |
| |
|
static |
Definition at line 62 of file BinaryIO.cs.
64 while ((r = stream.Read(buf, pos, buf.Length - pos)) > 0)
67 if (pos != buf.Length)
68 throw new IOException($
"Stream did not contain enough bytes ({pos}) < ({buf.Length})");
static byte [] Terraria.ModLoader.IO.BinaryIO.ReadBytes |
( |
this Stream |
stream, |
|
|
int |
len |
|
) |
| |
|
static |
static byte [] Terraria.ModLoader.IO.BinaryIO.ReadBytes |
( |
this Stream |
stream, |
|
|
long |
len |
|
) |
| |
|
static |
Definition at line 73 of file BinaryIO.cs.
74 var buf =
new byte[len];
75 stream.ReadBytes(buf);
static Item Terraria.ModLoader.IO.BinaryIO.ReadItem |
( |
this BinaryReader |
reader, |
|
|
bool |
readStack = false , |
|
|
bool |
readFavorite = false |
|
) |
| |
|
static |
static int Terraria.ModLoader.IO.BinaryIO.ReadVarInt |
( |
this BinaryReader |
reader | ) |
|
|
static |
Definition at line 27 of file BinaryIO.cs.
36 throw new FormatException(
"variable length int with more than 32 bits");
39 b = reader.ReadByte();
40 count |= (b & 0x7F) << shift;
42 }
while ((b & 0x80) != 0);
Definition at line 54 of file BinaryIO.cs.
55 int length = reader.ReadVarInt();
56 var ms =
new MemoryStream(reader.ReadBytes(length));
58 if (ms.Position != length)
59 throw new IOException(
"Read underflow " + ms.Position +
" of " + length +
" bytes");
Definition at line 46 of file BinaryIO.cs.
47 var ms =
new MemoryStream();
49 writer.WriteVarInt((
int)ms.Length);
51 ms.CopyTo(writer.BaseStream);
static void Terraria.ModLoader.IO.BinaryIO.WriteItem |
( |
this BinaryWriter |
writer, |
|
|
Item |
item, |
|
|
bool |
readStack = false , |
|
|
bool |
readFavorite = false |
|
) |
| |
|
static |
static void Terraria.ModLoader.IO.BinaryIO.WriteVarInt |
( |
this BinaryWriter |
writer, |
|
|
int |
value |
|
) |
| |
|
static |
Definition at line 15 of file BinaryIO.cs.
20 writer.Write((byte)(v | 0x80));
23 writer.Write((byte)v);