Skip to content

Commit

Permalink
Merge pull request #1931 from dosymep/fix_invokebutton
Browse files Browse the repository at this point in the history
Fix invokebutton
  • Loading branch information
jmcouffin authored Sep 30, 2023
2 parents 99ebb71 + d76f3df commit 50e361b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pyrevitlib/pyrevit/runtime/InvokableDLLEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

namespace PyRevitLabs.PyRevit.Runtime {
public class InvokableDLLEngine : ScriptEngine {
private string scriptSig = string.Empty;
private Assembly scriptAssm = null;

public override void Init(ref ScriptRuntime runtime) {
base.Init(ref runtime);

Expand Down Expand Up @@ -39,19 +36,15 @@ public override int Execute(ref ScriptRuntime runtime) {
className = parts[1];
}

var currentSig = CommonUtils.GetFileSignature(assmFile);
if (scriptSig == null || currentSig != scriptSig) {
scriptAssm = Assembly.Load(File.ReadAllBytes(assmFile));
scriptSig = currentSig;
}

Assembly scriptAssm = Assembly.Load(File.ReadAllBytes(assmFile));
var resultCode = CLREngine.ExecuteExternalCommand(scriptAssm, className, ref runtime);
if (resultCode == ScriptExecutorResultCodes.ExternalInterfaceNotImplementedException)
TaskDialog.Show(PyRevitLabsConsts.ProductName,
string.Format(
"Can not find type \"{0}\" in assembly \"{1}\"",
className,
scriptAssm.Location
assmFile
));
return resultCode;
}
Expand Down

0 comments on commit 50e361b

Please sign in to comment.