Beispiel #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);
        }
Beispiel #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);
        }