Преглед на файлове

Merge pull request #23 from zhulangren/patch-3

Update JT808_0x0900_Custom_Factory.cs
tags/v2.4.3
SmallChi(Koike) преди 3 години
committed by GitHub
родител
ревизия
5adf90988a
No known key found for this signature in database GPG ключ ID: 4AEE18F83AFDEB23
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. +2
    -2
      src/JT808.Protocol/Internal/JT808_0x0900_Custom_Factory.cs

+ 2
- 2
src/JT808.Protocol/Internal/JT808_0x0900_Custom_Factory.cs Целия файл

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


public void Register(Assembly externalAssembly) 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) foreach(var type in types)
{ {
var instance = Activator.CreateInstance(type); 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)) if (Map.ContainsKey(attachid))
{ {
throw new ArgumentException($"{type.FullName} {attachid} An element with the same key already exists."); throw new ArgumentException($"{type.FullName} {attachid} An element with the same key already exists.");


Зареждане…
Отказ
Запис