-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
48 lines (44 loc) · 1.55 KB
/
Program.cs
File metadata and controls
48 lines (44 loc) · 1.55 KB
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
using System;
using System.Web;
using System.Windows.Forms;
namespace yt_dl_protocol
{
internal static class Program
{
[STAThread]
static void Main(string[] args)
{
if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length > 0)
{
string arg = HttpUtility.UrlDecode(string.Join(" ", args).Replace("ytdl://", "").Trim());
switch (arg)
{
case "register":
Utils.RegisterURLProtocol("ytdl", Application.ExecutablePath, "yt-dl-protocol-handler");
break;
case "unregister":
Utils.UnregisterURLProtocol("ytdl");
break;
case "configuration":
var configForm = new ConfigurationForm();
configForm.ShowDialog();
break;
default:
var commandForm = new CommandForm(arg);
commandForm.ShowDialog();
break;
}
}
else
{
var configForm = new ConfigurationForm();
configForm.ShowDialog();
}
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
}
}