Пример #1
0
        private void Excuted(object obj)
        {
            var item = (Item)obj;

            string[] pathStrings = item.DllPath.Split('\\');
            string[] pathName    = pathStrings[pathStrings.Length - 1].Split('.');
            switch (pathName[0])
            {
            case "Local":
                this.GetType().GetMethod(pathName[pathName.Length - 1])?.Invoke(this, null);
                break;

            default:
                Assembly DLL;
                try
                {
                    DLL = Assembly.LoadFrom(item.DllPath);
                }
                catch (FileNotFoundException exception)
                {
                    MessageBox.Show("Invalid!");
                    return;
                }
                //var tool = (Tools)DLL.CreateInstance(item.ClassName);
                //foreach (var treeItem in tool.treeItems())
                //    treeItem.func();
                IToolPlugin tool = (IToolPlugin)DLL.CreateInstance(item.ClassName);
                try
                {
                    tool.Func(item.Params);
                }
                catch (Exception ex)
                {
                }

                break;
            }
        }