예제 #1
0
        public void UpdateSteamPaths()
        {
            steamPath = "";
            steamPath = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Valve\Steam", "InstallPath", "").ToString();
            if (steamPath == "")
            {
                MessageBox.Show("Steam installation folder not found!" + Environment.NewLine +
                                "Are you sure it is installed?" + Environment.NewLine +
                                "If you are, please join our Discord server for further assistance (link on www.k2vr.tech)");
                Application.Current.Shutdown(1);
                return;
            }

            steamVrPath = "";
            vrPathReg   = "";
            try
            {
                var openVrPaths = OpenVrPaths.Read();
                foreach (string runtimePath in openVrPaths.runtime)
                {
                    string tempVrPathReg = Path.Combine(runtimePath, "bin", "win64", "vrpathreg.exe");
                    if (File.Exists(tempVrPathReg))
                    {
                        steamVrPath = runtimePath;
                        vrPathReg   = tempVrPathReg;
                        break;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("SteamVR installation folder not found!" + Environment.NewLine +
                                "Are you sure it is installed?" + Environment.NewLine +
                                "If you are, please join our Discord server for further assistance (link on www.k2vr.tech)");
                Application.Current.Shutdown(1);
                return;
            }
            if (vrPathReg == "")
            {
                MessageBox.Show("VRPathReg not found!" + Environment.NewLine +
                                "Please join our Discord server for further assistance (link on www.k2vr.tech)");
                Application.Current.Shutdown(1);
                return;
            }

            steamVrSettingsPath = Path.Combine(steamPath, "config", "steamvr.vrsettings");
            copiedDriverPath    = Path.Combine(steamVrPath, "drivers", "KinectToVR");

            if (!File.Exists(steamVrSettingsPath))
            {
                MessageBox.Show("steamvr.vrsettings not found!" + Environment.NewLine +
                                "Make sure SteamVR has been launched at least once on this machine." + Environment.NewLine +
                                "Please join our Discord server for further assistance (link on www.k2vr.tech)");
                Application.Current.Shutdown(1);
            }
        }
예제 #2
0
        public static Dictionary <string, K2EXInstallProperties> FindK2EX()
        {
            var paths = new Dictionary <string, K2EXInstallProperties>();

            var openVrPaths = OpenVrPaths.Read();

            foreach (string path in openVrPaths.external_drivers)
            {
                if (GetBasePath(path, "KinectToVR") != null)
                {
                    paths[GetBasePath(path, "KinectToVR")] = new K2EXInstallProperties()
                    {
                        DriverRegistered = true
                    };
                }
            }

            var appConfig = AppConfig.Read();

            foreach (string path in appConfig.manifest_paths)
            {
                foreach (string manifest in new string[] { "KinectV1Process.vrmanifest", "KinectV2Process.vrmanifest" })
                {
                    string basePath = GetBasePath(path, manifest);
                    if (basePath != null)
                    {
                        if (!paths.ContainsKey(basePath))
                        {
                            paths[basePath] = new K2EXInstallProperties();
                        }
                        paths[basePath].AppConfigRegistered = true;
                    }
                }
            }

            if (Directory.Exists(k2exDefaultPath))
            {
                if (!paths.ContainsKey(k2exDefaultPath))
                {
                    paths[k2exDefaultPath] = new K2EXInstallProperties();
                }
            }
            return(paths);
        }
예제 #3
0
        public static void UnregisterK2EX(string path)
        {
            string driverPath = path + @"\KinectToVR";

            Process.Start(App.state.vrPathReg, "removedriver \"" + driverPath + "\"").WaitForExit();

            var openVrPaths = OpenVrPaths.Read();

            if (openVrPaths.external_drivers.Contains(driverPath))
            {
                openVrPaths.external_drivers.Remove(driverPath);
                openVrPaths.Write();
            }
            var appConfig = AppConfig.Read();

            appConfig.manifest_paths.Remove(path + @"\KinectV1Process.vrmanifest");
            appConfig.manifest_paths.Remove(path + @"\KinectV2Process.vrmanifest");
            appConfig.Write();
        }
예제 #4
0
        public void UpdateSteamPaths()
        {
            steamPath = "";
            steamPath = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Valve\Steam", "InstallPath", "").ToString();
            if (steamPath == "")
            {
                MessageBox.Show("Steam installation folder not found!" + Environment.NewLine +
                                "Are you sure it is installed?" + Environment.NewLine +
                                "If you are, please join our Discord server for further assistance (link on www.k2vr.tech)");
                Application.Current.Shutdown(1);
                return;
            }

            try
            {
                var openVrPaths = OpenVrPaths.Read();
                if (openVrPaths.runtime.Count > 1)
                {
                    MessageBox.Show("More than one SteamVR installation folder found!" + Environment.NewLine +
                                    "Please join our Discord server for further assistance (link on www.k2vr.tech)");
                    Application.Current.Shutdown(1);
                    return;
                }
                steamVrPath = openVrPaths.runtime[0];
            }
            catch (Exception)
            {
                MessageBox.Show("SteamVR installation folder not found!" + Environment.NewLine +
                                "Are you sure it is installed?" + Environment.NewLine +
                                "If you are, please join our Discord server for further assistance (link on www.k2vr.tech)");
                Application.Current.Shutdown(1);
                return;
            }

            steamVrSettingsPath = Path.Combine(App.state.steamPath, "config", "steamvr.vrsettings");
            vrPathReg           = Path.Combine(steamVrPath, "bin", "win64", "vrpathreg.exe");
            copiedDriverPath    = Path.Combine(App.state.steamVrPath, "drivers", "KinectToVR");
        }
예제 #5
0
        public async void OnSelected()
        {
            await Task.Run(() =>
            {
                Log("K2EX Installer " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " on " + DateTime.Now.ToString());

                Log("Checking if SteamVR is open...", false);
                foreach (Process process in Process.GetProcesses())
                {
                    if (process.ProcessName == "vrmonitor")
                    {
                        Log("Closing vrmonitor...", false);
                        process.CloseMainWindow();
                        Thread.Sleep(5000);
                        if (!process.HasExited)
                        {
                            Log("Force closing...", false);

                            /* When SteamVR is open with no headset detected,
                             * CloseMainWindow will only close the "headset not found" popup
                             * so we kill it, if it's still open */
                            process.Kill();
                            Thread.Sleep(3000);
                        }
                    }
                }

                /* Apparently, SteamVR server can run without the monitor,
                 * so we close that, if it's open as well (monitor will complain if you close server first) */
                foreach (Process process in Process.GetProcesses())
                {
                    if (process.ProcessName == "vrserver")
                    {
                        Log("Closing vrserver...", false);
                        // CloseMainWindow won't work here because it doesn't have a window
                        process.Kill();
                        Thread.Sleep(5000);
                        if (!process.HasExited)
                        {
                            MessageBox.Show(Properties.Resources.install_steamvr_close_failed);
                            Cancel();
                            return;
                        }
                    }
                }
                Log("Done!");

                Log("Checking for legacy installations...", false);
                Uninstaller.UninstallK2VrLegacy(this);

                Log("Checking for other K2EX installations...", false);
                try
                {
                    if (!Uninstaller.UninstallAllK2EX(this))
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    Dispatcher.Invoke(() =>
                    {
                        if (new ExceptionDialog(e, true).ShowDialog().Value != true)
                        {
                            Application.Current.Shutdown(1);
                        }
                    });
                }
                Log("Done!");

                Log("Checking install directory...", false);
                bool dirExists = Directory.Exists(App.state.GetFullInstallationPath());
                Log("Done!");
                Log("Creating install directory...", false);
                if (!dirExists)
                {
                    Directory.CreateDirectory(App.state.GetFullInstallationPath());
                }
                Log("Done!");

                Log("Extracting OpenVR driver...", false);
                string zipFileName = Path.Combine(App.downloadDirectory + FileDownloader.files["k2vr"].OutName);
                using (ZipArchive archive = ZipFile.OpenRead(zipFileName))
                {
                    foreach (ZipArchiveEntry entry in archive.Entries)
                    {
                        string newName  = entry.FullName.Substring("K2EX/".Length); // Remove the top level folder
                        string fullPath = Path.GetFullPath(Path.Combine(App.state.GetFullInstallationPath(), newName));
                        if (fullPath.EndsWith(@"\", StringComparison.Ordinal))
                        {
                            Directory.CreateDirectory(fullPath);
                            App.state.installedFolders.Add(fullPath);
                        }
                        else
                        {
                            entry.ExtractToFile(fullPath, true);
                            App.state.installedFiles.Add(fullPath);
                        }
                    }
                }
                Log("Done!");

                Log("Registering application...", false);
                App.state.Write();
                // we need to manually set file attribs before copying.
                File.SetAttributes(Path.Combine(App.state.GetFullInstallationPath(), "k2vr-installer-gui.exe"), FileAttributes.Normal);
                File.Copy(Assembly.GetExecutingAssembly().Location, Path.Combine(App.state.GetFullInstallationPath(), "k2vr-installer-gui.exe"), true);
                Uninstaller.RegisterUninstaller();

                if ((App.state.trackingDevice == InstallerState.TrackingDevice.Xbox360Kinect && !App.state.kinectV1SdkInstalled) ||
                    (App.state.trackingDevice == InstallerState.TrackingDevice.XboxOneKinect && !App.state.kinectV2SdkInstalled))
                {
                    Log("Installing the Kinect SDK...", false);
                    string sdkInstaller         = Path.Combine(App.downloadDirectory, FileDownloader.files[(App.state.trackingDevice == InstallerState.TrackingDevice.Xbox360Kinect) ? "kinect_v1_sdk" : "kinect_v2_sdk"].OutName);
                    Process sdkInstallerProcess = Process.Start(sdkInstaller);
                    Thread.Sleep(1000);
                    try
                    {
                        // https://stackoverflow.com/a/3734322/
                        AutomationElement element = AutomationElement.FromHandle(sdkInstallerProcess.MainWindowHandle);
                        if (element != null)
                        {
                            element.SetFocus();
                        }
                    }
                    catch (Exception) { } // Don't want the whole install to fail for something that mundane
                    sdkInstallerProcess.WaitForExit();

                    App.state.UpdateSdkInstalled();

                    if ((App.state.trackingDevice == InstallerState.TrackingDevice.Xbox360Kinect && !App.state.kinectV1SdkInstalled) ||
                        (App.state.trackingDevice == InstallerState.TrackingDevice.XboxOneKinect && !App.state.kinectV2SdkInstalled))
                    {
                        Log("Failed!");
                        MessageBox.Show(Properties.Resources.install_sdk_failed);
                        Cancel();
                        return;
                    }
                    Log("Done!");
                }
                else
                {
                    Log("Kinect SDK is already installed.");
                }

                Log("Installing Visual C++ Redistributable...", false);
                string vcRedistPath = Path.Combine(App.downloadDirectory, FileDownloader.files["vc_redist2019"].OutName);
                Process.Start(vcRedistPath, "/quiet /norestart").WaitForExit();
                Log("Done!");

                Log("Registering OpenVR driver...", false);
                string driverPath = Path.Combine(App.state.GetFullInstallationPath(), "KinectToVR");
                Process.Start(App.state.vrPathReg, "adddriver \"" + driverPath + "\"").WaitForExit();
                Log("Checking...", false);
                var openVrPaths = OpenVrPaths.Read();
                if (!openVrPaths.external_drivers.Contains(driverPath))
                {
                    Log("Copying...", false);
                    CopyFilesRecursively(new DirectoryInfo(driverPath), new DirectoryInfo(App.state.copiedDriverPath));
                }
                Log("Done!");

                string kinectProcessName = "KinectV" + (App.state.trackingDevice == InstallerState.TrackingDevice.XboxOneKinect ? "2" : "1") + "Process";

                Log("Registering OpenVR overlay...", false);

                var appConfig       = AppConfig.Read();
                string manifestPath = Path.Combine(App.state.GetFullInstallationPath(), kinectProcessName + ".vrmanifest");
                if (!appConfig.manifest_paths.Contains(manifestPath))
                {
                    appConfig.manifest_paths.Add(manifestPath);
                    appConfig.Write();
                    Log("Done!");
                }
                else
                {
                    Log("Already done!");
                }

                Log("Disabling SteamVR Home, enabling advanced settings...", false);
                var steamVrSettings = JsonConvert.DeserializeObject <dynamic>(File.ReadAllText(App.state.steamVrSettingsPath));
                try
                {
                    steamVrSettings["steamvr"]["enableHomeApp"]        = false;
                    steamVrSettings["steamvr"]["showAdvancedSettings"] = true;
                    JsonFile.Write(App.state.steamVrSettingsPath, steamVrSettings, 3, ' ');
                    Log("Done!");
                }
                catch (Exception)
                {
                    Log("Failed (uncritical)!");
                }
                Log("Registering tracker roles...", false);
                try
                {
                    if (steamVrSettings["trackers"] == null)
                    {
                        steamVrSettings["trackers"] = new JObject();
                    }
                    steamVrSettings["trackers"]["/devices/htc/vive_trackerLHR-CB11ABEC"] = "TrackerRole_Waist";
                    steamVrSettings["trackers"]["/devices/htc/vive_trackerLHR-CB1441A7"] = "TrackerRole_RightFoot";
                    steamVrSettings["trackers"]["/devices/htc/vive_trackerLHR-CB9AD1T2"] = "TrackerRole_LeftFoot";
                    JsonFile.Write(App.state.steamVrSettingsPath, steamVrSettings, 3, ' ');
                    Log("Done!");
                }
                catch (Exception)
                {
                    Log("Failed (uncritical)!");
                }
                Log("Enabling driver in SteamVR...", false);
                try
                {
                    if (steamVrSettings["driver_kinecttovr"] == null)
                    {
                        steamVrSettings["driver_kinecttovr"] = new JObject();
                    }
                    steamVrSettings["driver_kinecttovr"]["enable"] = true;
                    steamVrSettings["driver_kinecttovr"]["blocked_by_safe_mode"] = false;
                    JsonFile.Write(App.state.steamVrSettingsPath, steamVrSettings, 3, ' ');
                    Log("Done!");
                }
                catch (Exception)
                {
                    Log("Failed (uncritical)!");
                }

                Log("Creating start menu entry...", false);
                if (!Directory.Exists(App.startMenuFolder))
                {
                    Directory.CreateDirectory(App.startMenuFolder);
                }
                // https://stackoverflow.com/a/4909475/
                var shell = new IWshRuntimeLibrary.WshShell();
                string shortcutAddress    = Path.Combine(App.startMenuFolder, "KinectToVR.lnk");
                var shortcut              = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutAddress);
                shortcut.Description      = "Launch KinectToVR";
                shortcut.TargetPath       = Path.Combine(App.state.GetFullInstallationPath(), kinectProcessName + ".exe");
                shortcut.IconLocation     = Path.Combine(App.state.GetFullInstallationPath(), "k2vr.ico");
                shortcut.WorkingDirectory = Path.Combine(App.state.GetFullInstallationPath());
                shortcut.Save();
                Log("Refreshing...", false);
                foreach (Process process in Process.GetProcesses())
                {
                    if (process.ProcessName == "StartMenuExperienceHost")
                    {
                        process.Kill();
                        Thread.Sleep(500);
                    }
                }
                Log("Done!");

                Log("Installation complete!");
                Log("The installation log can be found in \"" + App.downloadDirectory + "\"", false);
                Button_Complete_Install.Dispatcher.Invoke(() =>
                {
                    Button_Complete_Install.IsEnabled = true;
                });
            });
        }
예제 #6
0
        public async void OnSelected()
        {
            Logger.LogEvent += (LogEventArgs e) =>
            {
                if (!e.isUserRelevant)
                {
                    return;
                }
                TextBlock_installLog.Dispatcher.Invoke(() =>
                {
                    TextBlock_installLog.Text += e.text;
                });
            };
            await Task.Run(() =>
            {
                Logger.Log("K2EX Installer " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " on " + DateTime.Now.ToString());

                if (!Utils.EnsureSteamVrClosed())
                {
                    Cancel();
                    return;
                }
                ;

                Logger.Log("Checking for legacy installations...", false);
                Uninstaller.UninstallK2VrLegacy();

                Logger.Log("Checking for other K2EX installations...", false);
                try
                {
                    if (!Uninstaller.UninstallAllK2EX(this))
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    Dispatcher.Invoke(() =>
                    {
                        if (new ExceptionDialog(e, true).ShowDialog().Value != true)
                        {
                            Application.Current.Shutdown(1);
                        }
                    });
                }
                Logger.Log("Done!");

                Logger.Log("Checking install directory...", false);
                bool dirExists = Directory.Exists(App.state.GetFullInstallationPath());
                Logger.Log("Done!");
                Logger.Log("Creating install directory...", false);
                if (!dirExists)
                {
                    Directory.CreateDirectory(App.state.GetFullInstallationPath());
                }
                Logger.Log("Done!");

                Logger.Log("Extracting OpenVR driver...", false);
                string zipFileName = Path.Combine(App.downloadDirectory + FileDownloader.files["k2vr"].OutName);
                using (ZipArchive archive = ZipFile.OpenRead(zipFileName))
                {
                    foreach (ZipArchiveEntry entry in archive.Entries)
                    {
                        string newName  = entry.FullName.Substring("K2EX/".Length); // Remove the top level folder
                        string fullPath = Path.GetFullPath(Path.Combine(App.state.GetFullInstallationPath(), newName));
                        if (fullPath.EndsWith(@"\", StringComparison.Ordinal))
                        {
                            Directory.CreateDirectory(fullPath);
                            App.state.installedFolders.Add(fullPath);
                        }
                        else
                        {
                            entry.ExtractToFile(fullPath, true);
                            App.state.installedFiles.Add(fullPath);
                        }
                    }
                }
                Logger.Log("Done!");

                Logger.Log("Registering application...", false);
                App.state.Write();
                // we need to manually set file attribs before copying.
                try
                {
                    File.SetAttributes(Path.Combine(App.state.GetFullInstallationPath(), "k2vr-installer-gui.exe"), FileAttributes.Normal);
                }
                catch (Exception)
                {
                }
                File.Copy(Assembly.GetExecutingAssembly().Location, Path.Combine(App.state.GetFullInstallationPath(), "k2vr-installer-gui.exe"), true);
                Uninstaller.RegisterUninstaller();

                if ((App.state.trackingDevice == InstallerState.TrackingDevice.Xbox360Kinect && !App.state.kinectV1SdkInstalled) ||
                    (App.state.trackingDevice == InstallerState.TrackingDevice.XboxOneKinect && !App.state.kinectV2SdkInstalled))
                {
                    Logger.Log("Installing the Kinect SDK...", false);
                    string sdkInstaller         = Path.Combine(App.downloadDirectory, FileDownloader.files[(App.state.trackingDevice == InstallerState.TrackingDevice.Xbox360Kinect) ? "kinect_v1_sdk" : "kinect_v2_sdk"].OutName);
                    Process sdkInstallerProcess = Process.Start(sdkInstaller);
                    Thread.Sleep(1000);
                    try
                    {
                        // https://stackoverflow.com/a/3734322/
                        AutomationElement element = AutomationElement.FromHandle(sdkInstallerProcess.MainWindowHandle);
                        if (element != null)
                        {
                            element.SetFocus();
                        }
                    }
                    catch (Exception) { } // Don't want the whole install to fail for something that mundane
                    sdkInstallerProcess.WaitForExit();

                    App.state.UpdateSdkInstalled();

                    if ((App.state.trackingDevice == InstallerState.TrackingDevice.Xbox360Kinect && !App.state.kinectV1SdkInstalled) ||
                        (App.state.trackingDevice == InstallerState.TrackingDevice.XboxOneKinect && !App.state.kinectV2SdkInstalled))
                    {
                        Logger.Log("Failed!");
                        MessageBox.Show(Properties.Resources.install_sdk_failed);
                        Cancel();
                        return;
                    }
                    Logger.Log("Done!");
                }
                else
                {
                    Logger.Log("Kinect SDK is already installed.");
                }

                Logger.Log("Installing Visual C++ Redistributable...", false);
                string vcRedistPath = Path.Combine(App.downloadDirectory, FileDownloader.files["vc_redist2019"].OutName);
                try
                {
                    Process.Start(vcRedistPath, "/quiet /norestart").WaitForExit();
                    Logger.Log("Done!");
                }
                catch (Exception)
                {
                    MessageBox.Show("The Visual C++ Redistributable could not be installed, if you run into problems launching KinectToVR, please join our Discord for further assistance (Link on k2vr.tech).");
                    Logger.Log("Failed!");
                }

                Logger.Log("Registering OpenVR driver...", false);
                string driverPath = Path.Combine(App.state.GetFullInstallationPath(), "KinectToVR");
                // Process.Start(App.state.vrPathReg, "adddriver \"" + driverPath + "\"").WaitForExit();
                var openVrPaths = OpenVrPaths.Read();
                try
                {
                    openVrPaths.external_drivers.Add(driverPath);
                    openVrPaths.Write();
                    Logger.Log("Done!");
                }
                catch (Exception)
                {
                    Logger.Log("Couldn't add to VRPaths...");
                }
                Logger.Log("Checking...", false);
                var openVrPathsCheck = OpenVrPaths.Read();
                if (!openVrPathsCheck.external_drivers.Contains(driverPath))
                {
                    MessageBox.Show("Driver could not be registered, make sure SteamVR is closed!" + Environment.NewLine + "Restart this installer to try again." + Environment.NewLine + "Please join our Discord for further assistance (Link on k2vr.tech).");
                    Cancel();
                }
                Logger.Log("Done!");

                string kinectProcessName = "KinectV" + (App.state.trackingDevice == InstallerState.TrackingDevice.XboxOneKinect ? "2" : "1") + "Process";
                if (App.state.trackingDevice == InstallerState.TrackingDevice.PlayStationMove)
                {
                    kinectProcessName = "psmsprocess";
                }

                Logger.Log("Registering OpenVR overlay...", false);

                var appConfig       = AppConfig.Read();
                string manifestPath = Path.Combine(App.state.GetFullInstallationPath(), kinectProcessName + ".vrmanifest");
                if (!appConfig.manifest_paths.Contains(manifestPath))
                {
                    appConfig.manifest_paths.Add(manifestPath);
                    appConfig.Write();
                    Logger.Log("Done!");
                }
                else
                {
                    Logger.Log("Already done!");
                }

                Logger.Log("Disabling SteamVR Home, enabling advanced settings...", false);
                var steamVrSettings = JsonConvert.DeserializeObject <dynamic>(File.ReadAllText(App.state.steamVrSettingsPath));
                try
                {
                    steamVrSettings["steamvr"]["enableHomeApp"]        = false;
                    steamVrSettings["steamvr"]["showAdvancedSettings"] = true;
                    JsonFile.Write(App.state.steamVrSettingsPath, steamVrSettings, 3, ' ');
                    Logger.Log("Done!");
                }
                catch (Exception)
                {
                    Logger.Log("Failed (uncritical)!");
                }
                Logger.Log("Registering tracker roles...", false);
                try
                {
                    if (steamVrSettings["trackers"] == null)
                    {
                        steamVrSettings["trackers"] = new JObject();
                    }
                    steamVrSettings["trackers"]["/devices/htc/vive_trackerLHR-CB11ABEC"] = "TrackerRole_Waist";
                    steamVrSettings["trackers"]["/devices/htc/vive_trackerLHR-CB1441A7"] = "TrackerRole_RightFoot";
                    steamVrSettings["trackers"]["/devices/htc/vive_trackerLHR-CB9AD1T2"] = "TrackerRole_LeftFoot";
                    JsonFile.Write(App.state.steamVrSettingsPath, steamVrSettings, 3, ' ');
                    Logger.Log("Done!");
                }
                catch (Exception)
                {
                    Logger.Log("Failed (uncritical)!");
                }
                Logger.Log("Enabling driver in SteamVR...", false);
                try
                {
                    if (steamVrSettings["driver_kinecttovr"] == null)
                    {
                        steamVrSettings["driver_kinecttovr"] = new JObject();
                    }
                    steamVrSettings["driver_kinecttovr"]["enable"] = true;
                    steamVrSettings["driver_kinecttovr"]["blocked_by_safe_mode"] = false;
                    JsonFile.Write(App.state.steamVrSettingsPath, steamVrSettings, 3, ' ');
                    Logger.Log("Done!");
                }
                catch (Exception)
                {
                    Logger.Log("Failed (uncritical)!");
                }

                Logger.Log("Creating start menu entry...", false);
                if (!Directory.Exists(App.startMenuFolder))
                {
                    Directory.CreateDirectory(App.startMenuFolder);
                }
                // https://stackoverflow.com/a/4909475/
                var shell = new IWshRuntimeLibrary.WshShell();
                string shortcutAddress    = Path.Combine(App.startMenuFolder, "KinectToVR.lnk");
                var shortcut              = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutAddress);
                shortcut.Description      = "Launch KinectToVR";
                shortcut.TargetPath       = Path.Combine(App.state.GetFullInstallationPath(), kinectProcessName + ".exe");
                shortcut.IconLocation     = Path.Combine(App.state.GetFullInstallationPath(), "k2vr.ico");
                shortcut.WorkingDirectory = Path.Combine(App.state.GetFullInstallationPath());
                shortcut.Save();
                Logger.Log("Refreshing...", false);
                foreach (Process process in Process.GetProcesses())
                {
                    if (process.ProcessName == "StartMenuExperienceHost")
                    {
                        process.Kill();
                        Thread.Sleep(500);
                    }
                }
                Logger.Log("Done!");

                Logger.Log("Installation complete!");
                Logger.Log("The installation log can be found in \"" + App.downloadDirectory + "\"", false);
                Button_Complete_Install.Dispatcher.Invoke(() =>
                {
                    Button_Complete_Install.IsEnabled = true;
                });
            });
        }