mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 09:35:38 -05:00
Initial commit of SqlTools Service API
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
#if false
|
||||
using System;
|
||||
using System.IO.Pipes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel
|
||||
{
|
||||
public class NamedPipeServerChannel : ChannelBase
|
||||
{
|
||||
private string pipeName;
|
||||
private NamedPipeServerStream pipeServer;
|
||||
|
||||
public NamedPipeServerChannel(string pipeName)
|
||||
{
|
||||
this.pipeName = pipeName;
|
||||
}
|
||||
|
||||
public override async Task WaitForConnection()
|
||||
{
|
||||
#if NanoServer
|
||||
await this.pipeServer.WaitForConnectionAsync();
|
||||
#else
|
||||
await Task.Factory.FromAsync(this.pipeServer.BeginWaitForConnection, this.pipeServer.EndWaitForConnection, null);
|
||||
#endif
|
||||
|
||||
this.IsConnected = true;
|
||||
}
|
||||
|
||||
protected override void Initialize(IMessageSerializer messageSerializer)
|
||||
{
|
||||
this.pipeServer =
|
||||
new NamedPipeServerStream(
|
||||
pipeName,
|
||||
PipeDirection.InOut,
|
||||
1,
|
||||
PipeTransmissionMode.Byte,
|
||||
PipeOptions.Asynchronous);
|
||||
|
||||
this.MessageReader =
|
||||
new MessageReader(
|
||||
this.pipeServer,
|
||||
messageSerializer);
|
||||
|
||||
this.MessageWriter =
|
||||
new MessageWriter(
|
||||
this.pipeServer,
|
||||
messageSerializer);
|
||||
}
|
||||
|
||||
protected override void Shutdown()
|
||||
{
|
||||
if (this.pipeServer != null)
|
||||
{
|
||||
this.pipeServer.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user