Cosmos/source2/VSIP/Cosmos.VS.Debug/PipeThread.cs
kudzu_cp f58022850d
2011-06-19 15:10:11 +00:00

33 lines
922 B
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Windows.Threading;
namespace Cosmos.VS.Debug {
class PipeThread {
public static event Action<string> DataPacketReceived;
public static void ThreadStartServer() {
using (var xPipe = new NamedPipeServerStream("CosmosDebugWindows", PipeDirection.In)) {
xPipe.WaitForConnection();
using (var xReader = new StreamReader(xPipe)) {
while (!xReader.EndOfStream) {
string xLine = xReader.ReadLine();
Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
(Action)delegate() {
if (DataPacketReceived != null) {
DataPacketReceived(xLine);
}
}
);
}
}
}
}
}
}