Skip to content

Commit

Permalink
Merge pull request #1192 from Unity-Technologies/named-pipes-unityaot
Browse files Browse the repository at this point in the history
Implement NamedPipeClientStream in the unityaot profile (case 1159863)
  • Loading branch information
Joshua Peterson authored Jun 5, 2019
2 parents f93c597 + 6ea53bf commit 273de1b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
22 changes: 15 additions & 7 deletions mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeDirection
}

public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
#if MOBILE
#if MOBILE && !UNITY_AOT
: base (direction, DefaultBufferSize)
{
throw new NotImplementedException ();
Expand All @@ -88,13 +88,17 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeDirection
public NamedPipeClientStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
#if MOBILE
#if MOBILE && !UNITY_AOT
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32NamedPipeClient (this, safePipeHandle);
else
#if UNITY_AOT
throw new NotImplementedException ();
#else
impl = new UnixNamedPipeClient (this, safePipeHandle);
#endif
IsConnected = isConnected;
InitializeHandle (safePipeHandle, true, isAsync);
#endif
Expand All @@ -106,13 +110,17 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRigh
if (impersonationLevel != TokenImpersonationLevel.None ||
inheritability != HandleInheritability.None)
throw ThrowACLException ();
#if MOBILE
#if MOBILE && !UNITY_AOT
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
else
#if UNITY_AOT
throw new NotImplementedException ();
#else
impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
#endif
#endif

}
Expand All @@ -121,13 +129,13 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRigh
Dispose (false);
}

#if !MOBILE
#if !MOBILE || UNITY_AOT
INamedPipeClient impl;
#endif

public void Connect ()
{
#if MOBILE
#if MOBILE && !UNITY_AOT
throw new NotImplementedException ();
#else
impl.Connect ();
Expand All @@ -138,7 +146,7 @@ public void Connect ()

public void Connect (int timeout)
{
#if MOBILE
#if MOBILE && !UNITY_AOT
throw new NotImplementedException ();
#else
impl.Connect (timeout);
Expand Down Expand Up @@ -174,7 +182,7 @@ protected override internal void CheckPipePropertyOperations () {
public int NumberOfServerInstances {
get {
CheckPipePropertyOperations ();
#if MOBILE
#if MOBILE && !UNITY_AOT
throw new NotImplementedException ();
#else
return impl.NumberOfServerInstances;
Expand Down
2 changes: 1 addition & 1 deletion mcs/class/System.Core/System.IO.Pipes/PipeStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class PipeStream : Stream
// FIXME: not precise.
internal const int DefaultBufferSize = 0x400;

#if !MOBILE
#if !MOBILE || UNITY_AOT
internal static bool IsWindows {
get { return Win32Marshal.IsWindows; }
}
Expand Down
1 change: 1 addition & 0 deletions mcs/class/System.Core/unityaot_System.Core.dll.sources
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include winaot_System.Core.dll.sources
../referencesource/System.Core/System/Linq/Enumerable.cs
corefx/SR.cs
System.IO.Pipes/PipeWin32.cs

0 comments on commit 273de1b

Please sign in to comment.