驱动加载优化
This commit is contained in:
parent
a1f0719f78
commit
fd11bc5747
@ -115,11 +115,11 @@ namespace Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void LoadAllDrivers()
|
public void LoadAllDrivers()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
_logger.LogInformation("LoadAllDrivers Start");
|
_logger.LogInformation("LoadAllDrivers Start");
|
||||||
foreach (var file in driverFiles)
|
foreach (var file in driverFiles)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var dll = Assembly.LoadFrom(file);
|
var dll = Assembly.LoadFrom(file);
|
||||||
foreach (var type in dll.GetTypes().Where(x => typeof(IDriver).IsAssignableFrom(x) && x.IsClass))
|
foreach (var type in dll.GetTypes().Where(x => typeof(IDriver).IsAssignableFrom(x) && x.IsClass))
|
||||||
@ -130,15 +130,17 @@ namespace Plugin
|
|||||||
Type = type
|
Type = type
|
||||||
};
|
};
|
||||||
DriverInfos.Add(driverInfo);
|
DriverInfos.Add(driverInfo);
|
||||||
|
_logger.LogInformation($"LoadAllDrivers {driverInfo.FileName} OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.LogInformation($"LoadAllDrivers End,Count{DriverInfos.Count}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError("LoadAllDrivers Error,一般是驱动项目引用的nuget或dll没有复制到驱动文件夹", ex);
|
_logger.LogDebug($"LoadAllDrivers Error {ex}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_logger.LogInformation($"LoadAllDrivers End,Count{DriverInfos.Count}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadRegestedDeviers()
|
public void LoadRegestedDeviers()
|
||||||
|
Loading…
Reference in New Issue
Block a user