예제 #1
0
        private void buttonLoadPlugin_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Multiselect = true;
            dlg.Filter      = "DLL files | *.dll";
            if (dlg.ShowDialog() != DialogResult.Cancel)
            {
                foreach (string pluginPath in dlg.FileNames)
                {
                    Signature signatureToCheck = new Signature(pluginPath);
                    string    pluginName       = Path.GetFileName(pluginPath);
                    try
                    {
                        if (signatureToCheck.CheckIfValid())
                        {
                            LoadingOfPlugin.ProccessLoadingOfPlugins(pluginPath, factoryFormEditor, comboBoxItems);
                        }
                        else
                        {
                            MessageBox.Show(pluginName + " - " + "Подлинность плагина не установлена!");
                        }
                    }
                    catch (BadImageFormatException)
                    {
                        MessageBox.Show(pluginName + " - " + "Ошибка загрузки dll");
                    }

                    catch (Exception exception)
                    {
                        MessageBox.Show(pluginName + " - " + exception.Message);
                    }
                }
            }
        }