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
Server.cs
Go to the documentation of this file.
1using System;
4using System.Net;
8using UnityEngine;
9
10namespace Telepathy
11{
12 // Token: 0x02000317 RID: 791
13 public class Server : Common
14 {
15 // Token: 0x06001274 RID: 4724 RVA: 0x00059C60 File Offset: 0x00057E60
17 {
19 int num = 1;
21 if (endPoint != null)
22 {
23 }
24 if (newClient.m_ClientSocket.RemoteEndPoint != null)
25 {
26 }
28 bool flag = this.Disconnect(num);
29 Thread.Sleep(10);
30 return num;
31 }
32
33 // Token: 0x170001D0 RID: 464
34 // (get) Token: 0x06001275 RID: 4725 RVA: 0x00059CA8 File Offset: 0x00057EA8
35 public bool Active
36 {
37 get
38 {
39 Thread thread = this.listenerThread;
40 bool isAlive;
41 if (thread != null)
42 {
43 isAlive = thread.IsAlive;
44 return isAlive;
45 }
46 return isAlive;
47 }
48 }
49
50 // Token: 0x06001276 RID: 4726 RVA: 0x00059CCC File Offset: 0x00057ECC
51 private void Listen(int port)
52 {
54 if (tcpClient != null)
55 {
56 int num = this.NextConnectionId(tcpClient);
58 return;
59 }
60 }
61
62 // Token: 0x06001277 RID: 4727 RVA: 0x00059D14 File Offset: 0x00057F14
63 public bool Start(int port)
64 {
65 /*
66An exception occurred when decompiling this method (06001277)
67
68ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean Telepathy.Server::Start(System.Int32)
69
70 ---> System.Exception: Basic block has to end with unconditional control flow.
71{
72 Block_2:
73 call:void(TcpListener::Stop, ldloc:TcpListener(var_19_C0))
74}
75
76 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
77 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
78 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
79 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
80 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
81 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
82 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
83 --- End of inner exception stack trace ---
84 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
85 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
86*/;
87 }
88
89 // Token: 0x06001278 RID: 4728 RVA: 0x00059DF0 File Offset: 0x00057FF0
90 private void Cleanup()
91 {
92 IEnumerator enumerator = this.clients.GetEnumerator();
93 }
94
95 // Token: 0x06001279 RID: 4729 RVA: 0x00059E60 File Offset: 0x00058060
96 public void Stop()
97 {
98 Thread thread = this.listenerThread;
99 if (thread != null)
100 {
101 bool isAlive = thread.IsAlive;
102 if (!true)
103 {
104 }
106 if (tcpListener != null)
107 {
109 }
111 if (thread2 != null)
112 {
114 }
115 if (!true)
116 {
117 }
118 Thread.Sleep(10);
120 if (tcpListener2 != null)
121 {
123 }
124 }
125 this.Cleanup();
126 }
127
128 // Token: 0x0600127A RID: 4730 RVA: 0x00059EC4 File Offset: 0x000580C4
129 public bool Send(int connectionId, byte[] data, int length)
130 {
131 if (this.MaxMessageSize == 0)
132 {
133 }
134 string text2;
135 string text3;
136 string text = "Client.Send: message too big: " + text2 + ". Limit: " + text3;
137 bool noDelay = this.NoDelay;
140 return true;
141 }
142
143 // Token: 0x0600127B RID: 4731 RVA: 0x00059F14 File Offset: 0x00058114
144 public string GetClientAddress(int connectionId)
145 {
148 if (endPoint != null)
149 {
150 }
151 return "";
152 }
153
154 // Token: 0x0600127C RID: 4732 RVA: 0x00059F38 File Offset: 0x00058138
155 public bool Disconnect(int connectionId)
156 {
158 if (!true)
159 {
160 }
161 string text2;
162 string text = "Server.Disconnect connectionId:" + text2;
163 return true;
164 }
165
166 // Token: 0x0600127D RID: 4733 RVA: 0x00059F60 File Offset: 0x00058160
167 public Server()
168 {
169 if (!true)
170 {
171 }
172 base..ctor();
173 }
174
175 // Token: 0x04002209 RID: 8713
177
178 // Token: 0x0400220A RID: 8714
180
181 // Token: 0x0400220B RID: 8715
183
184 // Token: 0x0400220C RID: 8716
185 private static int counter;
186
187 // Token: 0x02000318 RID: 792
188 private class ClientToken
189 {
190 // Token: 0x0600127E RID: 4734 RVA: 0x00059F78 File Offset: 0x00058178
192 {
194 }
195
196 // Token: 0x0400220D RID: 8717
198
199 // Token: 0x0400220E RID: 8718
201
202 // Token: 0x0400220F RID: 8719
204 }
205
206 // Token: 0x02000319 RID: 793
208 private sealed class <>c__DisplayClass8_0
209 {
210 // Token: 0x0600127F RID: 4735 RVA: 0x00059F94 File Offset: 0x00058194
212 {
213 }
214
215 // Token: 0x06001280 RID: 4736 RVA: 0x00059FA8 File Offset: 0x000581A8
216 internal void <Listen>b__0()
217 {
218 TcpClient tcpClient = this.client;
219 Server.ClientToken clientToken = this.token;
220 int num = this.connectionId;
221 SafeQueue<byte[]> sendQueue = clientToken.sendQueue;
222 ManualResetEvent sendPending = clientToken.sendPending;
223 Common.SendLoop(num, tcpClient, sendQueue, sendPending);
224 }
225
226 // Token: 0x06001281 RID: 4737 RVA: 0x00059FEC File Offset: 0x000581EC
227 internal void <Listen>b__1()
228 {
229 Server server = this.<>4__this;
230 int num = this.connectionId;
231 TcpClient tcpClient = this.client;
232 ConcurrentQueue<Message> receiveQueue = server.receiveQueue;
233 int maxMessageSize = server.MaxMessageSize;
234 Common.ReceiveLoop(num, tcpClient, receiveQueue, maxMessageSize);
235 int num2 = this.connectionId;
236 string text;
238 Server server2 = this.<>4__this;
239 int num3 = this.connectionId;
240 ConcurrentDictionary<int, Server.ClientToken> clients = server2.clients;
241 Thread thread = this.sendThread;
242 thread.Interrupt();
243 }
244
245 // Token: 0x04002210 RID: 8720
246 public int connectionId;
247
248 // Token: 0x04002211 RID: 8721
249 public TcpClient client;
250
251 // Token: 0x04002212 RID: 8722
252 public Server.ClientToken token;
253
254 // Token: 0x04002213 RID: 8723
255 public Thread sendThread;
256
257 // Token: 0x04002214 RID: 8724
258 public Server <>4__this;
259 }
260
261 // Token: 0x0200031A RID: 794
263 private sealed class <>c__DisplayClass9_0
264 {
265 // Token: 0x06001282 RID: 4738 RVA: 0x0005A06C File Offset: 0x0005826C
267 {
268 }
269
270 // Token: 0x06001283 RID: 4739 RVA: 0x0005A080 File Offset: 0x00058280
271 internal void <Start>b__0()
272 {
273 Server server = this.<>4__this;
274 }
275
276 // Token: 0x04002215 RID: 8725
277 public Server <>4__this;
278
279 // Token: 0x04002216 RID: 8726
280 public int port;
281 }
282 }
283}
class f__AnonymousType0<< Count > j__TPar
static void Sleep(int millisecondsTimeout)
Definition Thread.cs:207
ConcurrentQueue< Message > receiveQueue
Definition Common.cs:110
static void SendLoop(int connectionId, TcpClient client, SafeQueue< byte[]> sendQueue, ManualResetEvent sendPending)
Definition Common.cs:87
SafeQueue< byte[]> sendQueue
Definition Server.cs:200
ClientToken(TcpClient client)
Definition Server.cs:191
ManualResetEvent sendPending
Definition Server.cs:203
void Cleanup()
Definition Server.cs:90
bool Start(int port)
Definition Server.cs:63
static int counter
Definition Server.cs:185
Thread listenerThread
Definition Server.cs:179
void Listen(int port)
Definition Server.cs:51
string GetClientAddress(int connectionId)
Definition Server.cs:144
bool Send(int connectionId, byte[] data, int length)
Definition Server.cs:129
TcpListener listener
Definition Server.cs:176
bool Disconnect(int connectionId)
Definition Server.cs:155
ConcurrentDictionary< int, Server.ClientToken > clients
Definition Server.cs:182
void Stop()
Definition Server.cs:96
int NextConnectionId(TcpClient newClient)
Definition Server.cs:16
static void LogError(object message)
Definition Debug.cs:62