Repository navigation
Expand file tree
/
Copy pathSetup.cs
More file actions
51 lines (47 loc) · 1.74 KB
/
Copy pathSetup.cs
File metadata and controls
51 lines (47 loc) · 1.74 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
49
50
51
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace RightClickTools
{
class Setup
{
[STAThread]
static void Main(string[] args)
{
try
{
// Get the directory where Setup.exe is located
string setupDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
// Look for RightClickTools.exe in the same directory
string rightClickToolsPath = Path.Combine(setupDirectory, "RightClickTools.exe");
if (!File.Exists(rightClickToolsPath))
{
MessageBox.Show(
"Error: RightClickTools.exe not found in the same directory as Setup.exe\n\n" +
"Expected path: " + rightClickToolsPath,
"Setup Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
// Launch RightClickTools.exe with /Setup argument
Process p = new Process();
p.StartInfo.FileName = rightClickToolsPath;
p.StartInfo.Arguments = "/Setup";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false;
p.Start();
}
catch (Exception ex)
{
MessageBox.Show(
"Error launching RightClickTools.exe:\n\n" + ex.Message,
"Setup Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}