Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ strategy [1/2]

Memory<byte> long CancellationToken OSFileStreamStrategy System.IO.RandomAccess.strategy
private

Definition at line 392 of file RandomAccess.cs.

393 {
394 handle.EnsureThreadPoolBindingInitialized();
396 int num = 0;
397 try
398 {
400 if (Interop.Kernel32.ReadFile(handle, (byte*)overlappedValueTaskSource._memoryHandle.Pointer, buffer.Length, IntPtr.Zero, ptr) == 0)
401 {
403 switch (num)
404 {
405 case 997:
406 overlappedValueTaskSource.RegisterForCancellation(cancellationToken);
407 break;
408 case 38:
409 case 109:
410 ptr->InternalLow = IntPtr.Zero;
412 return (vts: null, errorCode: 0);
413 default:
415 return (vts: null, errorCode: num);
416 }
417 }
418 }
419 catch
420 {
422 throw;
423 }
424 finally
425 {
426 if (num != 997 && num != 0)
427 {
428 strategy?.OnIncompleteOperation(buffer.Length, 0);
429 }
430 }
431 overlappedValueTaskSource.FinishedScheduling();
433 }
static unsafe int ReadFile(IntPtr handle, byte *bytes, int numBytesToRead, out int numBytesRead, IntPtr mustBeZero)
static Memory< byte > buffer
static Memory< byte > long CancellationToken OSFileStreamStrategy strategy
static Memory< byte > long CancellationToken cancellationToken
static Memory< byte > long fileOffset
static int GetLastWin32ErrorAndDisposeHandleIfInvalid(SafeFileHandle handle)

Referenced by System.IO.RandomAccess.ReadAtOffsetAsync(), System.IO.RandomAccess.ScheduleSyncReadAtOffsetAsync(), System.IO.RandomAccess.ScheduleSyncWriteAtOffsetAsync(), and System.IO.RandomAccess.WriteAtOffsetAsync().