Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Teigha.DatabaseServices;
- using Teigha.Runtime;
- using Teigha.Geometry;
- using HostMgd.ApplicationServices;
- using HostMgd.EditorInput;
- using System.Reflection;
- using System.IO;
- namespace CommandProxy
- {
- public class CommandsProxy : IExtensionApplication
- {
- public void Initialize()
- {
- DebugReloadDll();
- }
- public void Terminate()
- {
- }
- private void ReloadDelegate(string pathToDll)
- {
- byte[] assemblyBytes = File.ReadAllBytes(pathToDll);
- DLL = Assembly.Load(assemblyBytes);
- Type cls = DLL.GetType("Sample1.CommandsDelegate");
- commandsDelegate = Activator.CreateInstance(cls);
- }
- [CommandMethod("DebugReloadDll")]
- public void DebugReloadDll() =>
- ReloadDelegate(@"C:\Users\talmaza\Documents\Visual Studio 2015\Projects\Sample1\Sample1\bin\Debug NCAD\Sample1.dll");
- [CommandMethod("Face")]
- public void WritePoint()
- {
- var method = commandsDelegate.GetType().GetMethod("WritePoint");
- method.Invoke(commandsDelegate, null);
- }
- [CommandMethod("Face2")]
- public void WritePoint2()
- {
- var method = commandsDelegate.GetType().GetMethod("WritePoint2");
- method.Invoke(commandsDelegate, null);
- }
- private static Assembly DLL;
- private static object commandsDelegate;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement