首页 > 其他分享 >Revit附加模块Add-in Manager里一次性加载所有.dll文件

Revit附加模块Add-in Manager里一次性加载所有.dll文件

时间:2023-04-04 15:11:41浏览次数:38  
标签:return Manager dll item Add CurrentDomain var Assembly

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
GlobalRevitData.commandData = commandData;
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;//在Execute方法体内添加这行代码调用后面的新建方法,用于打开Add-in时就直接启动
var bootstrapper = new MainViewBootStrappers();
bootstrapper.Run();

return Result.Succeeded;
}

//此方法为遍历当前文件夹下所有.ll文件并载入
public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var name = args.Name.Split(',')[0];
var assembly = Assembly.GetAssembly(typeof(MainView));
var location = assembly.Location;
var dirPath = System.IO.Path.GetDirectoryName(location);
var dirInfo = new DirectoryInfo(dirPath);
foreach (var item in dirInfo.GetFiles())
{
if (System.IO.Path.GetFileNameWithoutExtension(item.FullName) == name)
{
return Assembly.LoadFile(item.FullName);
}
}
return null;
}

标签:return,Manager,dll,item,Add,CurrentDomain,var,Assembly
From: https://www.cnblogs.com/90Red/p/17286470.html

相关文章

  • Address already in use: JVM_Bind:80
    今天maven工程中配置pom.xml时Tomcat配了80端口号,结果提示Addressalreadyinuse:JVM_Bind:80,也就是80端口被占用,于是就按照往常的惯例去查看是什么进程占用了80端口1、打开cmd命令窗口,输入netstat-ano|findstr80,回车就会看见被占用端口号8080所对应的PID为4然后去任务管......
  • magento 在产品页添加评论 Add Review Form in Magento Product View Page
    Magento产看产品评论需要点击到另外一个页面中,这种设计对于用户体验和SEO都相当不利。一方面用户无法在产品页面查看该产品的一些用户评价,另外,搜索引擎也会收录很多与产品无关的页面。那么如何让产品评论直接显示在产品页面呢?我们需要修改一下模板文件,很简单即可实现。 首先,在lay......
  • Select all in address bar of firefox (Ubuntu, Linux Mint) with a single click
    Toomanythingstomodifyafterinstallingubuntuorlinuxmint.OneoftheannoyingthingisClickingtheaddressbaronFirefox(providedwithUbuntu,linuxmint)doesn’tselectthewholetextinit.Itsaverysmallproblem.Butitssoannoyingthat,t......
  • 【深入浅出 Yarn 架构与实现】6-2 NodeManager 状态机管理
    一、简介NodeManager(NM)中的状态机分为三类:Application、Container和LocalizedResource,它们均直接或者间接参与维护一个应用程序的生命周期。当NM收到某个Application的第一个container启动命令时,它会创建一个「Application状态机」来跟踪该应用程序在该节点的状态;每个......
  • addr2line用法
    addr2linecommandinLinuxwithExamples https://www.geeksforgeeks.org/addr2line-command-in-linux-with-examples/使用addr2line命令定位到行号解析.so的文件 https://www.jianshu.com/p/7e41cb9050c1addr2line动态库[通俗易懂] https://cloud.tencent.com/developer......
  • PaddleOCR服务部署-并通过Java进行调用
    文章转载自: https://blog.csdn.net/f2315895270/article/details/128150679选择部署方式  官方推荐有以下几种:  Python推理  C++推理  Serving服务化部署(Python/C++)  Paddle-Lite端侧部署(ARM CPU/OpenCLARMGPU)  Paddle.js部署     由于我......
  • PaddleOCR 安装与简单使用(windows)
    文章转载自: https://blog.csdn.net/f2315895270/article/details/128147744前提    已经安装好Python环境   PaddleOCR官方主页:https://www.paddlepaddle.org.cn/   GitHub地址:https://github.com/PaddlePaddle/PaddleOCR   Gitee地址:https://gitee......
  • ConfigurationManager 读取的不是最新值
    用ConfigurationManager修改配置后,ConfigurationManager读取的不是最新值。 解决方法:第一种:ConfigurationManager.RefreshSection("appSettings");//刷新appSettings节点(立即生效)ConfigurationManager.RefreshSection("connectionString");//刷新connect......
  • VS2017 未能正确加载“ReferenceManagerPackage”包
    MicrosoftVisualStudio未能正确加载“ReferenceManagerPackage”包。1.以管理员身份打开DeveloperCommandPromptforVS20172.定位到你的vs2017的安装目录我安装的是企业版就是E:\ProgramFiles(x86)\MicrosoftVisualStudio\2017\Enterprise\Common7\IDE\PublicAssemblies......
  • 使用vSphere Update Manager 升级 ESXi 主机
    使用vSphereUpdateManager升级ESXi主机vSphereUpdateManager vSphereUpdateManager 是用于升级、迁移、更新和修补群集主机、虚拟机和客户机操作系统的软件。 vSphereUpdateManager 可协调主机和虚拟机的升级。如果站点使用 vSphereUpdateManager,VMware建议......