Exemplo n.º 1
0
        public static SocketPacket DeSerializedItem(byte[] data)
        {
            SocketPacket    packet          = new SocketPacket();
            MemoryStream    str             = new MemoryStream(data);
            BinaryFormatter binaryFormatter = new BinaryFormatter();

            packet = (SocketPacket)binaryFormatter.Deserialize(str);
            return(packet);
        }
Exemplo n.º 2
0
        public static byte[] SerializedItem(SocketPacket packet)
        {
            MemoryStream    str     = new MemoryStream();
            BinaryFormatter bformat = new BinaryFormatter();

            bformat.Serialize(str, packet);
            byte[] data = new byte[str.Length];
            data = str.ToArray();
            return(data);
        }