// // Received input pipe message // private void PipeInput_MessageReceived(object sender, NamedPipeClient.NamedPipeEventArgs e) { string stringMessage = Encoding.UTF8.GetString(e.Message.Data, 0, e.Message.Length); //ConsoleAddLine("Pipe: " + stringMessage); ProcessDriverMessage(stringMessage); }
// // Received state pipe message // private void PipeState_MessageReceived(object sender, NamedPipeClient.NamedPipeEventArgs e) { GCHandle gcHandle; TabletState readState; // Convert bytes to TabletState if (e.Message.Length == stateBytes.Length) { gcHandle = GCHandle.Alloc(e.Message.Data, GCHandleType.Pinned); readState = (TabletState)Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject(), typeof(TabletState)); gcHandle.Free(); tabletState = readState; } }