From d0e95c71daddb52829d66e0573486873af214c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=AE=E4=B8=AD=E4=BA=8C=E7=97=85=E3=81=AB?= =?UTF-8?q?=E7=88=86=E7=84=94=E3=82=92=EF=BC=81?= Date: Wed, 27 Jan 2021 10:28:17 +0800 Subject: [PATCH] improvements of the object serialization --- Parallel/IpcParallel/Stream/ObjectStream.vb | 6 +++++- Parallel/IpcParallel/Stream/StreamEmit.vb | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Parallel/IpcParallel/Stream/ObjectStream.vb b/Parallel/IpcParallel/Stream/ObjectStream.vb index f766e42..6d9dac2 100644 --- a/Parallel/IpcParallel/Stream/ObjectStream.vb +++ b/Parallel/IpcParallel/Stream/ObjectStream.vb @@ -19,7 +19,7 @@ Namespace IpcStream Public ReadOnly Property isPrimitive As Boolean Get - Return DataFramework.IsPrimitive(type.GetType(knownFirst:=True)) + Return DataFramework.IsPrimitive(GetUnderlyingType) End Get End Property @@ -46,6 +46,10 @@ Namespace IpcStream End Using End Sub + Public Function GetUnderlyingType() As Type + Return type.GetType(knownFirst:=True) + End Function + Public Function openMemoryBuffer() As MemoryStream Return New MemoryStream(stream) End Function diff --git a/Parallel/IpcParallel/Stream/StreamEmit.vb b/Parallel/IpcParallel/Stream/StreamEmit.vb index 1299403..35dab4e 100644 --- a/Parallel/IpcParallel/Stream/StreamEmit.vb +++ b/Parallel/IpcParallel/Stream/StreamEmit.vb @@ -29,6 +29,12 @@ Namespace IpcStream Return Me End Function + Public Function handleCreate(stream As ObjectStream) As Object + Using buf As Stream = stream.openMemoryBuffer + Return handleCreate(buf, stream.GetUnderlyingType, stream.method) + End Using + End Function + Public Function handleCreate(buf As Stream, type As Type, emit As StreamMethods) As Object If emit = StreamMethods.Auto Then If loadBuffers.ContainsKey(type) Then