Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CheckCommand.cs
Go to the documentation of this file.
3
4namespace System.Net.Mail;
5
6internal static class CheckCommand
7{
8 private static readonly AsyncCallback s_onReadLine = OnReadLine;
9
10 private static readonly AsyncCallback s_onWrite = OnWrite;
11
12 internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
13 {
14 MultiAsyncResult multiAsyncResult = new MultiAsyncResult(conn, callback, state);
15 multiAsyncResult.Enter();
16 IAsyncResult asyncResult = conn.BeginFlush(s_onWrite, multiAsyncResult);
17 if (asyncResult.CompletedSynchronously)
18 {
20 multiAsyncResult.Leave();
21 }
22 SmtpReplyReader nextReplyReader = conn.Reader.GetNextReplyReader();
23 multiAsyncResult.Enter();
24 IAsyncResult asyncResult2 = nextReplyReader.BeginReadLine(s_onReadLine, multiAsyncResult);
25 if (asyncResult2.CompletedSynchronously)
26 {
27 LineInfo lineInfo = nextReplyReader.EndReadLine(asyncResult2);
28 if (!(multiAsyncResult.Result is Exception))
29 {
30 multiAsyncResult.Result = lineInfo;
31 }
32 multiAsyncResult.Leave();
33 }
34 multiAsyncResult.CompleteSequence();
35 return multiAsyncResult;
36 }
37
38 internal static object EndSend(IAsyncResult result, out string response)
39 {
40 object obj = MultiAsyncResult.End(result);
41 if (obj is Exception source)
42 {
44 }
45 LineInfo lineInfo = (LineInfo)obj;
46 response = lineInfo.Line;
47 return lineInfo.StatusCode;
48 }
49
50 private static void OnReadLine(IAsyncResult result)
51 {
52 if (result.CompletedSynchronously)
53 {
54 return;
55 }
56 MultiAsyncResult multiAsyncResult = (MultiAsyncResult)result.AsyncState;
57 try
58 {
59 SmtpConnection smtpConnection = (SmtpConnection)multiAsyncResult.Context;
60 LineInfo lineInfo = smtpConnection.Reader.CurrentReader.EndReadLine(result);
61 if (!(multiAsyncResult.Result is Exception))
62 {
63 multiAsyncResult.Result = lineInfo;
64 }
65 multiAsyncResult.Leave();
66 }
67 catch (Exception result2)
68 {
69 multiAsyncResult.Leave(result2);
70 }
71 }
72
73 private static void OnWrite(IAsyncResult result)
74 {
75 if (!result.CompletedSynchronously)
76 {
77 MultiAsyncResult multiAsyncResult = (MultiAsyncResult)result.AsyncState;
78 try
79 {
80 SmtpConnection smtpConnection = (SmtpConnection)multiAsyncResult.Context;
81 smtpConnection.EndFlush(result);
82 multiAsyncResult.Leave();
83 }
84 catch (Exception result2)
85 {
86 multiAsyncResult.Leave(result2);
87 }
88 }
89 }
90
91 internal static SmtpStatusCode Send(SmtpConnection conn, out string response)
92 {
93 conn.Flush();
94 SmtpReplyReader nextReplyReader = conn.Reader.GetNextReplyReader();
95 LineInfo lineInfo = nextReplyReader.ReadLine();
96 response = lineInfo.Line;
97 nextReplyReader.Close();
98 return lineInfo.StatusCode;
99 }
100}
static SmtpStatusCode Send(SmtpConnection conn, out string response)
static void OnReadLine(IAsyncResult result)
static readonly AsyncCallback s_onReadLine
static readonly AsyncCallback s_onWrite
static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
static object EndSend(IAsyncResult result, out string response)
static void OnWrite(IAsyncResult result)
SmtpReplyReaderFactory Reader
void EndFlush(IAsyncResult result)
IAsyncResult BeginFlush(AsyncCallback callback, object state)
LineInfo EndReadLine(IAsyncResult result)
IAsyncResult BeginReadLine(AsyncCallback callback, object state)
static object End(IAsyncResult result)
SmtpStatusCode StatusCode
Definition LineInfo.cs:11