-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cs
137 lines (129 loc) · 4.87 KB
/
Main.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using System;
using System.IO;
using SuchByte.MacroDeck;
using System.Collections.Generic;
using SuchByte.MacroDeck.Plugins;
using jbcarreon123.ShareXPlugin.GUI;
using jbcarreon123.ShareXPlugin.Actions;
using jbcarreon123.ShareXPlugin.Languages;
using SuchByte.MacroDeck.Logging;
// jbcarreon123.ShareXPlugin
// ShareX Plugin for Macro Deck
namespace jbcarreon123.ShareXPlugin
{
public static class PluginInstance
{
public static Main Main { get; set; }
}
public class Main : MacroDeckPlugin
{
public override bool CanConfigure => true;
public static Main Instance;
public Main()
{
//Instance = this; // does not exist in the current context
PluginInstance.Main = this;
}
private void MacroDeck_OnMainWindowLoad(object sender, EventArgs e)
{
int apiver = MacroDeck.PluginApiVersion;
if (apiver >= 22)
{
MacroDeckLogger.Trace(PluginInstance.Main, $"Plugin API: {apiver}");
}
else
{
MacroDeckLogger.Warning(PluginInstance.Main, $"Plugin API version {apiver} is not recognized. You may expierence issues.");
}
string pathf = PluginConfigHelper.GetPath();
if (!File.Exists(pathf + "\\ShareX.exe"))
{
MacroDeckLogger.Error(PluginInstance.Main, $"Error: Can't find ShareX.exe on path {pathf}. ");
//return;
}
}
public override void Enable()
{
Instance ??= this;
PluginLanguageManager.Initialize();
string pathf = PluginConfigHelper.GetPath();
if (!File.Exists(pathf + "\\ShareX.exe"))
{
MacroDeckLogger.Error(PluginInstance.Main, $"Error: Can't find ShareX.exe on path {pathf}. ");
//return;
}
this.Actions = new List<PluginAction>
{
// Alphabetical order.
new AbortScreenRecordingAction(),
new ActiveMonitorAction(),
new ActiveWindowAction(),
new AutoCaptureAction(),
new BorderlessWindowAction(),
new ClipboardUploadAction(),
new ClipboardUploadWithContentViewerAction(),
new ClipboardViewerAction(),
new ColorPickerAction(),
new CustomRegionAction(),
new DNSChangerAction(),
new DisableHotkeysAction(),
new DragDropUploadAction(),
new ExitShareXAction(),
new FileUploadAction(),
new FolderUploadAction(),
new HashCheckAction(),
new ImageCombinerAction(),
new ImageEditorAction(),
new ImageEffectsAction(),
new ImageSplitterAction(),
new ImageThumbnailerAction(),
new ImageViewerAction(),
new IndexFolderAction(),
new InspectWindowAction(),
new LastRegionAction(),
new MonitorTestAction(),
new OCRAction(),
new OpenHistoryAction(),
new OpenImageHistoryAction(),
new OpenMainWindowAction(),
new OpenScreenshotsFolderAction(),
new PauseScreenRecordingAction(),
new PrintScreenAction(),
new QRCodeAction(),
new QRCodeDecodeFromScreenAction(),
new RectangleLightAction(),
new RectangleRegionAction(),
new RectangleTransparentAction(),
new RulerAction(),
new ScreenColorPickerAction(),
new ScreenRecorderAction(),
new ScreenRecorderActiveWindowAction(),
new ScreenRecorderCustomRegionAction(),
new ScreenRecorderGIFAction(),
new ScreenRecorderGIFActiveWindowAction(),
new ScreenRecorderGIFCustomRegionAction(),
new ScrollingCaptureAction(),
new ShortenURLAction(),
new StartAutoCaptureAction(),
new StartScreenRecorderAction(),
new StartScreenRecorderGIFAction(),
new StopScreenRecordingAction(),
new StopUploadsAction(),
new ToggleActionsToolbarAction(),
new ToggleTrayMenuAction(),
new TweetMessageAction(),
new UploadTextAction(),
new UploadURLAction(),
new VideoConverterAction(),
new VideoThumbnailerAction()
};
}
public override void OpenConfigurator()
{
using (var pluginConfig = new PluginConfig())
{
pluginConfig.ShowDialog();
}
}
}
}