From eb188321afb305b2e1f868ee2c4c5ae0dec5e2a7 Mon Sep 17 00:00:00 2001 From: Cinka Date: Sun, 15 Jun 2025 19:14:58 +0300 Subject: [PATCH] - add: VC check --- Nebula.Launcher/Nebula.Launcher.csproj | 1 - Nebula.Launcher/ViewModels/MainViewModel.cs | 31 +++++++++++++++++++++ Nebula.sln.DotSettings.user | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Nebula.Launcher/Nebula.Launcher.csproj b/Nebula.Launcher/Nebula.Launcher.csproj index a491dcc..f6e067d 100644 --- a/Nebula.Launcher/Nebula.Launcher.csproj +++ b/Nebula.Launcher/Nebula.Launcher.csproj @@ -32,7 +32,6 @@ - diff --git a/Nebula.Launcher/ViewModels/MainViewModel.cs b/Nebula.Launcher/ViewModels/MainViewModel.cs index b8ee4f8..ce4f743 100644 --- a/Nebula.Launcher/ViewModels/MainViewModel.cs +++ b/Nebula.Launcher/ViewModels/MainViewModel.cs @@ -73,6 +73,12 @@ public partial class MainViewModel : ViewModelBase PopupMessageService.OnCloseRequired += OnPopupCloseRequired; CheckMigration(); + + if (!VCRuntimeDllChecker.AreVCRuntimeDllsPresent()) + { + OnPopupRequired("VC runtime dlls are not present on this computer. Install VC runtime dlls."); + Helper.OpenBrowser("https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170"); + } } private void CheckMigration() @@ -209,4 +215,29 @@ public partial class MainViewModel : ViewModelBase CurrentPopup = viewModelBase; } +} + +public static class VCRuntimeDllChecker +{ + public static bool AreVCRuntimeDllsPresent() + { + if (!OperatingSystem.IsWindows()) return true; + + string systemDir = Environment.SystemDirectory; + string[] requiredDlls = { + "msvcp140.dll", + "vcruntime140.dll" + }; + + foreach (var dll in requiredDlls) + { + var path = Path.Combine(systemDir, dll); + if (!File.Exists(path)) + { + return false; + } + } + + return true; + } } \ No newline at end of file diff --git a/Nebula.sln.DotSettings.user b/Nebula.sln.DotSettings.user index 2f77d2e..0247ab0 100644 --- a/Nebula.sln.DotSettings.user +++ b/Nebula.sln.DotSettings.user @@ -16,6 +16,8 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded