void UpdateStatus(string title, string message, string description = null) { Title = title; Message.Text = message ?? string.Empty; MessageDescription.Visibility = string.IsNullOrEmpty(description) ? Visibility.Collapsed : Visibility.Visible; MessageDescription.Text = description; AeroGlass.HideSystemMenu(this); }
void UpdateStatusAndFinish(bool success, string message, string description = null) { isFinished = true; SetupButton.IsEnabled = false; // Use button as text box only UpdateStatus(success ? "ReShade Setup was successful!" : "ReShade Setup was not successful!", message, description); AeroGlass.HideSystemMenu(this, false); if (isHeadless) { Environment.Exit(success ? 0 : 1); } }
void InstallationStep2() { ApiGroup.IsEnabled = false; SetupButton.IsEnabled = false; ApiGroup.Visibility = ApiD3D9.Visibility = ApiDXGI.Visibility = ApiOpenGL.Visibility = ApiVulkan.Visibility = Visibility.Visible; ApiVulkanGlobal.Visibility = ApiVulkanGlobalButton.Visibility = Visibility.Collapsed; UpdateStatus("Working on " + targetName + " ...", "Installing ReShade ..."); string targetDir = Path.GetDirectoryName(targetPath); configPath = Path.Combine(targetDir, "ReShade.ini"); if (ApiVulkan.IsChecked != true) { modulePath = null; if (ApiD3D9.IsChecked == true) { modulePath = "d3d9.dll"; } if (ApiDXGI.IsChecked == true) { modulePath = "dxgi.dll"; } if (ApiOpenGL.IsChecked == true) { modulePath = "opengl32.dll"; } if (modulePath == null) { // No API selected, abort immediately return; } modulePath = Path.Combine(targetDir, modulePath); var alternativeConfigPath = Path.ChangeExtension(modulePath, ".ini"); if (File.Exists(alternativeConfigPath)) { configPath = alternativeConfigPath; } if (File.Exists(modulePath) && !isHeadless) { var moduleInfo = FileVersionInfo.GetVersionInfo(modulePath); if (moduleInfo.ProductName == "ReShade") { ApiGroup.Visibility = Visibility.Collapsed; InstallButtons.Visibility = Visibility.Visible; Message.Text = "Existing ReShade installation found. How do you want to proceed?"; // Do not hide exit button when asking about existing installation, so user can abort installation AeroGlass.HideSystemMenu(this, false); } else { UpdateStatusAndFinish(false, Path.GetFileName(modulePath) + " already exists, but does not belong to ReShade.", "Please make sure this is not a system file required by the game."); } return; } } InstallationStep3(); }
void InstallationStep2() { ApiGroup.IsEnabled = false; SetupButton.IsEnabled = false; ApiGroup.Visibility = ApiD3D9.Visibility = ApiDXGI.Visibility = ApiOpenGL.Visibility = ApiVulkan.Visibility = Visibility.Visible; ApiVulkanGlobal.Visibility = ApiVulkanGlobalButton.Visibility = Visibility.Collapsed; UpdateStatus("Working on " + targetName + " ...", "Installing ReShade ..."); var targetDir = Path.GetDirectoryName(targetPath); var executableName = Path.GetFileName(targetPath); if (compatibilityIni != null && compatibilityIni.HasValue(executableName, "InstallTarget")) { targetDir = Path.Combine(targetDir, compatibilityIni.GetString(executableName, "InstallTarget")); } configPath = Path.Combine(targetDir, "ReShade.ini"); if (ApiVulkan.IsChecked != true) { if (ApiD3D9.IsChecked == true) { modulePath = "d3d9.dll"; } else if (ApiDXGI.IsChecked == true) { modulePath = "dxgi.dll"; } else if (ApiOpenGL.IsChecked == true) { modulePath = "opengl32.dll"; } else // No API selected, abort immediately { return; } modulePath = Path.Combine(targetDir, modulePath); var configPathAlt = Path.ChangeExtension(modulePath, ".ini"); if (File.Exists(configPathAlt)) { configPath = configPathAlt; } if (ReShadeExists(modulePath, out bool isReShade) && !isHeadless) { if (isReShade) { ApiGroup.Visibility = Visibility.Collapsed; InstallButtons.Visibility = Visibility.Visible; Message.Text = "Existing ReShade installation found. How do you want to proceed?"; // Do not hide exit button when asking about existing installation, so user can abort installation AeroGlass.HideSystemMenu(this, false); } else { UpdateStatusAndFinish(false, Path.GetFileName(modulePath) + " already exists, but does not belong to ReShade.", "Please make sure this is not a system file required by the game."); } return; } } if (!isHeadless) { if (ApiD3D9.IsChecked != true && ReShadeExists(Path.Combine(targetDir, "d3d9.dll"), out bool isD3D9ReShade) && isD3D9ReShade) { UpdateStatusAndFinish(false, "Existing ReShade installation for Direct3D 9 found.", "Multiple simultaneous ReShade installations are not supported. Please uninstall the existing one first."); return; } if (ApiDXGI.IsChecked != true && ReShadeExists(Path.Combine(targetDir, "dxgi.dll"), out bool isDXGIReShade) && isDXGIReShade) { UpdateStatusAndFinish(false, "Existing ReShade installation for Direct3D 10/11/12 found.", "Multiple simultaneous ReShade installations are not supported. Please uninstall the existing one first."); return; } if (ApiOpenGL.IsChecked != true && ReShadeExists(Path.Combine(targetDir, "opengl32.dll"), out bool isOpenGLReShade) && isOpenGLReShade) { UpdateStatusAndFinish(false, "Existing ReShade installation for OpenGL found.", "Multiple simultaneous ReShade installations are not supported. Please uninstall the existing one first."); return; } } InstallationStep3(); }