Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EightBitStream.cs
Go to the documentation of this file.
1using System.IO;
2using System.Text;
3
4namespace System.Net.Mime;
5
7{
9
10 private readonly bool _shouldEncodeLeadingDots;
11
13
15 : base(stream)
16 {
17 }
18
19 internal EightBitStream(Stream stream, bool shouldEncodeLeadingDots)
20 : this(stream)
21 {
22 _shouldEncodeLeadingDots = shouldEncodeLeadingDots;
23 }
24
25 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
26 {
29 {
31 return base.BeginWrite(WriteState.Buffer, 0, WriteState.Length, callback, state);
32 }
33 return base.BeginWrite(buffer, offset, count, callback, state);
34 }
35
36 public override void EndWrite(IAsyncResult asyncResult)
37 {
38 base.EndWrite(asyncResult);
39 WriteState.BufferFlushed();
40 }
41
42 public override void Write(byte[] buffer, int offset, int count)
43 {
46 {
48 base.Write(WriteState.Buffer, 0, WriteState.Length);
49 WriteState.BufferFlushed();
50 }
51 else
52 {
53 base.Write(buffer, offset, count);
54 }
55 }
56
57 private void EncodeLines(byte[] buffer, int offset, int count)
58 {
59 for (int i = offset; i < offset + count && i < buffer.Length; i++)
60 {
61 if (buffer[i] == 13 && i + 1 < offset + count && buffer[i + 1] == 10)
62 {
63 WriteState.AppendCRLF(includeSpace: false);
64 i++;
65 }
66 else if (WriteState.CurrentLineLength == 0 && buffer[i] == 46)
67 {
68 WriteState.Append(46);
69 WriteState.Append(buffer[i]);
70 }
71 else
72 {
73 WriteState.Append(buffer[i]);
74 }
75 }
76 }
77
78 public int DecodeBytes(byte[] buffer, int offset, int count)
79 {
80 throw new NotImplementedException();
81 }
82
83 public int EncodeString(string value, Encoding encoding)
84 {
85 throw new NotImplementedException();
86 }
87
88 public string GetEncodedString()
89 {
90 throw new NotImplementedException();
91 }
92}
static void ValidateBufferArguments(byte[] buffer, int offset, int count)
Definition Stream.cs:1044
EightBitStream(Stream stream, bool shouldEncodeLeadingDots)
override void EndWrite(IAsyncResult asyncResult)
int DecodeBytes(byte[] buffer, int offset, int count)
override void Write(byte[] buffer, int offset, int count)
void EncodeLines(byte[] buffer, int offset, int count)
int EncodeString(string value, Encoding encoding)
WriteStateInfoBase _writeState
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)