Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (39 loc) · 1.63 KB
/
Copy pathProgram.cs
File metadata and controls
43 lines (39 loc) · 1.63 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
using System;
using System.Diagnostics;
using System.Security.Principal;
using System.Windows.Forms;
namespace MceRemoteMapper
{
/// <summary>
/// Application initialization.
/// </summary>
static class Program
{
[STAThread]
static void Main()
{
// Detect administrative rights.
bool administrator = (new WindowsPrincipal(WindowsIdentity.GetCurrent())).IsInRole(WindowsBuiltInRole.Administrator);
if (!administrator)
{
MessageBox.Show("This application requires administrative rights in order to update the registry.", "Administrative rights required", MessageBoxButtons.OK, MessageBoxIcon.Information);
ProcessStartInfo proccessStartInfo = new ProcessStartInfo();
proccessStartInfo.UseShellExecute = true;
proccessStartInfo.WorkingDirectory = Environment.CurrentDirectory;
proccessStartInfo.FileName = Application.ExecutablePath;
proccessStartInfo.Verb = "runas";
Process.Start(proccessStartInfo);
return;
}
// Detect remote receiver.
if (!Remote.Detect())
{
MessageBox.Show("No compatible RC6 based MCE remote receiver could be found.", "Receiver could not be detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
}