Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FrameHeader.cs
Go to the documentation of this file.
1namespace System.Net;
2
3internal sealed class FrameHeader
4{
5 private int _payloadSize = -1;
6
7 public int MessageId { get; set; } = 22;
8
9
10 public int MajorV { get; private set; } = 1;
11
12
13 public int MinorV { get; private set; }
14
15 public int PayloadSize
16 {
17 get
18 {
19 return _payloadSize;
20 }
21 set
22 {
23 if (value > 65535)
24 {
25 throw new ArgumentException(System.SR.Format(System.SR.net_frame_max_size, 65535, value), "PayloadSize");
26 }
28 }
29 }
30
31 public void CopyTo(byte[] dest, int start)
32 {
33 dest[start++] = (byte)MessageId;
34 dest[start++] = (byte)MajorV;
35 dest[start++] = (byte)MinorV;
36 dest[start++] = (byte)((uint)(_payloadSize >> 8) & 0xFFu);
37 dest[start] = (byte)((uint)_payloadSize & 0xFFu);
38 }
39
40 public void CopyFrom(byte[] bytes, int start)
41 {
43 MajorV = bytes[start++];
44 MinorV = bytes[start++];
45 _payloadSize = (bytes[start++] << 8) | bytes[start];
46 }
47}
void CopyTo(byte[] dest, int start)
void CopyFrom(byte[] bytes, int start)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_frame_max_size
Definition SR.cs:88
Definition SR.cs:7