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
Timer.cs
Go to the documentation of this file.
1using System;
6
7namespace System.Threading
8{
9 // Token: 0x0200020F RID: 527
10 [ComVisible(true)]
11 public sealed class Timer : MarshalByRefObject, IDisposable
12 {
13 // Token: 0x170001C3 RID: 451
14 // (get) Token: 0x060012B0 RID: 4784 RVA: 0x0002772C File Offset: 0x0002592C
16 {
17 get
18 {
19 if (!true)
20 {
21 }
22 if (!true)
23 {
24 }
25 return 1;
26 }
27 }
28
29 // Token: 0x060012B1 RID: 4785 RVA: 0x00027740 File Offset: 0x00025940
30 public Timer(TimerCallback callback, object state, int dueTime, int period)
31 {
32 }
33
34 // Token: 0x060012B2 RID: 4786 RVA: 0x00027754 File Offset: 0x00025954
38
39 // Token: 0x060012B3 RID: 4787 RVA: 0x00027768 File Offset: 0x00025968
40 private void Init(TimerCallback callback, object state, long dueTime, long period)
41 {
42 while (callback == null)
43 {
44 }
47 bool flag = this.Change(dueTime, period, true);
48 }
49
50 // Token: 0x060012B4 RID: 4788 RVA: 0x00027794 File Offset: 0x00025994
51 public bool Change(int dueTime, int period)
52 {
53 long num = 0L;
54 bool flag = this.Change((long)dueTime, (long)period, num != 0L);
55 return true;
56 }
57
58 // Token: 0x060012B5 RID: 4789 RVA: 0x000277B0 File Offset: 0x000259B0
60 {
61 return true;
62 }
63
64 // Token: 0x060012B6 RID: 4790 RVA: 0x000277C0 File Offset: 0x000259C0
65 public void Dispose()
66 {
67 if (this.disposed)
68 {
69 return;
70 }
71 this.disposed = true;
72 Timer.scheduler.Remove(this);
73 }
74
75 // Token: 0x060012B7 RID: 4791 RVA: 0x000277E8 File Offset: 0x000259E8
76 private bool Change(long dueTime, long period, bool first)
77 {
78 /*
79An exception occurred when decompiling this method (060012B7)
80
81ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean System.Threading.Timer::Change(System.Int64,System.Int64,System.Boolean)
82
83 ---> System.Exception: Basic block has to end with unconditional control flow.
84{
85 IL_003A:
86 stloc:string(var_0_44, call:string(Environment::GetResourceString, ldstr:string("Cannot access a disposed object.")))
87}
88
89 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
90 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
91 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
92 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
93 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
94 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
95 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
96 --- End of inner exception stack trace ---
97 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
98 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
99*/;
100 }
101
102 // Token: 0x060012B8 RID: 4792 RVA: 0x0002783C File Offset: 0x00025A3C
104 {
105 }
106
107 // Token: 0x060012B9 RID: 4793 RVA: 0x0000207A File Offset: 0x0000027A
108 private static long GetTimeMonotonic()
109 {
110 throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
111 }
112
113 // Token: 0x04000A0B RID: 2571
115
116 // Token: 0x04000A0C RID: 2572
117 private object state;
118
119 // Token: 0x04000A0D RID: 2573
120 private long due_time_ms;
121
122 // Token: 0x04000A0E RID: 2574
123 private long period_ms;
124
125 // Token: 0x04000A0F RID: 2575
126 private long next_run;
127
128 // Token: 0x04000A10 RID: 2576
129 private bool disposed;
130
131 // Token: 0x04000A11 RID: 2577
132 private bool is_dead;
133
134 // Token: 0x04000A12 RID: 2578
135 private bool is_added;
136
137 // Token: 0x02000210 RID: 528
138 private struct TimerComparer : IComparer, IComparer<Timer>
139 {
140 // Token: 0x060012BA RID: 4794 RVA: 0x0002784C File Offset: 0x00025A4C
141 int IComparer.Compare(object x, object y)
142 {
143 if (x != null)
144 {
145 }
146 if (y != null)
147 {
148 }
149 return 1;
150 }
151
152 // Token: 0x060012BB RID: 4795 RVA: 0x00027864 File Offset: 0x00025A64
153 public int Compare(Timer tx, Timer ty)
154 {
155 int num = 1;
156 long next_run = tx.next_run;
157 long next_run2 = ty.next_run;
158 if (num == 0)
159 {
160 }
161 int num2;
162 return num2;
163 }
164 }
165
166 // Token: 0x02000211 RID: 529
167 private sealed class Scheduler
168 {
169 // Token: 0x060012BC RID: 4796 RVA: 0x00027888 File Offset: 0x00025A88
170 private void InitScheduler()
171 {
172 }
173
174 // Token: 0x060012BD RID: 4797 RVA: 0x00027898 File Offset: 0x00025A98
175 private void WakeupScheduler()
176 {
177 bool flag = this.changed.Set();
178 }
179
180 // Token: 0x060012BE RID: 4798 RVA: 0x000278B4 File Offset: 0x00025AB4
181 private void SchedulerThread()
182 {
184 Monitor.Enter(this, false);
185 bool flag = this.changed.Reset();
186 int num = this.RunSchedulerLoop();
187 long num2 = 0L;
188 if (true)
189 {
190 Monitor.Exit(this);
191 }
192 if (num2 == 0L)
193 {
195 return;
196 }
197 throw new OutOfMemoryException();
198 }
199
200 // Token: 0x170001C4 RID: 452
201 // (get) Token: 0x060012BF RID: 4799 RVA: 0x00027918 File Offset: 0x00025B18
203 {
204 get
205 {
206 if (!true)
207 {
208 }
209 return 1;
210 }
211 }
212
213 // Token: 0x060012C0 RID: 4800 RVA: 0x0002792C File Offset: 0x00025B2C
214 private Scheduler()
215 {
216 this.InitScheduler();
217 }
218
219 // Token: 0x060012C1 RID: 4801 RVA: 0x0002794C File Offset: 0x00025B4C
220 public void Remove(Timer timer)
221 {
222 timer.is_dead = true;
223 long num = 0L;
224 this.needReSort = true;
225 Monitor.Exit(this);
226 if (num == 0L)
227 {
228 return;
229 }
230 throw new OutOfMemoryException();
231 }
232
233 // Token: 0x060012C2 RID: 4802 RVA: 0x00027994 File Offset: 0x00025B94
234 public void Change(Timer timer, long new_next_run)
235 {
236 if (timer.is_dead)
237 {
238 }
239 }
240
241 // Token: 0x060012C3 RID: 4803 RVA: 0x0000207A File Offset: 0x0000027A
242 private void Add(Timer timer)
243 {
244 throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
245 }
246
247 // Token: 0x060012C4 RID: 4804 RVA: 0x000279D8 File Offset: 0x00025BD8
248 private void InternalRemove(Timer timer)
249 {
250 timer.is_dead = true;
251 this.needReSort = true;
252 }
253
254 // Token: 0x060012C5 RID: 4805 RVA: 0x000279F4 File Offset: 0x00025BF4
255 private static void TimerCB(object o)
256 {
257 if (o != null)
258 {
259 }
260 }
261
262 // Token: 0x060012C6 RID: 4806 RVA: 0x00027A0C File Offset: 0x00025C0C
263 private void FireTimer(Timer timer)
264 {
265 if (timer.period_ms == 0L)
266 {
267 long due_time_ms = timer.due_time_ms;
268 return;
269 }
270 long period_ms = timer.period_ms;
271 long num = 0L;
273 timer.is_dead = num != 0L;
274 }
275
276 // Token: 0x060012C7 RID: 4807 RVA: 0x00027A44 File Offset: 0x00025C44
277 private int RunSchedulerLoop()
278 {
279 /*
280An exception occurred when decompiling this method (060012C7)
281
282ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 System.Threading.Timer/Scheduler::RunSchedulerLoop()
283
284 ---> System.Exception: Basic block has to end with unconditional control flow.
285{
286 IL_008A:
287 stfld:int64(Scheduler::current_next_run, ldloc:Scheduler(this), ldloc:int64(var_3))
288}
289
290 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
291 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
292 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
293 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
294 --- End of inner exception stack trace ---
295 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
296 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
297*/;
298 }
299
300 // Token: 0x060012C8 RID: 4808 RVA: 0x00027AE8 File Offset: 0x00025CE8
301 // Note: this type is marked as 'beforefieldinit'.
302 static Scheduler()
303 {
304 }
305
306 // Token: 0x04000A13 RID: 2579
308
309 // Token: 0x04000A14 RID: 2580
310 private bool needReSort = true;
311
312 // Token: 0x04000A15 RID: 2581
314
315 // Token: 0x04000A16 RID: 2582
316 private long current_next_run;
317
318 // Token: 0x04000A17 RID: 2583
320 }
321 }
322}
class f__AnonymousType0<< Count > j__TPar
static void Exit(object obj)
Definition Monitor.cs:47
static void Enter(object obj)
Definition Monitor.cs:11
static Thread CurrentThread
Definition Thread.cs:381
void Add(Timer timer)
Definition Timer.cs:242
void FireTimer(Timer timer)
Definition Timer.cs:263
static void TimerCB(object o)
Definition Timer.cs:255
static Timer.Scheduler Instance
Definition Timer.cs:203
static readonly Timer.Scheduler instance
Definition Timer.cs:307
void Remove(Timer timer)
Definition Timer.cs:220
ManualResetEvent changed
Definition Timer.cs:319
void InternalRemove(Timer timer)
Definition Timer.cs:248
void Change(Timer timer, long new_next_run)
Definition Timer.cs:234
static Timer.Scheduler scheduler
Definition Timer.cs:16
Timer(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
Definition Timer.cs:35
void KeepRootedWhileScheduled()
Definition Timer.cs:103
Timer(TimerCallback callback, object state, int dueTime, int period)
Definition Timer.cs:30
bool Change(TimeSpan dueTime, TimeSpan period)
Definition Timer.cs:59
static long GetTimeMonotonic()
Definition Timer.cs:108
bool Change(long dueTime, long period, bool first)
Definition Timer.cs:76
void Init(TimerCallback callback, object state, long dueTime, long period)
Definition Timer.cs:40
TimerCallback callback
Definition Timer.cs:114
bool Change(int dueTime, int period)
Definition Timer.cs:51
int Compare(Timer tx, Timer ty)
Definition Timer.cs:153