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

◆ ReadCore()

unsafe int System.IO.Pipes.PipeStream.ReadCore ( Span< byte > buffer)
inlineprivate

Definition at line 873 of file PipeStream.cs.

874 {
875 if (buffer.Length == 0)
876 {
877 return 0;
878 }
879 fixed (byte* bytes = &MemoryMarshal.GetReference(buffer))
880 {
881 int numBytesRead = 0;
882 if (global::Interop.Kernel32.ReadFile(_handle, bytes, buffer.Length, out numBytesRead, IntPtr.Zero) != 0)
883 {
884 _isMessageComplete = true;
885 return numBytesRead;
886 }
887 int lastPInvokeError = Marshal.GetLastPInvokeError();
888 _isMessageComplete = lastPInvokeError != 234;
889 switch (lastPInvokeError)
890 {
891 case 234:
892 return numBytesRead;
893 case 109:
894 case 233:
895 State = PipeState.Broken;
896 return 0;
897 default:
898 throw System.IO.Win32Marshal.GetExceptionForWin32Error(lastPInvokeError, string.Empty);
899 }
900 }
901 }
static Exception GetExceptionForWin32Error(int errorCode, string path="")

References System.IO.Pipes.PipeStream._handle, System.IO.Pipes.PipeStream._isMessageComplete, System.buffer, System.bytes, System.IO.Win32Marshal.GetExceptionForWin32Error(), System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), and System.IntPtr.Zero.

Referenced by System.IO.Pipes.PipeStream.Read(), and System.IO.Pipes.PipeStream.Read().