terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
Client.cs
Go to the documentation of this file.
1using System;
3using System.Net;
9using UnityEngine;
10
11namespace Telepathy
12{
13 // Token: 0x02000310 RID: 784
14 public class Client : Common
15 {
16 // Token: 0x170001CC RID: 460
17 // (get) Token: 0x06001258 RID: 4696 RVA: 0x00059424 File Offset: 0x00057624
18 public bool Connected
19 {
20 get
21 {
23 if (tcpClient == null)
24 {
25 return;
26 }
27 Socket clientSocket = tcpClient.m_ClientSocket;
28 if (clientSocket != null)
29 {
30 bool is_connected = clientSocket.is_connected;
31 return;
32 }
33 }
34 }
35
36 // Token: 0x170001CD RID: 461
37 // (get) Token: 0x06001259 RID: 4697 RVA: 0x00059450 File Offset: 0x00057650
38 public bool Connecting
39 {
40 get
41 {
42 return this._Connecting;
43 }
44 }
45
46 // Token: 0x0600125A RID: 4698 RVA: 0x00059464 File Offset: 0x00057664
47 private bool GetIPV6AddressFromIPV4(string hostname, [Out] string ipv6Address)
48 {
49 IPHostEntry hostEntry = Dns.GetHostEntry("re-logic.com");
51 if (hostEntry != null)
52 {
53 IPAddress[] addressList = hostEntry.addressList;
54 if (addressList != null)
55 {
56 ushort[] numbers = addressList._numbers;
57 string toString = addressList._toString;
58 addressList2 = hostEntry.addressList;
59 }
60 }
61 string toString2 = addressList2._toString;
62 long num = 0L;
63 int num2 = toString2.IndexOf("::");
64 long num3 = 0L;
65 string text = toString2.Substring((int)num3, (int)num);
66 string text2;
67 string text3;
68 string text4;
69 string text5;
70 if ((text == null || text != null) && (text2 == null || text2 != null) && (text3 == null || text3 != null) && (":" == null || ":" != null) && (text4 == null || text4 != null) && (text5 == null || text5 != null))
71 {
72 string text7;
73 string text6 = text7.ToLower();
74 }
76 }
77
78 // Token: 0x0600125B RID: 4699 RVA: 0x0005952C File Offset: 0x0005772C
79 private void ReceiveThreadFunction(string ip, int port)
80 {
82 if (tcpClient != null)
83 {
84 tcpClient.Connect(ip, port);
85 if (this.client != null)
86 {
88 bool noDelay = this.NoDelay;
91 int sendTimeout = this.SendTimeout;
93 this.sendThread.Start();
98 Thread thread = this.sendThread;
99 if (thread != null)
100 {
101 thread.Interrupt();
102 }
104 if (tcpClient5 != null)
105 {
107 }
108 return;
109 }
110 }
111 }
112
113 // Token: 0x0600125C RID: 4700 RVA: 0x00059670 File Offset: 0x00057870
115 {
117 string text;
118 bool flag = text.Contains("virtual");
119 string text2;
120 bool flag2 = text2.Contains("pseudo");
121 long num;
122 int num2;
123 if (allNetworkInterfaces == null)
124 {
125 num = 0L;
126 num2 = 5;
127 if (allNetworkInterfaces != null)
128 {
129 }
130 }
131 if (num == 0L)
132 {
133 if (num2 == 0)
134 {
135 while (allNetworkInterfaces != null)
136 {
137 }
138 }
139 long num3 = 0L;
140 if (allNetworkInterfaces != null)
141 {
142 }
143 if (num3 == 0L)
144 {
145 }
146 throw new OutOfMemoryException();
147 }
148 throw new OutOfMemoryException();
149 }
150
151 // Token: 0x0600125D RID: 4701 RVA: 0x000596DC File Offset: 0x000578DC
152 public void Connect(string ip, int port)
153 {
154 for (;;)
155 {
156 Debug.Log("Connecting" + ip);
157 if (this._Connecting)
158 {
159 break;
160 }
162 if (tcpClient == null)
163 {
164 goto IL_0035;
165 }
166 Socket clientSocket = tcpClient.m_ClientSocket;
167 if (clientSocket == null || !clientSocket.is_connected)
168 {
169 goto IL_0035;
170 }
171 }
172 return;
173 IL_0035:
174 this._Connecting = true;
175 this.sendQueue.Clear();
176 this.receiveThread.Start();
177 }
178
179 // Token: 0x0600125E RID: 4702 RVA: 0x0005973C File Offset: 0x0005793C
180 public void Disconnect()
181 {
182 while (!this._Connecting)
183 {
185 if (tcpClient != null)
186 {
187 Socket clientSocket = tcpClient.m_ClientSocket;
188 if (clientSocket != null)
189 {
190 if (!clientSocket.is_connected)
191 {
192 return;
193 }
194 continue;
195 }
196 }
197 return;
198 }
199 if (this._Connecting)
200 {
201 Thread thread = this.receiveThread;
202 if (thread != null)
203 {
204 thread.Interrupt();
205 }
207 if (thread2 != null)
208 {
210 }
212 if (tcpClient2 != null)
213 {
215 return;
216 }
217 }
218 else
219 {
221 if (tcpClient3 != null)
222 {
224 }
226 if (thread3 != null)
227 {
228 thread3.Join();
229 }
231 if (safeQueue != null)
232 {
234 }
235 }
237 if (tcpClient4 != null)
238 {
240 return;
241 }
242 }
243
244 // Token: 0x0600125F RID: 4703 RVA: 0x000597F8 File Offset: 0x000579F8
245 public bool Send(byte[] data, int length)
246 {
248 if (tcpClient != null)
249 {
250 Socket clientSocket = tcpClient.m_ClientSocket;
251 if (clientSocket != null && clientSocket.is_connected)
252 {
253 if (this.MaxMessageSize == 0)
254 {
255 }
256 string text2;
257 string text3;
258 string text = "Client.Send: message too big: " + text2 + ". Limit: " + text3;
259 return "Client.Send: message too big: " != null;
260 }
261 }
262 if ("Client.Send: message too big: " == null)
263 {
264 }
265 return true;
266 }
267
268 // Token: 0x06001260 RID: 4704 RVA: 0x00059850 File Offset: 0x00057A50
269 public Client()
270 {
271 if (!true)
272 {
273 }
274 base..ctor();
275 }
276
277 // Token: 0x06001261 RID: 4705 RVA: 0x00059868 File Offset: 0x00057A68
289
290 // Token: 0x040021EE RID: 8686
292
293 // Token: 0x040021EF RID: 8687
295
296 // Token: 0x040021F0 RID: 8688
298
299 // Token: 0x040021F1 RID: 8689
300 private bool _Connecting;
301
302 // Token: 0x040021F2 RID: 8690
304
305 // Token: 0x040021F3 RID: 8691
307
308 // Token: 0x02000311 RID: 785
310 private sealed class <>c__DisplayClass13_0
311 {
312 // Token: 0x06001262 RID: 4706 RVA: 0x00059898 File Offset: 0x00057A98
314 {
315 }
316
317 // Token: 0x06001263 RID: 4707 RVA: 0x000598AC File Offset: 0x00057AAC
318 internal void <Connect>b__0()
319 {
320 Client client = this.<>4__this;
321 string text = this.ip;
322 int num = this.port;
323 client.ReceiveThreadFunction(text, num);
324 }
325
326 // Token: 0x040021F4 RID: 8692
327 public Client <>4__this;
328
329 // Token: 0x040021F5 RID: 8693
330 public string ip;
331
332 // Token: 0x040021F6 RID: 8694
333 public int port;
334 }
335 }
336}
class f__AnonymousType0<< Count > j__TPar
static IPHostEntry GetHostEntry(string hostNameOrAddress)
Definition Dns.cs:200
readonly ushort[] _numbers
Definition IPAddress.cs:749
static NetworkInterface[] GetAllNetworkInterfaces()
virtual void Dispose(bool disposing)
Definition TcpClient.cs:237
void Connect(string hostname, int port)
Definition TcpClient.cs:64
void Connect(string ip, int port)
Definition Client.cs:152
Thread receiveThread
Definition Client.cs:294
bool Connecting
Definition Client.cs:39
bool Send(byte[] data, int length)
Definition Client.cs:245
bool GetIPV6AddressFromIPV4(string hostname, [Out] string ipv6Address)
Definition Client.cs:47
void< ReceiveThreadFunction > b__11_0()
Definition Client.cs:279
Thread sendThread
Definition Client.cs:297
TcpClient client
Definition Client.cs:291
void Disconnect()
Definition Client.cs:180
void ReceiveThreadFunction(string ip, int port)
Definition Client.cs:79
IPAddress GetIPAddress()
Definition Client.cs:114
ManualResetEvent sendPending
Definition Client.cs:306
SafeQueue< byte[]> sendQueue
Definition Client.cs:303
ConcurrentQueue< Message > receiveQueue
Definition Common.cs:110
static void SendLoop(int connectionId, TcpClient client, SafeQueue< byte[]> sendQueue, ManualResetEvent sendPending)
Definition Common.cs:87
static void ReceiveLoop(int connectionId, TcpClient client, ConcurrentQueue< Message > receiveQueue, int MaxMessageSize)
Definition Common.cs:66
static void Log(object message)
Definition Debug.cs:51