4 public class BinaryReaderBE
: BinaryReader
6 public BinaryReaderBE(Stream stream
, Encoding encoding
) : base(stream
, encoding
) { }
7 public BinaryReaderBE(Stream stream
) : base(stream
) { }
9 public override short ReadInt16()
11 byte byte1
= ReadByte();
12 byte byte2
= ReadByte();
13 return (short) (byte1
<< 8 | byte2
);
16 public override ushort ReadUInt16()
18 byte byte1
= ReadByte();
19 byte byte2
= ReadByte();
20 return (ushort) (byte1
<< 8 | byte2
);
23 public override int ReadInt32()
25 byte byte1
= ReadByte();
26 byte byte2
= ReadByte();
27 byte byte3
= ReadByte();
28 byte byte4
= ReadByte();
30 return (int) ((byte1
<< 24) | (byte2
<< 16) | (byte3
<< 8) | (byte4
));
32 public override uint ReadUInt32()
34 byte byte1
= ReadByte();
35 byte byte2
= ReadByte();
36 byte byte3
= ReadByte();
37 byte byte4
= ReadByte();
38 return (uint) ((byte1
<< 24) | (byte2
<< 16) | (byte3
<< 8) | (byte4
));
41 public string ReadMacString(int length
)
43 byte[] bytes
= ReadBytes(length
);
44 Encoding macRoman
= Encoding
.GetEncoding(10000);
45 return macRoman
.GetString(bytes
).Split('\0')[0];