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
UnmanagedMemoryStream.cs
Go to the documentation of this file.
1using System;
6
7namespace System.IO
8{
9 // Token: 0x02000548 RID: 1352
11 {
12 // Token: 0x06002815 RID: 10261 RVA: 0x00056F14 File Offset: 0x00055114
14 {
15 if (!true)
16 {
17 }
18 base..ctor();
19 }
20
21 // Token: 0x06002816 RID: 10262 RVA: 0x00056F2C File Offset: 0x0005512C
22 [CLSCompliant(false)]
24 {
25 if (!true)
26 {
27 }
28 base..ctor();
29 this.Initialize(pointer, length, length, FileAccess.Read);
30 }
31
32 // Token: 0x06002817 RID: 10263 RVA: 0x00056F4C File Offset: 0x0005514C
33 [CLSCompliant(false)]
35 {
36 if (!true)
37 {
38 }
39 base..ctor();
40 this.Initialize(pointer, length, capacity, access);
41 }
42
43 // Token: 0x06002818 RID: 10264 RVA: 0x00056F70 File Offset: 0x00055170
44 [CLSCompliant(false)]
45 protected unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access)
46 {
47 while (pointer != null)
48 {
49 if (!this._isOpen)
50 {
51 int num = 1;
55 this._access = access;
56 this._isOpen = num != 0;
57 return;
58 }
59 }
60 }
61
62 // Token: 0x170005C0 RID: 1472
63 // (get) Token: 0x06002819 RID: 10265 RVA: 0x00056FB4 File Offset: 0x000551B4
64 public override bool CanRead
65 {
66 get
67 {
68 if (this._isOpen)
69 {
70 FileAccess access = this._access;
71 return;
72 }
73 }
74 }
75
76 // Token: 0x170005C1 RID: 1473
77 // (get) Token: 0x0600281A RID: 10266 RVA: 0x00056FD4 File Offset: 0x000551D4
78 public override bool CanSeek
79 {
80 get
81 {
82 return this._isOpen;
83 }
84 }
85
86 // Token: 0x170005C2 RID: 1474
87 // (get) Token: 0x0600281B RID: 10267 RVA: 0x00056FE8 File Offset: 0x000551E8
88 public override bool CanWrite
89 {
90 get
91 {
92 if (this._isOpen)
93 {
94 FileAccess access = this._access;
95 return;
96 }
97 }
98 }
99
100 // Token: 0x0600281C RID: 10268 RVA: 0x00057008 File Offset: 0x00055208
101 protected override void Dispose(bool disposing)
102 {
103 }
104
105 // Token: 0x0600281D RID: 10269 RVA: 0x00057018 File Offset: 0x00055218
106 private void EnsureNotClosed()
107 {
108 /*
109An exception occurred when decompiling this method (0600281D)
110
111ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void System.IO.UnmanagedMemoryStream::EnsureNotClosed()
112
113 ---> System.Exception: Basic block has to end with unconditional control flow.
114{
115 IL_0009:
116 stloc:Exception(var_0_0E, call:Exception(Error::GetStreamIsClosed))
117}
118
119 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
120 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
121 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
122 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
123 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
124 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
125 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
126 --- End of inner exception stack trace ---
127 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
128 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
129*/;
130 }
131
132 // Token: 0x0600281E RID: 10270 RVA: 0x00057034 File Offset: 0x00055234
133 private void EnsureReadable()
134 {
135 }
136
137 // Token: 0x0600281F RID: 10271 RVA: 0x00057048 File Offset: 0x00055248
138 private void EnsureWriteable()
139 {
140 }
141
142 // Token: 0x06002820 RID: 10272 RVA: 0x0005705C File Offset: 0x0005525C
143 public override void Flush()
144 {
145 this.EnsureNotClosed();
146 }
147
148 // Token: 0x06002821 RID: 10273 RVA: 0x00057070 File Offset: 0x00055270
149 public override Task FlushAsync(CancellationToken cancellationToken)
150 {
151 if (!true)
152 {
153 }
154 Task task;
155 return task;
156 }
157
158 // Token: 0x170005C3 RID: 1475
159 // (get) Token: 0x06002822 RID: 10274 RVA: 0x0005708C File Offset: 0x0005528C
160 public override long Length
161 {
162 get
163 {
164 this.EnsureNotClosed();
165 long num;
166 return num;
167 }
168 }
169
170 // Token: 0x170005C4 RID: 1476
171 // (get) Token: 0x06002823 RID: 10275 RVA: 0x000570A0 File Offset: 0x000552A0
172 // (set) Token: 0x06002824 RID: 10276 RVA: 0x000570B4 File Offset: 0x000552B4
173 public override long Position
174 {
175 get
176 {
177 long num;
178 return num;
179 }
180 set
181 {
182 }
183 }
184
185 // Token: 0x170005C5 RID: 1477
186 // (get) Token: 0x06002825 RID: 10277 RVA: 0x000570C8 File Offset: 0x000552C8
187 [CLSCompliant(false)]
189 {
190 get
191 {
192 /*
193An exception occurred when decompiling this method (06002825)
194
195ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte* System.IO.UnmanagedMemoryStream::get_PositionPointer()
196
197 ---> System.Exception: Basic block has to end with unconditional control flow.
198{
199 Block_0:
200 call:void(UnmanagedMemoryStream::EnsureNotClosed, ldloc:UnmanagedMemoryStream(this))
201 stloc:int64(var_1_14, ldfld:int64(UnmanagedMemoryStream::_capacity, ldloc:UnmanagedMemoryStream(this)))
202 stloc:uint8*(var_2_1B, ldfld:uint8*(UnmanagedMemoryStream::_mem, ldloc:UnmanagedMemoryStream(this)))
203}
204
205 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
206 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
207 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
208 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
209 --- End of inner exception stack trace ---
210 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
211 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
212*/;
213 }
214 }
215
216 // Token: 0x06002826 RID: 10278 RVA: 0x000570F0 File Offset: 0x000552F0
217 public override int Read(byte[] buffer, int offset, int count)
218 {
219 if (buffer != null)
220 {
222 int num;
223 return num;
224 }
225 return "offset";
226 }
227
228 // Token: 0x06002827 RID: 10279 RVA: 0x00057114 File Offset: 0x00055314
229 public override int Read(Span<byte> buffer)
230 {
231 Type type;
232 bool flag = base.GetType() == type;
233 return this.ReadCore(buffer);
234 }
235
236 // Token: 0x06002828 RID: 10280 RVA: 0x00057140 File Offset: 0x00055340
237 internal unsafe int ReadCore(Span<byte> buffer)
238 {
239 this.EnsureNotClosed();
240 this.EnsureReadable();
241 long num2;
242 long num = Interlocked.Read(num2);
243 byte reference = MemoryMarshal.GetReference(buffer);
245 if (buffer2 != null)
246 {
249 long offset = this._offset;
250 long num3 = 0L;
251 int num4 = 5;
252 if (buffer2 != null)
253 {
255 buffer4.ReleasePointer();
256 }
257 if (num3 != 0L || num4 != 0)
258 {
259 goto IL_0070;
260 }
261 }
262 byte* mem = this._mem;
263 IL_0070:
264 throw new OutOfMemoryException();
265 }
266
267 // Token: 0x06002829 RID: 10281 RVA: 0x000571E0 File Offset: 0x000553E0
268 public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
269 {
270 int num = 1;
271 if (buffer != null)
272 {
273 if (num == 0)
274 {
275 }
276 Task task;
277 return task;
278 }
279 return "offset";
280 }
281
282 // Token: 0x0600282A RID: 10282 RVA: 0x00057210 File Offset: 0x00055410
283 public override ValueTask<int> ReadAsync(Memory<byte> buffer, [Optional] CancellationToken cancellationToken)
284 {
285 Task task;
286 if (task == null)
287 {
288 }
290 Task task2;
291 if (task2 == null)
292 {
293 return;
294 }
295 }
296
297 // Token: 0x0600282B RID: 10283 RVA: 0x0005723C File Offset: 0x0005543C
298 public unsafe override int ReadByte()
299 {
300 this.EnsureNotClosed();
301 this.EnsureReadable();
302 long num = 0L;
303 long num3;
305 SafeBuffer buffer = this._buffer;
306 if (buffer != null)
307 {
310 long offset = this._offset;
311 long num4 = 0L;
312 int num5 = 4;
313 if (buffer != null)
314 {
316 buffer3.ReleasePointer();
317 }
318 if (num4 != 0L || num5 != 0)
319 {
320 goto IL_0068;
321 }
322 }
323 byte* mem = this._mem;
324 IL_0068:
325 throw new OutOfMemoryException();
326 }
327
328 // Token: 0x0600282C RID: 10284 RVA: 0x000572DC File Offset: 0x000554DC
329 public override long Seek(long offset, SeekOrigin loc)
330 {
331 do
332 {
333 this.EnsureNotClosed();
334 }
335 while (loc != SeekOrigin.Begin);
336 long num = 0L;
337 long num2;
339 }
340
341 // Token: 0x0600282D RID: 10285 RVA: 0x00057300 File Offset: 0x00055500
342 public override void SetLength(long value)
343 {
344 if (this._buffer == null)
345 {
346 this.EnsureNotClosed();
347 this.EnsureWriteable();
348 long capacity = this._capacity;
349 long num = 0L;
350 long num3;
351 long num2 = Interlocked.Read(num3);
352 Buffer.ZeroMemory(this._mem, num);
353 long num5;
355 return;
356 }
357 }
358
359 // Token: 0x0600282E RID: 10286 RVA: 0x0005734C File Offset: 0x0005554C
360 public override void Write(byte[] buffer, int offset, int count)
361 {
362 if (buffer != null)
363 {
366 this.WriteCore(readOnlySpan);
367 return;
368 }
369 }
370
371 // Token: 0x0600282F RID: 10287 RVA: 0x00057374 File Offset: 0x00055574
372 public override void Write(ReadOnlySpan<byte> buffer)
373 {
374 Type type;
375 bool flag = base.GetType() == type;
376 }
377
378 // Token: 0x06002830 RID: 10288 RVA: 0x00057398 File Offset: 0x00055598
379 internal unsafe void WriteCore(ReadOnlySpan<byte> buffer)
380 {
381 this.EnsureNotClosed();
382 this.EnsureWriteable();
383 long num = 0L;
384 long num3;
385 long num2 = Interlocked.Read(num3);
386 long capacity = this._capacity;
387 if (this._buffer == null)
388 {
389 byte* mem = this._mem;
390 long num4 = Interlocked.Exchange(num2, num);
391 }
392 byte reference = MemoryMarshal.GetReference(buffer);
393 if (this._buffer != null)
394 {
395 long capacity2 = this._capacity;
398 long offset = this._offset;
399 long num5 = 0L;
400 int num6 = 14;
401 if (capacity2 != 0L)
402 {
403 this._buffer.ReleasePointer();
404 }
405 if (num5 != 0L)
406 {
407 throw new OutOfMemoryException();
408 }
409 if (num6 != 0)
410 {
411 return;
412 }
413 }
414 byte* mem2 = this._mem;
415 }
416
417 // Token: 0x06002831 RID: 10289 RVA: 0x0005744C File Offset: 0x0005564C
418 public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
419 {
420 int num = 1;
421 if (buffer != null)
422 {
423 if (num == 0)
424 {
425 }
426 Task task;
427 return task;
428 }
429 return "offset";
430 }
431
432 // Token: 0x06002832 RID: 10290 RVA: 0x00057470 File Offset: 0x00055670
433 public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, [Optional] CancellationToken cancellationToken)
434 {
435 if (!true)
436 {
437 }
438 Task task;
439 if (task == null)
440 {
441 return;
442 }
443 }
444
445 // Token: 0x06002833 RID: 10291 RVA: 0x00057490 File Offset: 0x00055690
446 public unsafe override void WriteByte(byte value)
447 {
448 this.EnsureNotClosed();
449 this.EnsureWriteable();
450 long num = 0L;
451 long num3;
452 long num2 = Interlocked.Read(num3);
453 long capacity = this._capacity;
454 if (this._buffer == null)
455 {
456 byte* mem = this._mem;
457 long num4 = Interlocked.Exchange(num2, num);
458 }
459 SafeBuffer buffer = this._buffer;
460 if (buffer != null)
461 {
464 long offset = this._offset;
465 long num5 = 0L;
466 int num6 = 11;
467 if (buffer != null)
468 {
469 this._buffer.ReleasePointer();
470 }
471 if (num5 != 0L)
472 {
473 throw new OutOfMemoryException();
474 }
475 if (num6 != 0)
476 {
477 return;
478 }
479 }
480 byte* mem2 = this._mem;
481 mem2->m_value = value;
482 }
483
484 // Token: 0x040015B8 RID: 5560
486
487 // Token: 0x040015B9 RID: 5561
488 private unsafe byte* _mem;
489
490 // Token: 0x040015BA RID: 5562
491 private long _length;
492
493 // Token: 0x040015BB RID: 5563
494 private long _capacity;
495
496 // Token: 0x040015BC RID: 5564
497 private long _position;
498
499 // Token: 0x040015BD RID: 5565
500 private long _offset;
501
502 // Token: 0x040015BE RID: 5566
504
505 // Token: 0x040015BF RID: 5567
506 internal bool _isOpen;
507
508 // Token: 0x040015C0 RID: 5568
510 }
511}
class f__AnonymousType0<< Count > j__TPar
static unsafe void ZeroMemory(byte *src, long len)
Definition Buffer.cs:30
unsafe void WriteCore(ReadOnlySpan< byte > buffer)
override void Write(ReadOnlySpan< byte > buffer)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, [Optional] CancellationToken cancellationToken)
unsafe override void WriteByte(byte value)
unsafe void Initialize(byte *pointer, long length, long capacity, FileAccess access)
unsafe UnmanagedMemoryStream(byte *pointer, long length)
override void SetLength(long value)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
unsafe int ReadCore(Span< byte > buffer)
override long Seek(long offset, SeekOrigin loc)
override ValueTask< int > ReadAsync(Memory< byte > buffer, [Optional] CancellationToken cancellationToken)
override void Dispose(bool disposing)
override int Read(byte[] buffer, int offset, int count)
override int Read(Span< byte > buffer)
override void Write(byte[] buffer, int offset, int count)
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override Task FlushAsync(CancellationToken cancellationToken)
unsafe UnmanagedMemoryStream(byte *pointer, long length, long capacity, FileAccess access)
static int Exchange(int location1, int value)
static long Read(long location)
static void ThrowArgumentOutOfRangeException()
new Type GetType()
Definition Type.cs:287