mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Don't try to send unserializable value types over the wire with VV.
This commit is contained in:
@@ -6,8 +6,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Shared.Serialization
|
||||
{
|
||||
@@ -18,6 +16,7 @@ namespace Robust.Shared.Serialization
|
||||
private readonly IReflectionManager reflectionManager;
|
||||
#pragma warning restore 649
|
||||
private Serializer Serializer;
|
||||
private HashSet<Type> SerializableTypes;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
@@ -34,6 +33,7 @@ namespace Robust.Shared.Serialization
|
||||
|
||||
var settings = new Settings();
|
||||
Serializer = new Serializer(types, settings);
|
||||
SerializableTypes = new HashSet<Type>(Serializer.GetTypeMap().Keys);
|
||||
}
|
||||
|
||||
public void Serialize(Stream stream, object toSerialize)
|
||||
@@ -50,5 +50,10 @@ namespace Robust.Shared.Serialization
|
||||
{
|
||||
return Serializer.Deserialize(stream);
|
||||
}
|
||||
|
||||
public bool CanSerialize(Type type)
|
||||
{
|
||||
return SerializableTypes.Contains(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user