Skip to content

Commit

Permalink
add version check
Browse files Browse the repository at this point in the history
add version check
  • Loading branch information
shalzuth committed Jul 27, 2022
1 parent 42b372e commit 3cf23fd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LostArkLogger/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions LostArkLogger/Utilities/VersionCheck.cs
Original file line number Diff line number Diff line change
@@ -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]);
}
}
}

0 comments on commit 3cf23fd

Please sign in to comment.