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
PlayerFileData.cs
Go to the documentation of this file.
1using System;
3using System.IO;
7
8namespace Terraria.IO
9{
10 // Token: 0x02000562 RID: 1378
11 public class PlayerFileData : FileData
12 {
13 // Token: 0x1700066F RID: 1647
14 // (get) Token: 0x0600337A RID: 13178 RVA: 0x001FF7B8 File Offset: 0x001FD9B8
15 // (set) Token: 0x0600337B RID: 13179 RVA: 0x001FF7CC File Offset: 0x001FD9CC
17 {
18 get
19 {
20 return this._player;
21 }
22 set
23 {
25 if (value != null)
26 {
27 string name = value.name;
29 }
30 }
31 }
32
33 // Token: 0x0600337C RID: 13180 RVA: 0x001FF7F4 File Offset: 0x001FD9F4
35 {
36 Player player = this._player;
37 Vector2 position = this._player.miscEquips.position;
39 int num = 1;
41 }
42
43 // Token: 0x0600337D RID: 13181 RVA: 0x001FF830 File Offset: 0x001FDA30
45 {
46 if (!true)
47 {
48 }
50 base..ctor();
51 this.Type = "Player";
52 }
53
54 // Token: 0x0600337E RID: 13182 RVA: 0x001FF858 File Offset: 0x001FDA58
55 public PlayerFileData(string path, bool cloudSave)
56 {
57 if (!true)
58 {
59 }
61 }
62
63 // Token: 0x0600337F RID: 13183 RVA: 0x001FF870 File Offset: 0x001FDA70
64 public static PlayerFileData CreateAndSave(Player player)
65 {
66 /*
67An exception occurred when decompiling this method (0600337F)
68
69ICSharpCode.Decompiler.DecompilerException: Error decompiling Terraria.IO.PlayerFileData Terraria.IO.PlayerFileData::CreateAndSave(Terraria.Player)
70
71 ---> System.Exception: Basic block has to end with unconditional control flow.
72{
73 Block_0:
74 stloc:FileMetadata(var_0_06, call:FileMetadata(FileMetadata::FromCurrentSettings, ldc.i4:FileType(3)))
75 stloc:FavoritesFile(var_4_10, callgetter:FavoritesFile(Main::get_LocalFavoriteData))
76}
77
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 1852
79 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
80 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
81 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
82 --- End of inner exception stack trace ---
83 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
84 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
85*/;
86 }
87
88 // Token: 0x06003380 RID: 13184 RVA: 0x001FF890 File Offset: 0x001FDA90
89 public override void SetAsActive()
90 {
91 if (!true)
92 {
93 }
95 int myPlayer = Main.myPlayer;
96 Player player = this._player;
97 if (player == null || player != null)
98 {
99 Player player2 = this._player;
100 return;
101 }
102 throw new ArrayTypeMismatchException();
103 }
104
105 // Token: 0x06003381 RID: 13185 RVA: 0x001FF900 File Offset: 0x001FDB00
106 public override void MoveToCloud()
107 {
108 if (this._isCloudSave)
109 {
110 return;
111 }
112 string name = this.Name;
113 int num = 1;
115 bool flag = FileUtilities.MoveToCloud(this._path, playerPathFromName);
116 long num2 = 0L;
117 string fileName = base.GetFileName(num2 != 0L);
118 string playerPath = Main.PlayerPath;
119 string text2;
120 string text3;
121 string text = text2 + text3 + fileName + text2;
122 bool flag2 = Directory.Exists(text);
123 string[] files = Directory.GetFiles(text);
124 string text4;
125 if (("/" == null || "/" != null) && (fileName == null || fileName != null) && ("/" == null || "/" != null) && (text4 == null || text4 != null))
126 {
128 localFavoriteData.ClearEntry(this);
129 int num3 = 1;
130 this._isCloudSave = num3 != 0;
132 localFavoriteData.SaveFavorite(this);
133 return;
134 }
135 throw new ArrayTypeMismatchException();
136 }
137
138 // Token: 0x06003382 RID: 13186 RVA: 0x001FF9D4 File Offset: 0x001FDBD4
139 public override void MoveToLocal()
140 {
141 if (this._isCloudSave)
142 {
143 string name = this.Name;
144 long num = 0L;
146 bool flag = FileUtilities.MoveToLocal(this._path, playerPathFromName);
147 long num2 = 0L;
148 string fileName = base.GetFileName(num2 != 0L);
149 return;
150 }
151 }
152
153 // Token: 0x06003383 RID: 13187 RVA: 0x001FFAA4 File Offset: 0x001FDCA4
154 private bool MapBelongsToPath(string mapPath, string filePath)
155 {
156 bool flag = filePath.EndsWith(".map", StringComparison.CurrentCultureIgnoreCase);
157 string text;
158 return filePath.StartsWith(text, StringComparison.CurrentCultureIgnoreCase);
159 }
160
161 // Token: 0x06003384 RID: 13188 RVA: 0x001FFAC8 File Offset: 0x001FDCC8
162 public void UpdatePlayTimer()
163 {
164 if (!true)
165 {
166 }
167 }
168
169 // Token: 0x06003385 RID: 13189 RVA: 0x001FFB10 File Offset: 0x001FDD10
170 public void OnLostFocus()
171 {
172 this.StopPlayTimer();
173 }
174
175 // Token: 0x06003386 RID: 13190 RVA: 0x001FFB24 File Offset: 0x001FDD24
176 public void StartPlayTimer()
177 {
178 if (!this._isTimerActive)
179 {
180 Stopwatch timer = this._timer;
181 this._isTimerActive = true;
182 if (!timer.is_running)
183 {
184 timer.Start();
185 return;
186 }
187 }
188 }
189
190 // Token: 0x06003387 RID: 13191 RVA: 0x001FFB58 File Offset: 0x001FDD58
191 public void PausePlayTimer()
192 {
193 this.StopPlayTimer();
194 }
195
196 // Token: 0x06003388 RID: 13192 RVA: 0x001FFB6C File Offset: 0x001FDD6C
198 {
199 /*
200An exception occurred when decompiling this method (06003388)
201
202ICSharpCode.Decompiler.DecompilerException: Error decompiling System.TimeSpan Terraria.IO.PlayerFileData::GetPlayTime()
203
204 ---> System.Exception: Basic block has to end with unconditional control flow.
205{
206 Block_0:
207 stloc:TimeSpan(var_2_11, call:TimeSpan(TimeSpan::op_Addition, ldloc:TimeSpan(var_0_06), ldloc:TimeSpan(var_1)))
208}
209
210 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
211 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
212 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
213 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
214 --- End of inner exception stack trace ---
215 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
216 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
217*/;
218 }
219
220 // Token: 0x06003389 RID: 13193 RVA: 0x001FFB8C File Offset: 0x001FDD8C
222 {
224 Stopwatch timer = this._timer;
225 bool is_running = timer.is_running;
226 TimeSpan elapsed = timer.Elapsed;
227 TimeSpan timeSpan = playTime + elapsed;
228 Stopwatch timer2 = this._timer;
230 timer2.Reset();
231 if (is_running)
232 {
233 this._timer.Start();
234 return;
235 }
236 }
237
238 // Token: 0x0600338A RID: 13194 RVA: 0x001FFBE4 File Offset: 0x001FDDE4
239 public void StopPlayTimer()
240 {
241 if (this._isTimerActive)
242 {
243 Stopwatch timer = this._timer;
244 if (timer.is_running)
245 {
247 TimeSpan elapsed = timer.Elapsed;
248 TimeSpan timeSpan = playTime + elapsed;
249 Stopwatch timer2 = this._timer;
251 timer2.Reset();
252 return;
253 }
254 }
255 }
256
257 // Token: 0x0600338B RID: 13195 RVA: 0x001FFC38 File Offset: 0x001FDE38
258 public void SetPlayTime(TimeSpan time)
259 {
260 this._playTime = time;
261 }
262
263 // Token: 0x0600338C RID: 13196 RVA: 0x001FFC4C File Offset: 0x001FDE4C
264 public void Rename(string newName)
265 {
266 Player player = this._player;
267 if (player != null)
268 {
269 string text = newName.Trim();
271 }
272 if (!true)
273 {
274 }
275 long num = 0L;
276 long num2 = 0L;
277 Player.SavePlayer(this, num != 0L, num2 != 0L);
278 }
279
280 // Token: 0x04003C46 RID: 15430
282
283 // Token: 0x04003C47 RID: 15431
285
286 // Token: 0x04003C48 RID: 15432
288
289 // Token: 0x04003C49 RID: 15433
290 private bool _isTimerActive;
291
292 // Token: 0x04003C4A RID: 15434
294
295 // Token: 0x02000563 RID: 1379
297 private sealed class <>c__DisplayClass14_0
298 {
299 // Token: 0x0600338D RID: 13197 RVA: 0x001FFC84 File Offset: 0x001FDE84
301 {
302 }
303
304 // Token: 0x0600338E RID: 13198 RVA: 0x001FFC98 File Offset: 0x001FDE98
305 internal bool <MoveToLocal>b__0(string path)
306 {
307 string text = this.mapPath;
308 bool flag = path.StartsWith(text, StringComparison.CurrentCultureIgnoreCase);
309 return path.EndsWith(".map", StringComparison.CurrentCultureIgnoreCase);
310 }
311
312 // Token: 0x04003C4B RID: 15435
313 public string mapPath;
314 }
315 }
316}
class f__AnonymousType0<< Count > j__TPar
static bool Exists(string path)
Definition Directory.cs:64
static string[] GetFiles(string path)
Definition Directory.cs:83
Vector2 position
Definition Entity.cs:460
readonly Stopwatch _timer
PlayerFileData(string path, bool cloudSave)
bool MapBelongsToPath(string mapPath, string filePath)
void Rename(string newName)
void SetPlayTime(TimeSpan time)
static PlayerFileData CreateAndSave(Player player)
static FavoritesFile LocalFavoriteData
Definition Main.cs:337
static int myPlayer
Definition Main.cs:2337
static string GetPlayerPathFromName(string playerName, bool cloudSave)
Definition Main.cs:6241
static string PlayerPath
Definition Main.cs:2741
Item[] miscEquips
Definition Player.cs:21134
static void SavePlayer(PlayerFileData playerFile, bool skipMapSave=false, bool forceSave=false)
Definition Player.cs:18657
static bool MoveToCloud(string localPath, string cloudPath)
static bool MoveToLocal(string cloudPath, string localPath)