From 782fd649333cebd58f2cfd1568aae5adff2ee1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Sun, 3 Sep 2023 10:59:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClientTest/ClientTest.csproj | 2 +- Stardust.Data/Stardust.Data.csproj | 2 +- Stardust.Server/Stardust.Server.csproj | 2 +- Stardust.Web/Stardust.Web.csproj | 4 ++-- Stardust/LocalStarClient.cs | 20 ++++++++++++++------ Stardust/Stardust.csproj | 4 ++-- Test/Test.csproj | 2 +- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ClientTest/ClientTest.csproj b/ClientTest/ClientTest.csproj index 553a4783..1df0586a 100644 --- a/ClientTest/ClientTest.csproj +++ b/ClientTest/ClientTest.csproj @@ -21,7 +21,7 @@ - + diff --git a/Stardust.Data/Stardust.Data.csproj b/Stardust.Data/Stardust.Data.csproj index e6200e7a..d8c663cb 100644 --- a/Stardust.Data/Stardust.Data.csproj +++ b/Stardust.Data/Stardust.Data.csproj @@ -39,7 +39,7 @@ - + diff --git a/Stardust.Server/Stardust.Server.csproj b/Stardust.Server/Stardust.Server.csproj index 772d6f4b..6814f5d5 100644 --- a/Stardust.Server/Stardust.Server.csproj +++ b/Stardust.Server/Stardust.Server.csproj @@ -32,7 +32,7 @@ - + diff --git a/Stardust.Web/Stardust.Web.csproj b/Stardust.Web/Stardust.Web.csproj index 0b2684a0..30f24e7d 100644 --- a/Stardust.Web/Stardust.Web.csproj +++ b/Stardust.Web/Stardust.Web.csproj @@ -42,8 +42,8 @@ - - + + diff --git a/Stardust/LocalStarClient.cs b/Stardust/LocalStarClient.cs index 8465c018..fc83b528 100644 --- a/Stardust/LocalStarClient.cs +++ b/Stardust/LocalStarClient.cs @@ -447,19 +447,27 @@ public static IEnumerable Scan(AgentInfo local = null, Int32 timeout var rs = new DefaultMessage(); IPEndPoint ep = null; buf = udp.Receive(ref ep); +#if NET40 if (buf != null && rs.Read(buf) && encoder.Decode(rs, out var action, out _, out var data)) { - //ms = rs.Payload.GetStream(); - //var reader=new BinaryReader(ms); - //var name=reader.ReadString(); - //var code = reader.ReadInt32(); - //var data=reader - var js = encoder.DecodeResult(action, data, rs); var info = (AgentInfo)encoder.Convert(js, typeof(AgentInfo)); yield return info; } +#else + if (buf != null && rs.Read(buf)) + { + var msg = encoder.Decode(rs); + if (msg != null) + { + var js = encoder.DecodeResult(msg.Action, msg.Data, rs); + var info = (AgentInfo)encoder.Convert(js, typeof(AgentInfo)); + + yield return info; + } + } +#endif } } #endregion diff --git a/Stardust/Stardust.csproj b/Stardust/Stardust.csproj index 63d49f70..de851bd2 100644 --- a/Stardust/Stardust.csproj +++ b/Stardust/Stardust.csproj @@ -86,8 +86,8 @@ - - + + diff --git a/Test/Test.csproj b/Test/Test.csproj index b2ab66c1..f1507bbd 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -25,7 +25,7 @@ - +