diff --git a/LostArkLogger/Program.cs b/LostArkLogger/Program.cs index 3a72e677..378795c3 100644 --- a/LostArkLogger/Program.cs +++ b/LostArkLogger/Program.cs @@ -18,6 +18,7 @@ static void Main(string[] args) Properties.Settings.Default.Providers.Clear(); Bluegrams.Application.PortableSettingsProvider.SettingsFileName = AppDomain.CurrentDomain.FriendlyName + ".ini"; Bluegrams.Application.PortableSettingsProvider.ApplyProvider(Properties.Settings.Default); + if(Properties.Settings.Default.Region == Region.Steam) VersionCompatibility(); if (!AdminRelauncher()) return; if (!IsConsole) Warning(); AttemptFirewallPrompt(); @@ -50,6 +51,12 @@ static void AttemptFirewallPrompt() t.Start(); t.Stop(); } + static void VersionCompatibility() + { + var installedVersion = VersionCheck.GetLostArkVersion(); + if (installedVersion > VersionCheck.SupportedSteamVersion) + MessageBox.Show("DPS Meter is out of date.\nDPS Meter might not work until updated.\nCheck Discord/Github for more info.", "Out of date!", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } static void Warning() { if (Properties.Settings.Default.IgnoreWarning) return; diff --git a/LostArkLogger/Utilities/VersionCheck.cs b/LostArkLogger/Utilities/VersionCheck.cs new file mode 100644 index 00000000..37519fed --- /dev/null +++ b/LostArkLogger/Utilities/VersionCheck.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LostArkLogger +{ + public static class VersionCheck + { + public static Version SupportedSteamVersion = new Version("1.32.55.1800897"); + public static Version GetLostArkVersion() + { + var fileName = @"C:\Program Files (x86)\Steam\steamapps\common\Lost Ark\Binaries\Win64\LOSTARK.exe"; + if (!File.Exists(fileName)) + { + var installLocation = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 1599340")?.GetValue("InstallLocation"); + if (installLocation != null) + { + fileName = Path.Combine(installLocation.ToString(), "Binaries", "Win64", "LOSTARK.exe"); + } + } + return new Version(FileVersionInfo.GetVersionInfo(fileName).ProductVersion.Split(' ')[0]); + } + } +}