Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
WriteStateInfoBase.cs
Go to the documentation of this file.
1
namespace
System.Net.Mime
;
2
3
internal
class
WriteStateInfoBase
4
{
5
protected
readonly
byte
[]
_header
;
6
7
protected
readonly
byte
[]
_footer
;
8
9
protected
readonly
int
_maxLineLength
;
10
11
protected
byte
[]
_buffer
;
12
13
protected
int
_currentLineLength
;
14
15
protected
int
_currentBufferUsed
;
16
17
internal
int
FooterLength
=>
_footer
.Length;
18
19
internal
byte
[]
Footer
=>
_footer
;
20
21
internal
byte
[]
Header
=>
_header
;
22
23
internal
byte
[]
Buffer
=>
_buffer
;
24
25
internal
int
Length
=>
_currentBufferUsed
;
26
27
internal
int
CurrentLineLength
=>
_currentLineLength
;
28
29
internal
int
MaxLineLength
=>
_maxLineLength
;
30
31
internal
WriteStateInfoBase
()
32
{
33
_header
=
Array
.Empty<
byte
>();
34
_footer
=
Array
.Empty<
byte
>();
35
_maxLineLength
= 70;
36
_buffer
=
new
byte
[1024];
37
_currentLineLength
= 0;
38
_currentBufferUsed
= 0;
39
}
40
41
internal
WriteStateInfoBase
(
int
bufferSize,
byte
[] header,
byte
[] footer,
int
maxLineLength)
42
: this(bufferSize, header, footer, maxLineLength, 0)
43
{
44
}
45
46
internal
WriteStateInfoBase
(
int
bufferSize,
byte
[] header,
byte
[] footer,
int
maxLineLength,
int
mimeHeaderLength)
47
{
48
_buffer
=
new
byte
[bufferSize];
49
_header
= header;
50
_footer
= footer;
51
_maxLineLength
= maxLineLength;
52
_currentLineLength
= mimeHeaderLength;
53
_currentBufferUsed
= 0;
54
}
55
56
private
void
EnsureSpaceInBuffer
(
int
moreBytes)
57
{
58
int
num =
Buffer
.Length;
59
while
(
_currentBufferUsed
+ moreBytes >= num)
60
{
61
num *= 2;
62
}
63
if
(num >
Buffer
.Length)
64
{
65
byte
[]
array
=
new
byte
[num];
66
_buffer
.CopyTo(
array
, 0);
67
_buffer
=
array
;
68
}
69
}
70
71
internal
void
Append
(
byte
aByte)
72
{
73
EnsureSpaceInBuffer
(1);
74
Buffer
[
_currentBufferUsed
++] = aByte;
75
_currentLineLength
++;
76
}
77
78
internal
void
Append
(params
byte
[]
bytes
)
79
{
80
EnsureSpaceInBuffer
(
bytes
.Length);
81
bytes
.CopyTo(
_buffer
,
Length
);
82
_currentLineLength
+=
bytes
.Length;
83
_currentBufferUsed
+=
bytes
.Length;
84
}
85
86
internal
void
AppendCRLF
(
bool
includeSpace)
87
{
88
AppendFooter
();
89
Append
(13, 10);
90
_currentLineLength
= 0;
91
if
(includeSpace)
92
{
93
Append
(32);
94
}
95
AppendHeader
();
96
}
97
98
internal
void
AppendHeader
()
99
{
100
if
(
Header
!=
null
&&
Header
.Length != 0)
101
{
102
Append
(
Header
);
103
}
104
}
105
106
internal
void
AppendFooter
()
107
{
108
if
(
Footer
!=
null
&&
Footer
.Length != 0)
109
{
110
Append
(
Footer
);
111
}
112
}
113
114
internal
void
Reset
()
115
{
116
_currentBufferUsed
= 0;
117
_currentLineLength
= 0;
118
}
119
120
internal
void
BufferFlushed
()
121
{
122
_currentBufferUsed
= 0;
123
}
124
}
System.Array
Definition
Array.cs:16
System.Buffer
Definition
Buffer.cs:8
System.Net.Mime.WriteStateInfoBase.EnsureSpaceInBuffer
void EnsureSpaceInBuffer(int moreBytes)
Definition
WriteStateInfoBase.cs:56
System.Net.Mime.WriteStateInfoBase._currentBufferUsed
int _currentBufferUsed
Definition
WriteStateInfoBase.cs:15
System.Net.Mime.WriteStateInfoBase.AppendCRLF
void AppendCRLF(bool includeSpace)
Definition
WriteStateInfoBase.cs:86
System.Net.Mime.WriteStateInfoBase.Append
void Append(params byte[] bytes)
Definition
WriteStateInfoBase.cs:78
System.Net.Mime.WriteStateInfoBase.Reset
void Reset()
Definition
WriteStateInfoBase.cs:114
System.Net.Mime.WriteStateInfoBase._header
readonly byte[] _header
Definition
WriteStateInfoBase.cs:5
System.Net.Mime.WriteStateInfoBase._buffer
byte[] _buffer
Definition
WriteStateInfoBase.cs:11
System.Net.Mime.WriteStateInfoBase.WriteStateInfoBase
WriteStateInfoBase(int bufferSize, byte[] header, byte[] footer, int maxLineLength)
Definition
WriteStateInfoBase.cs:41
System.Net.Mime.WriteStateInfoBase.FooterLength
int FooterLength
Definition
WriteStateInfoBase.cs:17
System.Net.Mime.WriteStateInfoBase.BufferFlushed
void BufferFlushed()
Definition
WriteStateInfoBase.cs:120
System.Net.Mime.WriteStateInfoBase.AppendFooter
void AppendFooter()
Definition
WriteStateInfoBase.cs:106
System.Net.Mime.WriteStateInfoBase.CurrentLineLength
int CurrentLineLength
Definition
WriteStateInfoBase.cs:27
System.Net.Mime.WriteStateInfoBase._maxLineLength
readonly int _maxLineLength
Definition
WriteStateInfoBase.cs:9
System.Net.Mime.WriteStateInfoBase.Length
int Length
Definition
WriteStateInfoBase.cs:25
System.Net.Mime.WriteStateInfoBase.WriteStateInfoBase
WriteStateInfoBase(int bufferSize, byte[] header, byte[] footer, int maxLineLength, int mimeHeaderLength)
Definition
WriteStateInfoBase.cs:46
System.Net.Mime.WriteStateInfoBase.MaxLineLength
int MaxLineLength
Definition
WriteStateInfoBase.cs:29
System.Net.Mime.WriteStateInfoBase.Append
void Append(byte aByte)
Definition
WriteStateInfoBase.cs:71
System.Net.Mime.WriteStateInfoBase.Footer
byte[] Footer
Definition
WriteStateInfoBase.cs:19
System.Net.Mime.WriteStateInfoBase.Header
byte[] Header
Definition
WriteStateInfoBase.cs:21
System.Net.Mime.WriteStateInfoBase._footer
readonly byte[] _footer
Definition
WriteStateInfoBase.cs:7
System.Net.Mime.WriteStateInfoBase.AppendHeader
void AppendHeader()
Definition
WriteStateInfoBase.cs:98
System.Net.Mime.WriteStateInfoBase._currentLineLength
int _currentLineLength
Definition
WriteStateInfoBase.cs:13
System.Net.Mime.WriteStateInfoBase.WriteStateInfoBase
WriteStateInfoBase()
Definition
WriteStateInfoBase.cs:31
System.Net.Mime.WriteStateInfoBase
Definition
WriteStateInfoBase.cs:4
System.Net.Mime
Definition
Base64Encoder.cs:1
System.ExceptionArgument.bytes
@ bytes
System.ExceptionArgument.array
@ array
source
System.Net.Mail
System.Net.Mime
WriteStateInfoBase.cs
Generated by
1.10.0