-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathShareXUpload.cs
33 lines (28 loc) · 949 Bytes
/
ShareXUpload.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
using Microsoft.Win32;
using System.Diagnostics;
namespace WebMConverter
{
static class ShareXUpload
{
public static bool Enabled { get; private set; }
public static string InstallPath { get; private set; }
public static void CheckEnabled()
{
var installPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Classes\*\shell\ShareX\command", null, null);
if (installPath == null) return;
Enabled = true;
var start = installPath.IndexOf('"') + 1;
var end = installPath.IndexOf('"', start);
InstallPath = installPath.Substring(start, end - start);
}
}
class ShareX : Process
{
public ShareX(string filename)
{
if (!ShareXUpload.Enabled) return;
StartInfo.FileName = ShareXUpload.InstallPath;
StartInfo.Arguments = $@"""{filename}""";
}
}
}