- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我的程序有一个 pluginManager 模块,它可以加载 DLL 文件并运行 DLL 的方法,但我需要在 Assembly.LoadFile()
之前读取 DLL 属性。我该怎么办?
我读过关于 Assembly 的文档,它们在 Assembly.LoadFile()
之后读取属性,你知道 Assembly 没有 UnLoad() 方法,所以我必须在 LoadFile() 之前读取属性
private void ImprotZip(string path)
{
/*
1、create tempDir, uppackage to tempDir
2、Load Plugin DLL, Load plugin dependent lib DLL
*/
string tempDirectory = CreateRuntimeDirectory(path);
string[] dllFiles = Directory.GetFiles(tempDirectory);
///Load DlL
foreach(string dll in dllFiles)
{
ImprotDll(dll, false);
}
string libPath = string.Format("{0}\\lib\\", tempDirectory);
if (!Directory.Exists(libPath))
return;
string[] dlls = Directory.GetFiles(libPath);
///Load plugin dependent lib DLL
foreach(string dll in dlls)
{
try
{
//filtering same DLL
//if(Dll.properties.AssemblyProduct != "something")
//continue;
Assembly.LoadFile(dll);
}
catch(Exception e)
{
e.Log();
}
}
}
最佳答案
您可以使用 Assembly.ReflectionOnlyLoad
将程序集加载到仅反射上下文中.
我仍然会为仅反射上下文创建一个应用程序域,这样您就可以在完成后卸载该域。您可以使用 AppDomain.CreateDomain
创建应用域方法。无论如何,您应该对插件执行此操作,以便在完成后卸载它们。
关于c# - 如何在 Assembly.LoadFile() 之前从 DLL 中读取属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34280293/
在 Lua 中,我如何使用 loadfile() 加载一个函数,例如 function test() print('test') end 然后按名字执行?例如,如果我 loadfile() 然后执行
我正在尝试使用 Ant 任务 在循环中解析文件的内容。我有类似的东西 由于 Ant 属性是不可变的,这对我不起作用。我需要“my.property”在每次迭代时更新。有办法实现这一点吗?我知道 An
我正在尝试使用 mariadb 上的 loadfile 加载 CSV 文件 这是我的加载文件 LOAD DATA INFILE '/usr/src/salary.TXT' INTO TABLE sal
在我的应用程序中,我允许用户查看他们所有的保管箱文件,他们可以将文件导入保管箱或将它们下载到应用程序中。我查看了 Dropbox 的网站,但找不到有关取消上传/下载的任何内容。我有一些取消保管箱文件传
这里有奇怪的问题。我有一个通过 C++ 应用程序中的 dofile() 执行的 Lua 脚本('human.lua')。 我尝试在第一行以非常标准的方式加载另一个 AI 脚本文件: behavior_
我写了一个包装器类,它使用反射加载其他程序集。 Wrapper.dll 也被进程通过反射加载,下面是解释场景的图表。 Process.exe |___Loads__ Wrapper
情况是这样的: 我有一个名为 Lib1.dll 的程序集。出于某种原因(与问题无关)我不得不将程序集文件名重命名为 Lib1New.dll,现在在尝试使用 Assembly.LoadFile 加载重命
1.loadfile只编译,不运行 loadfile(filename, mode, env) 用于加载一个指定路径filename的代码块,参数如下: 基本和load等同,区别是用来加载一个文件的代
我正在尝试从大量 xml 中创建对象树。但是,当我在大约 2000 个 xml 文件(范围从 100KB 到 200MB)上运行以下代码时(请注意,我已经注释掉了创建对象树的代码),我得到了 8-9G
我制作了一个使用 AxAcroPDF 控件的 Windows 客户端应用程序 在表单上显示 pdf 文件。 在我看来,在我将 Acrobat 阅读器从版本 8 升级到版本 9 后,LoadFile 方
这是我的场景: 我有三个项目:两个 DLL 和一个控制台应用程序,我们将它们命名为 foo.dll、bar.dll 和 console.exe。 Console.exe 使用 Assembly.Loa
我开始用 C 语言编程,并且正在编写一个将用户添加到文件中的程序。 我已成功将用户添加到文件中,并且我可以在程序仍在运行时查看已添加的用户。 但是当我关闭程序并再次打开时,如果我按查看用户,它不会显示
我想自动填写 PDF 表单。 所以我在VS2013中创建了一个WinForms项目,添加了Adobe PDF Reader控件,将控件拖到窗体上。 没有错误。控件显示在窗体上。 但是当我尝试输入时在表
我正在尝试使用 LoadFile 方法将 .xpm 类型的图像文件加载到 wxBitmap 对象中。以下调用失败 wxBitmap aBitmap; aBitmap.LoadFile(strIconP
似乎有多种方法可以从另一个文件访问一个文件。为什么我会选择一种方法而不是另一种? local a = loadfile('foo.lua')() local b = require 'foo.lua'
在我的Electron设置中,应用加载后,我会显示一个基于Web的登录屏幕。它位于可填充应用程序屏幕空间的BrowserView中。通过这种方法,我可以为登录页面禁用nodeIntegration(因
异常(exception)情况是: 模块应该包含程序集 list 。 (HRESULT 异常:0x80131018) 我在行中得到它: Assembly lvAssembly = Assembly.L
我正在通过 System.Reflection.Assembly.LoadFile 加载 DLL 并在插件式系统中反射(reflect)它的成员。我需要能够在系统运行时更新/覆盖这些DLL,但似乎在调
我正在查看 msdn 文档,但对于加载程序集时使用 LoadFile 和 LoadFrom 之间的确切区别仍然有点困惑。有人可以提供一个例子或类比来更好地描述它。 MSDN 文档让我更加困惑。另外,R
我正在尝试使用新版本的 libyaml-cpp 并遇到链接器问题 ( undefined reference to 'YAML::LoadFile(std::basic_string, std::al
我是一名优秀的程序员,十分优秀!