소스 검색

Fixes to RPC Clients

Frank van den Bos 2 년 전
부모
커밋
7dfa212cf6

+ 1 - 1
InABox.Client.RPC/InABox.Client.RPC.csproj

@@ -2,7 +2,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <ImplicitUsings>enable</ImplicitUsings>
+        <ImplicitUsings>disable</ImplicitUsings>
         <Nullable>enable</Nullable>
         <RootNamespace>InABox.RPC.Client</RootNamespace>
     </PropertyGroup>

+ 1 - 0
InABox.Client.RPC/RPCClientSession.cs

@@ -9,5 +9,6 @@ namespace InABox.Rpc
         public Platform Platform { get; set; }
         public string? Version { get; set; }
         public string UserID { get; set; }
+        public Guid UserGuid { get; set; }
     }
 }

+ 1 - 1
InABox.Core/Serialization.cs

@@ -697,7 +697,7 @@ namespace InABox.Core
             if (!type.IsSubclassOf(typeof(TObject)))
                 throw new Exception($"{type.EntityName()} is not a subclass of {typeof(TObject).EntityName()}");
 
-            var obj = (Activator.CreateInstance(type) as BaseObject)!;
+            var obj = (Activator.CreateInstance(type) as TObject)!;
             obj.SetObserving(false);
 
             var nProps = reader.ReadInt32();

+ 1 - 1
InABox.RPC.Shared/InABox.RPC.Shared.csproj

@@ -2,7 +2,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <ImplicitUsings>enable</ImplicitUsings>
+        <ImplicitUsings>disable</ImplicitUsings>
         <Nullable>enable</Nullable>
     </PropertyGroup>
 

+ 2 - 2
InABox.Server/RPC/Transports/RPCServerTransport.cs

@@ -135,7 +135,7 @@ namespace InABox.Rpc
 
         public void NotifyAll<TNotification>(TNotification notification) where TNotification : BaseObject
         {
-            var message = new RpcMessage(Guid.NewGuid(), "Notification", RpcNotification.Create(notification).WriteBinary(BinarySerializationSettings.Latest)));
+            var message = new RpcMessage(Guid.NewGuid(), "Notification", RpcNotification.Create(notification).WriteBinary(BinarySerializationSettings.Latest));
             foreach (var connection in _sessions.Keys)
             {
                 Send(connection, message);
@@ -144,7 +144,7 @@ namespace InABox.Rpc
 
         public void NotifySession<TNotification>(Guid session, TNotification notification) where TNotification : BaseObject
         {
-            var message = new RpcMessage(Guid.NewGuid(), "Notification", RpcNotification.Create(notification).WriteBinary(BinarySerializationSettings.Latest)));
+            var message = new RpcMessage(Guid.NewGuid(), "Notification", RpcNotification.Create(notification).WriteBinary(BinarySerializationSettings.Latest));
 
             var sessionConnection = _sessions.FirstOrDefault(x => x.Value.ID == session).Key;
             if(sessionConnection is not null)

+ 1 - 0
inabox.client.rest/InABox.Client.Rest/InABox.Client.Rest.csproj

@@ -7,6 +7,7 @@
     </PropertyGroup>
 
     <ItemGroup>
+      <ProjectReference Include="..\..\inabox.client.websocket\InABox.Client.WebSocket.csproj" />
       <ProjectReference Include="..\..\InABox.Core\InABox.Core.csproj" />
     </ItemGroup>
 

+ 1 - 4
inabox.client.rest/InABox.Client.Rest/RestClient.cs

@@ -1,16 +1,13 @@
 using System.IO.Compression;
 using System.Net;
-using System.Net.Security;
 using InABox.Core;
-using InABox.WebSocket.Shared;
 using RestSharp;
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Net.Http;
-using System.Threading;
 using System.Threading.Tasks;
+using InABox.WebSocket.Shared;
 
 
 namespace InABox.Clients

+ 1 - 5
inabox.client.rest/InABox.Client.Rest/SocketClientCache.cs

@@ -1,11 +1,7 @@
-using InABox.Client.WebSocket;
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Linq;
-using System.Net.Http;
-using System.Threading;
-using System.Threading.Tasks;
+using InABox.Client.WebSocket;
 
 namespace InABox.Clients
 {

+ 1 - 0
inabox.client.websocket/InABox.Client.WebSocket.csproj

@@ -11,6 +11,7 @@
 
   <ItemGroup>
     <ProjectReference Include="..\InABox.Core\InABox.Core.csproj" />
+    <ProjectReference Include="..\inabox.websocket.shared\InABox.WebSocket.Shared.csproj" />
   </ItemGroup>
 
 </Project>

+ 1 - 5
inabox.client.websocket/WebSocketClient.cs

@@ -1,15 +1,11 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading.Tasks;
 using WebSocketSharp;
 using Socket = WebSocketSharp.WebSocket;
 using Logger = InABox.Core.Logger;
 using InABox.Core;
-using InABox.WebSocket.Shared;
 using InABox.Clients;
-using InABox.Core.Notifications;
+using InABox.WebSocket.Shared;
 
 namespace InABox.Client.WebSocket
 {