mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-24 01:09:23 +01:00
right
This commit is contained in:
parent
9781722ae4
commit
a53179e2d8
1 changed files with 3 additions and 1 deletions
|
@ -37,8 +37,10 @@ namespace MLEM.Data {
|
|||
}
|
||||
|
||||
public static void WriteObject<T>(this NetBuffer buffer, T obj, JsonSerializer serializer) {
|
||||
if (EqualityComparer<T>.Default.Equals(obj, default))
|
||||
if (EqualityComparer<T>.Default.Equals(obj, default)) {
|
||||
buffer.Write(0);
|
||||
return;
|
||||
}
|
||||
using (var memory = new MemoryStream()) {
|
||||
using (var gzip = new DeflateStream(memory, CompressionLevel.Fastest, true))
|
||||
serializer.Serialize(new BsonDataWriter(gzip), obj, typeof(T));
|
||||
|
|
Loading…
Reference in a new issue