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

Revision 1981, 1.9 KB checked in by lowjoel, 5 years ago (diff)

Allow different types of loading policies for plugins. The old CoreAttribute? has been superseded by the LoadingPolicyAttribute?. This allows us to specify the loading policy for plugins such as BlackBox? which will have the same strong name as the main program, an Authenticode signature, but should not be loaded by default.

  • 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.Manager.Plugin;
28
29namespace Eraser.BlackBox
30{
31    public sealed class Plugin : IPlugin
32    {
33        public void Initialize(Host host)
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.