Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HeaderField.cs
Go to the documentation of this file.
1using System.Text;
2
4
5internal readonly struct HeaderField
6{
7 public byte[] Name { get; }
8
9 public byte[] Value { get; }
10
11 public int Length => GetLength(Name.Length, Value.Length);
12
14 {
15 Name = name.ToArray();
16 Value = value.ToArray();
17 }
18
19 public static int GetLength(int nameLength, int valueLength)
20 {
21 return nameLength + valueLength + 32;
22 }
23
24 public override string ToString()
25 {
26 if (Name != null)
27 {
28 return Encoding.Latin1.GetString(Name) + ": " + Encoding.Latin1.GetString(Value);
29 }
30 return "<empty>";
31 }
32}
static Encoding Latin1
Definition Encoding.cs:513
HeaderField(ReadOnlySpan< byte > name, ReadOnlySpan< byte > value)
static int GetLength(int nameLength, int valueLength)