source: trunk/eraser/Eraser.BlackBox/Plugin.cs @ 2509

Revision 2509, 1.9 KB checked in by lowjoel, 2 years ago (diff)

Redesign the Eraser Plugin framework.

  • Split the plugin-dependent interfaces and related support classes out to Eraser.Plugins assembly
    • The extension interfaces are in the Eraser.Plugins.ExtensionPoints? namespace.
      • New IClientTool interface for plugins to create Eraser-hosted tools (e.g. #147)
    • The Registrars are in the Eraser.Plugins.Registrars namespace
    • Base types are now interfaces, no longer abstract base classes
    • Version the Eraser.plugins assembly differently from the rest of the project so that other plugins can target different versions of Eraser with the same assembly. Change the Eraser.Plugins assembly version only if there is an API change.
  • Plugin loading behaviour:
    • Core plugins will be loaded before the rest of the plugins, but they will be loaded only by assembly name and not by path
    • Non-core plugin loading is handled by the Manager Library and not the Plugin code
    • The PluginInstance? class is now the PluginInfo? class
    • There is no longer a need to indicate the default file and unused space erasure methods, PRNGs etc; they are now hardcoded to prevent plugins from changing defaults.
  • The separate command line for the Eraser shell extension has been removed.
    • The Erase on Restart menu item has been removed (since it is a scheduling option and should be set in the Task Properties Dialog)
  • Task Progress information is now pulled from the Eraser core instead of pushed via events.
  • New persistent store class to generalise the use of the old Settings class
  • IDragAndDropConfigurerFactory for transforming drag-and-drop operations to erasure targets. This removes the Eraser.exe assembly's dependency on Eraser.DefaultPlugins?.

Closes #363.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2010 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By:
6 *
7 * This file is part of Eraser.
8 *
9 * Eraser is free software: you can redistribute it and/or modify it under the
10 * terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option) any later
12 * version.
13 *
14 * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 *
18 * A copy of the GNU General Public License can be found at
19 * <http://www.gnu.org/licenses/>.
20 */
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25using System.Windows.Forms;
26
27using Eraser.Plugins;
28
29namespace Eraser.BlackBox
30{
31    public sealed class Plugin : IPlugin
32    {
33        public void Initialize(PluginInfo info)
34        {
35            //Initialise our crash handler
36            BlackBox blackBox = BlackBox.Get();
37
38            //Hook the Application's idle loop to display the form
39            Application.Idle += OnGUIIdle;
40        }
41
42        public void Dispose()
43        {
44            GC.SuppressFinalize(this);
45        }
46
47        public string Name
48        {
49            get { return "Eraser BlackBox"; }
50        }
51
52        public string Author
53        {
54            get { return "The Eraser Project <eraser-development@lists.sourceforge.net>"; }
55        }
56
57        public bool Configurable
58        {
59            get { return false; }
60        }
61
62        public void DisplaySettings(Control parent)
63        {
64            throw new NotImplementedException();
65        }
66
67        public static void OnGUIIdle(object sender, EventArgs e)
68        {
69            Application.Idle -= OnGUIIdle;
70            BlackBox blackBox = BlackBox.Get();
71
72            bool allSubmitted = true;
73            foreach (BlackBoxReport report in blackBox.GetDumps())
74                if (!report.Submitted)
75                {
76                    allSubmitted = false;
77                    break;
78                }
79
80            if (allSubmitted)
81                return;
82
83            BlackBoxMainForm form = new BlackBoxMainForm();
84            form.Show();
85        }
86    }
87}
Note: See TracBrowser for help on using the repository browser.