Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PermissionSetEncoder.cs
Go to the documentation of this file.
2
4
5public readonly struct PermissionSetEncoder
6{
7 public BlobBuilder Builder { get; }
8
10 {
11 Builder = builder;
12 }
13
14 public PermissionSetEncoder AddPermission(string typeName, ImmutableArray<byte> encodedArguments)
15 {
16 if (typeName == null)
17 {
18 Throw.ArgumentNull("typeName");
19 }
20 if (encodedArguments.IsDefault)
21 {
22 Throw.ArgumentNull("encodedArguments");
23 }
24 if (encodedArguments.Length > 536870911)
25 {
26 Throw.BlobTooLarge("encodedArguments");
27 }
29 Builder.WriteCompressedInteger(encodedArguments.Length);
30 Builder.WriteBytes(encodedArguments);
31 return this;
32 }
33
34 public PermissionSetEncoder AddPermission(string typeName, BlobBuilder encodedArguments)
35 {
36 if (typeName == null)
37 {
38 Throw.ArgumentNull("typeName");
39 }
40 if (encodedArguments == null)
41 {
42 Throw.ArgumentNull("encodedArguments");
43 }
44 if (encodedArguments.Count > 536870911)
45 {
46 Throw.BlobTooLarge("encodedArguments");
47 }
49 Builder.WriteCompressedInteger(encodedArguments.Count);
50 encodedArguments.WriteContentTo(Builder);
51 return this;
52 }
53}
void WriteSerializedString(string? value)
void WriteContentTo(Stream destination)
void WriteBytes(byte value, int byteCount)
static void ArgumentNull(string parameterName)
Definition Throw.cs:110
static void BlobTooLarge(string parameterName)
Definition Throw.cs:159
PermissionSetEncoder AddPermission(string typeName, ImmutableArray< byte > encodedArguments)
PermissionSetEncoder AddPermission(string typeName, BlobBuilder encodedArguments)