예제 #1
0
        public static object ReadMessages(PipeStream pipe, out IpcCommands command)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                BinaryFormatter binForm = new BinaryFormatter();

                pipe.CopyTo(memoryStream);
                memoryStream.Seek(0, SeekOrigin.Begin);
                command = (IpcCommands)memoryStream.ReadByte();
                return(memoryStream.Length == memoryStream.Position ? null : binForm.Deserialize(memoryStream));
            }
        }