瀏覽代碼

修复0x8900自定义工厂注册问题

tags/v2.6.2
yedajiang44 2 年之前
父節點
當前提交
a9873cddba
共有 1 個文件被更改,包括 3 次插入8 次删除
  1. +3
    -8
      src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs

+ 3
- 8
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);


Loading…
取消
儲存