Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AnonymousPipeClientStream.cs
Go to the documentation of this file.
2
4
6{
8
10 {
11 set
12 {
14 switch (value)
15 {
16 default:
18 case PipeTransmissionMode.Message:
20 case PipeTransmissionMode.Byte:
21 break;
22 }
23 }
24 }
25
26 public AnonymousPipeClientStream(string pipeHandleAsString)
27 : this(PipeDirection.In, pipeHandleAsString)
28 {
29 }
30
31 public AnonymousPipeClientStream(PipeDirection direction, string pipeHandleAsString)
32 : base(direction, 0)
33 {
34 if (direction == PipeDirection.InOut)
35 {
37 }
38 if (pipeHandleAsString == null)
39 {
40 throw new ArgumentNullException("pipeHandleAsString");
41 }
42 long result = 0L;
43 if (!long.TryParse(pipeHandleAsString, out result))
44 {
45 throw new ArgumentException(System.SR.Argument_InvalidHandle, "pipeHandleAsString");
46 }
47 SafePipeHandle safePipeHandle = new SafePipeHandle((IntPtr)result, ownsHandle: true);
48 if (safePipeHandle.IsInvalid)
49 {
50 throw new ArgumentException(System.SR.Argument_InvalidHandle, "pipeHandleAsString");
51 }
52 Init(direction, safePipeHandle);
53 }
54
55 public AnonymousPipeClientStream(PipeDirection direction, SafePipeHandle safePipeHandle)
56 : base(direction, 0)
57 {
58 if (direction == PipeDirection.InOut)
59 {
61 }
62 if (safePipeHandle == null)
63 {
64 throw new ArgumentNullException("safePipeHandle");
65 }
66 if (safePipeHandle.IsInvalid)
67 {
68 throw new ArgumentException(System.SR.Argument_InvalidHandle, "safePipeHandle");
69 }
70 Init(direction, safePipeHandle);
71 }
72
73 private void Init(PipeDirection direction, SafePipeHandle safePipeHandle)
74 {
75 ValidateHandleIsPipe(safePipeHandle);
76 InitializeHandle(safePipeHandle, isExposed: true, isAsync: false);
77 base.State = PipeState.Connected;
78 }
79
81 {
82 Dispose(disposing: false);
83 }
84}
AnonymousPipeClientStream(PipeDirection direction, SafePipeHandle safePipeHandle)
void Init(PipeDirection direction, SafePipeHandle safePipeHandle)
AnonymousPipeClientStream(PipeDirection direction, string pipeHandleAsString)
void ValidateHandleIsPipe(SafePipeHandle safePipeHandle)
SafePipeHandle SafePipeHandle
virtual void CheckPipePropertyOperations()
void InitializeHandle(SafePipeHandle? handle, bool isExposed, bool isAsync)
void Dispose()
Definition Stream.cs:639
static string NotSupported_AnonymousPipeMessagesNotSupported
Definition SR.cs:92
static string ArgumentOutOfRange_TransmissionModeByteOrMsg
Definition SR.cs:30
static string Argument_InvalidHandle
Definition SR.cs:24
static string NotSupported_AnonymousPipeUnidirectional
Definition SR.cs:90
Definition SR.cs:7