Files
Dunestorm 6d7fec03b4 [VMware Launcher 2.0.9.5]
- Refactored code.
- Fixed bug: "#1 Welcome message shows despite VMware not being installed"
2021-03-26 20:20:46 +00:00

33 lines
1.0 KiB
C#

using System.Diagnostics;
using System.IO;
using System.Linq;
namespace VMwareLauncher
{
public class ProcessControl
{
public readonly static string DefaultVmwareExe = "vmware";
public readonly static string DefaultVmwarePath = (string) Microsoft.Win32.Registry.GetValue(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation",
"InstallPath", null) +
$"{DefaultVmwareExe}.exe";
public readonly static string DefaultVmLauncherPath = "vmwarelauncher";
public string ProcessName { get; set; }
public void StartProcess()
{
ProcessStartInfo pInf = new ProcessStartInfo(ProcessName);
FileInfo fInf = new FileInfo(ProcessName);
pInf.WorkingDirectory = fInf.DirectoryName;
Process proc = Process.Start(pInf);
}
public bool IsProcessRunning()
{
Process[] proc = Process.GetProcessesByName(ProcessName);
return proc.Count() != 1;
}
}
}