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
Preferences.cs
Go to the documentation of this file.
1using System;
3using System.IO;
9
10namespace Terraria.IO
11{
12 // Token: 0x02000564 RID: 1380
13 public class Preferences
14 {
15 // Token: 0x1400003B RID: 59
16 // (add) Token: 0x0600338F RID: 13199 RVA: 0x001FFCC4 File Offset: 0x001FDEC4
17 // (remove) Token: 0x06003390 RID: 13200 RVA: 0x001FFCEC File Offset: 0x001FDEEC
19 {
21 add
22 {
24 if (@delegate != null && @delegate == null)
25 {
26 return;
27 }
28 }
30 remove
31 {
33 if (@delegate != null && @delegate == null)
34 {
35 return;
36 }
37 }
38 }
39
40 // Token: 0x1400003C RID: 60
41 // (add) Token: 0x06003391 RID: 13201 RVA: 0x001FFD14 File Offset: 0x001FDF14
42 // (remove) Token: 0x06003392 RID: 13202 RVA: 0x001FFD3C File Offset: 0x001FDF3C
44 {
46 add
47 {
49 if (@delegate != null && @delegate == null)
50 {
51 return;
52 }
53 }
55 remove
56 {
58 if (@delegate != null && @delegate == null)
59 {
60 return;
61 }
62 }
63 }
64
65 // Token: 0x1400003D RID: 61
66 // (add) Token: 0x06003393 RID: 13203 RVA: 0x001FFD64 File Offset: 0x001FDF64
67 // (remove) Token: 0x06003394 RID: 13204 RVA: 0x001FFD88 File Offset: 0x001FDF88
69 {
71 add
72 {
73 if (Delegate.Combine(this.OnProcessText, value) != null)
74 {
75 }
76 }
78 remove
79 {
80 if (Delegate.Remove(this.OnProcessText, value) != null)
81 {
82 }
83 }
84 }
85
86 // Token: 0x06003395 RID: 13205 RVA: 0x001FFDAC File Offset: 0x001FDFAC
87 public Preferences(string path, bool parseAllTypes = false, bool useBson = false)
88 {
89 this._path = path;
90 }
91
92 // Token: 0x06003396 RID: 13206 RVA: 0x001FFDC8 File Offset: 0x001FDFC8
93 public bool Load()
94 {
95 int num = 1;
96 object @lock = this._lock;
97 string path = this._path;
98 if (num == 0)
99 {
100 }
101 long num2 = 0L;
102 bool flag = FileUtilities.Exists(path, num2 != 0L);
103 bool useBson = this.UseBson;
104 string path2 = this._path;
105 int num4;
106 if (useBson)
107 {
108 if (num == 0)
109 {
110 }
111 long num3 = 0L;
115 num4 = 6;
116 if (useBson)
117 {
118 }
119 }
121 string text;
123 if (text == null)
124 {
125 if (serializerSettings != null)
126 {
127 throw new OutOfMemoryException();
128 }
129 int num5;
130 if (num4 == 0)
131 {
132 num5 = 5;
133 if (text != null)
134 {
135 goto IL_0089;
136 }
137 }
138 long num6 = 0L;
139 if (text == null)
140 {
141 goto IL_008D;
142 }
143 IL_0089:
144 if (useBson)
145 {
146 }
147 IL_008D:
148 if (num6 != 0L)
149 {
150 goto IL_00AB;
151 }
152 if (num5 != 0)
153 {
154 long num7 = 0L;
155 Monitor.Exit(@lock);
156 if (num7 == 0L)
157 {
158 }
159 throw new OutOfMemoryException();
160 }
161 if (this._data == null)
162 {
163 }
164 }
165 if (this.OnLoad != null)
166 {
167 }
168 IL_00AB:
169 throw new OutOfMemoryException();
170 }
171
172 // Token: 0x06003397 RID: 13207 RVA: 0x001FFF0C File Offset: 0x001FE10C
173 public bool Save(bool canCreateFile = true)
174 {
175 object @lock = this._lock;
178 if (onSave != null)
179 {
180 }
181 string path = this._path;
182 if (onSave == null)
183 {
184 }
185 long num = 0L;
186 bool flag = FileUtilities.Exists(path, num != 0L);
188 string path2 = this._path;
189 if (onSave == null)
190 {
191 }
192 string path3 = this._path;
193 if (onSave == null)
194 {
195 }
196 if (this.UseBson)
197 {
200 }
202 string path4 = this._path;
204 string path5 = this._path;
205 string text;
206 if (text == null)
207 {
208 string path6 = this._path;
209 long num2 = 0L;
210 int num3 = 7;
211 if (num2 != 0L)
212 {
213 throw new OutOfMemoryException();
214 }
215 if (num3 != 0)
216 {
217 }
218 }
219 throw new OutOfMemoryException();
220 }
221
222 // Token: 0x06003398 RID: 13208 RVA: 0x0020005C File Offset: 0x001FE25C
223 public void Clear()
224 {
226 }
227
228 // Token: 0x06003399 RID: 13209 RVA: 0x00200070 File Offset: 0x001FE270
229 public void Put(string name, object value)
230 {
231 object @lock = this._lock;
233 bool autoSave = this.AutoSave;
234 if (autoSave)
235 {
236 bool flag = this.Save(true);
237 }
238 long num = 0L;
239 if (autoSave)
240 {
241 Monitor.Exit(@lock);
242 }
243 if (num == 0L)
244 {
245 return;
246 }
247 throw new OutOfMemoryException();
248 }
249
250 // Token: 0x0600339A RID: 13210 RVA: 0x002000D8 File Offset: 0x001FE2D8
251 public bool Contains(string name)
252 {
253 object @lock = this._lock;
255 long num = 0L;
256 Monitor.Exit(@lock);
257 if (num == 0L)
258 {
259 }
260 throw new OutOfMemoryException();
261 }
262
263 // Token: 0x0600339B RID: 13211 RVA: 0x00200120 File Offset: 0x001FE320
264 public T Get<T>(string name, T defaultValue)
265 {
266 object @lock = this._lock;
268 if (name != null)
269 {
270 }
271 if (name != null)
272 {
273 }
274 Type type;
275 object obj = Convert.ChangeType(name, type);
276 throw new InvalidCastException();
277 }
278
279 // Token: 0x0600339C RID: 13212 RVA: 0x0020018C File Offset: 0x001FE38C
280 public void Get<T>(string name, T currentValue)
281 {
282 }
283
284 // Token: 0x0600339D RID: 13213 RVA: 0x0020019C File Offset: 0x001FE39C
286 {
287 /*
288An exception occurred when decompiling this method (0600339D)
289
290ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.Generic.List`1<System.String> Terraria.IO.Preferences::GetAllKeys()
291
292 ---> System.Exception: Basic block has to end with unconditional control flow.
293{
294 Block_0:
295 stloc:class [mscorlib]System.Collections.Generic.Dictionary`2<string, object>(var_0_06, ldfld:class [mscorlib]System.Collections.Generic.Dictionary`2<string, object>(Preferences::_data, ldloc:Preferences(this)))
296}
297
298 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
299 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
300 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
301 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
302 --- End of inner exception stack trace ---
303 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
304 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
305*/;
306 }
307
308 // Token: 0x0600339E RID: 13214 RVA: 0x002001B0 File Offset: 0x001FE3B0
309 public void Clear(string name)
310 {
311 if (this._data != null)
312 {
313 return;
314 }
315 }
316
317 // Token: 0x04003C4C RID: 15436
319
320 // Token: 0x04003C4D RID: 15437
321 private readonly string _path;
322
323 // Token: 0x04003C4E RID: 15438
325
326 // Token: 0x04003C4F RID: 15439
327 public readonly bool UseBson;
328
329 // Token: 0x04003C50 RID: 15440
330 private readonly object _lock;
331
332 // Token: 0x04003C51 RID: 15441
333 public bool AutoSave;
334
335 // Token: 0x04003C52 RID: 15442
338
339 // Token: 0x04003C53 RID: 15443
342
343 // Token: 0x04003C54 RID: 15444
346
347 // Token: 0x02000565 RID: 1381
349 {
350 // Token: 0x0600339F RID: 13215 RVA: 0x002001C8 File Offset: 0x001FE3C8
351 public TextProcessAction(object @object, IntPtr method)
352 {
354 this.m_target = @object;
356 this.method_code = this;
357 }
358
359 // Token: 0x060033A0 RID: 13216 RVA: 0x00200214 File Offset: 0x001FE414
360 public void Invoke(string text)
361 {
364 IntPtr method = this.method;
365 }
366
367 // Token: 0x060033A1 RID: 13217 RVA: 0x000021DB File Offset: 0x000003DB
368 public IAsyncResult BeginInvoke(string text, AsyncCallback callback, object @object)
369 {
370 throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
371 }
372
373 // Token: 0x060033A2 RID: 13218 RVA: 0x00200238 File Offset: 0x001FE438
374 public void EndInvoke(string text, IAsyncResult result)
375 {
376 }
377 }
378 }
379}
class f__AnonymousType0<< Count > j__TPar
static JsonSerializer Create()
static object ChangeType(object value, TypeCode typeCode, IFormatProvider provider)
Definition Convert.cs:73
static Delegate Combine(Delegate a, Delegate b)
Definition Delegate.cs:255
IntPtr method_code
Definition Delegate.cs:386
IntPtr invoke_impl
Definition Delegate.cs:371
static Delegate Remove(Delegate source, Delegate value)
Definition Delegate.cs:278
static DirectoryInfo GetParent(string path)
Definition Directory.cs:10
static void Exit(object obj)
Definition Monitor.cs:47
static void Enter(object obj)
Definition Monitor.cs:11
TextProcessAction(object @object, IntPtr method)
void EndInvoke(string text, IAsyncResult result)
IAsyncResult BeginInvoke(string text, AsyncCallback callback, object @object)
Preferences(string path, bool parseAllTypes=false, bool useBson=false)
Preferences.TextProcessAction OnProcessText
Dictionary< string, object > _data
bool Contains(string name)
void Clear(string name)
readonly object _lock
T Get< T >(string name, T defaultValue)
readonly string _path
Action< Preferences > OnLoad
List< string > GetAllKeys()
void Put(string name, object value)
bool Save(bool canCreateFile=true)
Action< Preferences > OnSave
readonly JsonSerializerSettings _serializerSettings
static byte[] ReadAllBytes(string path, bool cloud=false)
static bool Exists(string path, bool cloud=false)