Beispiel #1
0
        internal static byte[] SerializeData(this IGameSerializable obj)
        {
            var binaryFormatter = new BinaryFormatter {
                SurrogateSelector = GetSurrogateSelector()
            };

            using (var memoryStream = new MemoryStream()) {
                binaryFormatter.Serialize(memoryStream, obj);
                obj.OnSerialized();
                return(memoryStream.ToArray());
            }
        }
Beispiel #2
0
 public byte[] SerializeData(IGameSerializable obj)
 {
     return(obj.SerializeData());
 }