Ver a proveniência

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

tags/v2.6.2
yedajiang44 há 2 anos
ascendente
cometimento
a9873cddba
1 ficheiros alterados com 3 adições e 8 eliminações
  1. +3
    -8
      src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs

+ 3
- 8
src/JT808.Protocol/Internal/JT808_0x8900_Custom_Factory.cs Ver ficheiro

@@ -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);


Carregando…
Cancelar
Guardar