private void DataReceived(object sender, PipeBaseEventArgs args)
        {
            PipeBaseForServer server = (PipeBaseForServer)sender;

            byte[] reply = args.Data;
            this.pipeFunction(ref reply);
            server.WriteBytes(reply);
        }
        private void CreateServer()
        {
            PipeSecurity pipeSecurity = new PipeSecurity();

            pipeSecurity.AddAccessRule(new PipeAccessRule("Users", PipeAccessRights.FullControl, System.Security.AccessControl.AccessControlType.Allow));
            pipeSecurity.AddAccessRule(new PipeAccessRule("SYSTEM", PipeAccessRights.FullControl, System.Security.AccessControl.AccessControlType.Allow));

            lastServer               = new PipeBaseForServer(this.pipeName, p => p.StartByteReaderAsync(), pipeSecurity);
            lastServer.Connected    += new EventHandler <EventArgs>(Connected);
            lastServer.DataReceived += new EventHandler <PipeBaseEventArgs>(DataReceived);
            lastServer.PipeClosed   += new EventHandler <EventArgs>(PipeClosed);
        }