Browse Source

Update JT808_0x0900_Custom_Factory.cs

修改错误类型
tags/v2.4.3
逐浪人 3 years ago
committed by GitHub
parent
commit
a3f6c7fa98
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/JT808.Protocol/Internal/JT808_0x0900_Custom_Factory.cs

+ 2
- 2
src/JT808.Protocol/Internal/JT808_0x0900_Custom_Factory.cs View File

@@ -19,11 +19,11 @@ namespace JT808.Protocol.Internal

public void Register(Assembly externalAssembly)
{
var types = externalAssembly.GetTypes().Where(w => w.BaseType == typeof(JT808_0x0200_CustomBodyBase)).ToList();
var types = externalAssembly.GetTypes().Where(w => w.BaseType == typeof(JT808_0x0900_BodyBase)).ToList();
foreach(var type in types)
{
var instance = Activator.CreateInstance(type);
var attachid = (byte)type.GetProperty(nameof(JT808_0x0200_CustomBodyBase.AttachInfoId)).GetValue(instance);
var attachid = (byte)type.GetProperty(nameof(JT808_0x0900_BodyBase.PassthroughType)).GetValue(instance);
if (Map.ContainsKey(attachid))
{
throw new ArgumentException($"{type.FullName} {attachid} An element with the same key already exists.");


Loading…
Cancel
Save