public VirtualJoystick(uint deviceId, VJoyDeviceProfile profile) { DeviceId = deviceId; Profile = profile; VJoyConfig.CreateDevice(DeviceId, Profile); }
public static void CreateDevice(uint id, VJoyDeviceProfile profile) { Logger.Info("Create VJoy " + id + " based on profile " + profile); Process process; switch (profile) { case VJoyDeviceProfile.Small: process = new Process { StartInfo = new ProcessStartInfo("vJoyConfig.exe", id + " -f -a x y -b 10") { Verb = "runas", CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = true } }; break; case VJoyDeviceProfile.Full: process = new Process { StartInfo = new ProcessStartInfo("vJoyConfig.exe", id + " -f - a x y z -b 10 -s 1") { Verb = "runas", CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = true } }; break; default: throw new NotImplementedException(); } process.Start(); if (!process.WaitForExit(WaitForProcess)) { process.Kill(); } if (process.ExitCode != 0) { Logger.Warn("Exit code is not 0. It was " + process.ExitCode); } else { Logger.Info("Creation of VJoy " + id + " based on profile " + profile + " successfully"); } }