From a9873cddba3045ba3560e3e7df9d204820e59948 Mon Sep 17 00:00:00 2001 From: yedajiang44 <602830483@qq.com> Date: Sun, 14 May 2023 00:13:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D0x8900=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=B7=A5=E5=8E=82=E6=B3=A8=E5=86=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Internal/JT808_0x8900_Custom_Factory.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs b/src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs index 84bd576..f1011ef 100644 --- a/src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs +++ b/src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs @@ -1,10 +1,6 @@ -using JT808.Protocol.Interfaces; +using System.Reflection; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; namespace JT808.Protocol.Internal { @@ -19,8 +15,7 @@ namespace JT808.Protocol.Internal public void Register(Assembly externalAssembly) { - var types = externalAssembly.GetTypes().Where(w => w.GetInterface(nameof(JT808_0x0200_CustomBodyBase)) == typeof(JT808_0x0200_CustomBodyBase)).ToList(); - foreach(var type in types) + foreach (var type in externalAssembly.GetTypes().Where(w => w.GetInterface(nameof(JT808_0x8900_BodyBase)) == typeof(JT808_0x8900_BodyBase))) { var instance = Activator.CreateInstance(type); var attachid = (byte)type.GetProperty(nameof(JT808_0x0200_CustomBodyBase.AttachInfoId)).GetValue(instance);