/
Config.cs
124 lines (98 loc) · 3.79 KB
/
Config.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImageGlass.Plugins;
using System.Reflection;
namespace Image_Mixer
{
public class Config : IPlugin
{
//Declarations of all our internal plugin variables
string myName = "Image Mixer"; //Tên của plugin
string myDescription = "Create an new image from a few image files by joining them together."; //Miêu tả cho plugin
string myAuthor = "Dương Diệu Pháp"; //Tên tác giả
string myVersion = "1.0"; //Phiên bản của plugin
public Config()
{
//
// TODO: Add constructor logic here
//
}
IPluginHost myHost = null;
System.Windows.Forms.UserControl myMainInterface = new ImageMixture();
/// <summary>
/// Description of the Plugin's purpose
/// </summary>
public string Description
{
get { return myDescription; }
}
/// <summary>
/// Author of the plugin
/// </summary>
public string Author
{
get { return myAuthor; }
}
/// <summary>
/// Host of the plugin.
/// </summary>
public IPluginHost Host
{
//This part is currently not really implemented
/*
Here's the scoop though... You can make the host program
Implement this interface... this essentially gives you the ability
to allow plugins to access some functionality of the host program.
Example: an mp3 player. If you had the IPluginHost interface as like:
public interface IPluginHost
{
void Play(string FileName);
void Stop();
}
what you would do is when the plugin is loaded in the host (this would be
in like the PluginServices.cs file in the AddPlugin() method) you would
set:
newPlugin.Host = this;
this would give the plugin a reference to the host... now since the plugin
knows the host contains these methods, it can easily access them just like:
this.Host.Play("C:\MyCoolMp3.mp3");
and then they could go:
this.Host.Stop();
all this being from right inside the plugin! I hope you get the point. It
just means that you can indeed make your plugins able to interact with the
host program itself. Let's face it.. It would be no fun if you couldn't do this,
because otherwise all the plugin is, is just standalone functionality running
inside the host program.. (of course there are cases when you can still accomplish
many things without needing to allow the plugin to play with the host... for example
you could have an spam filter, and have each plugin be a different filter... that would
be pretty simple to make plugins for...
so anyhow, that is what the host thingy is all aboot, eh!
*/
get { return myHost; }
set { myHost = value; }
}
public string Name
{
get { return myName; }
}
public System.Windows.Forms.UserControl MainInterface
{
get { return myMainInterface; }
}
public string Version
{
get { return myVersion; }
}
public void Initialize()
{
//This is the first Function called by the host...
//Put anything needed to start with here first
}
public void Dispose()
{
//Put any cleanup code in here for when the program is stopped
}
}
}