Преглед изворни кода

Merge remote-tracking branch 'origin/Rpc' into nick

Nick-PRSDigital@bitbucket.org пре 2 година
родитељ
комит
baede2e589
2 измењених фајлова са 4 додато и 2 уклоњено
  1. 2 0
      InABox.Client.RPC/RPCClient.cs
  2. 2 2
      InABox.Core/Serialization.cs

+ 2 - 0
InABox.Client.RPC/RPCClient.cs

@@ -222,6 +222,8 @@ namespace InABox.Rpc
         {
             try
             {
+                if (!_transport.IsConnected())
+                    _transport.Connect();
                 _transport.Send<RpcPingCommand, RpcPingParameters, RpcPingResult>(new RpcPingParameters());
                 return true;
             }

+ 2 - 2
InABox.Core/Serialization.cs

@@ -727,7 +727,7 @@ namespace InABox.Core
         public static void WriteObjects<TObject>(this CoreBinaryWriter writer, Type type, ICollection<TObject>? objects)
             where TObject : BaseObject
         {
-            if (!type.IsAssignableFrom(typeof(TObject)))
+            if (!typeof(TObject).IsAssignableFrom(type))
                 throw new Exception($"{type.EntityName()} is not a subclass of {typeof(TObject).EntityName()}");
 
             var nObjs = objects?.Count ?? 0;
@@ -769,7 +769,7 @@ namespace InABox.Core
         
         public static List<TObject> ReadObjects<TObject>(this CoreBinaryReader reader, Type type) where TObject : BaseObject
         {
-            if (!type.IsAssignableFrom(typeof(TObject)))
+            if (!typeof(TObject).IsAssignableFrom(type))
                 throw new Exception($"{type.EntityName()} is not a subclass of {typeof(TObject).EntityName()}");
             
             var objs = new List<TObject>();