diff --git a/DamageCalculator/DamageCalculator/MainWindow.xaml.cs b/DamageCalculator/DamageCalculator/MainWindow.xaml.cs index b0639e8..b7abcb9 100644 --- a/DamageCalculator/DamageCalculator/MainWindow.xaml.cs +++ b/DamageCalculator/DamageCalculator/MainWindow.xaml.cs @@ -99,6 +99,7 @@ namespace Damage_Calculator { MessageBox.Show("Make sure you have installed CS:GO and Steam correctly.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); + return; } bgWorker.DoWork += BgWorker_DoWork; @@ -1460,7 +1461,7 @@ namespace Damage_Calculator this.txtWeaponBaseDamagePerMinute.Text = this.selectedWeapon.FireRate < 0 ? "?" : (this.selectedWeapon.BaseDamage * this.selectedWeapon.FireRate).ToString(CultureInfo.InvariantCulture); this.txtWeaponFireRate.Text = this.selectedWeapon.FireRate.ToString(CultureInfo.InvariantCulture); this.txtWeaponArmorPenetration.Text = this.selectedWeapon.ArmorPenetration.ToString(CultureInfo.InvariantCulture) + " %"; - this.txtWeaponDamageDropoff.Text = Math.Round(1d - this.selectedWeapon.DamageDropoff, 2).ToString(CultureInfo.InvariantCulture) + " %"; + this.txtWeaponDamageDropoff.Text = (Math.Round(1d - this.selectedWeapon.DamageDropoff, 2) * 100).ToString(CultureInfo.InvariantCulture) + " %"; this.txtWeaponMaxRange.Text = this.selectedWeapon.MaxBulletRange.ToString(CultureInfo.InvariantCulture); this.txtWeaponHeadshotModifier.Text = this.selectedWeapon.DamageType != DamageType.Shock ? this.selectedWeapon.HeadshotModifier.ToString(CultureInfo.InvariantCulture) : placeholderText; this.txtWeaponRunningSpeed.Text = this.selectedWeapon.RunningSpeed.ToString(); diff --git a/SteamShared/SteamShared/SteamShared/SteamHelper.cs b/SteamShared/SteamShared/SteamShared/SteamHelper.cs index 5df8783..982c49d 100644 --- a/SteamShared/SteamShared/SteamShared/SteamHelper.cs +++ b/SteamShared/SteamShared/SteamShared/SteamHelper.cs @@ -94,6 +94,33 @@ namespace SteamShared if (this.steamPath == null) return null; + // Usually the config.vdf had "BaseInstallFolder_" entries, + // now it seems that these entries don't exist anymore with reinstalls, and maybe they're not up-to-date anyways? + // Now we try reading the "libraryfolders.vdf", which now also contains the default library location +#if NEWLIBRARYLOCATION + string configFilePath = Path.Combine(this.steamPath, "config", "libraryfolders.vdf"); + if (!File.Exists(configFilePath)) + return null; + + // Fetch all libraries from the config + var configFile = new VDFFile(configFilePath); + IEnumerable? foundSteamLibraries = configFile["libraryfolders"]?.Children.Select(c => c["path"]?.Value)!; + + var allLibraries = new List(); + + if (foundSteamLibraries?.Any() != true) + { + return null; + } + + foreach (string foundLib in foundSteamLibraries!) + { + // All paths in the file are escaped + allLibraries.Add(new SteamLibrary(foundLib.Replace("\\\\", "\\"))); + } + + return allLibraries; +#else string configFilePath = Path.Combine(this.steamPath, "config\\config.vdf"); if (!File.Exists(configFilePath)) return null; @@ -104,12 +131,15 @@ namespace SteamShared // List libraries plus default Steam directory, because that's the default library var allLibraries = new List { new SteamLibrary(this.steamPath) }; - foreach(string addLib in additionalSteamLibraries!) + + foreach (string addLib in additionalSteamLibraries!) { + // All paths in the file are escaped allLibraries.Add(new SteamLibrary(addLib.Replace("\\\\", "\\"))); } return allLibraries; +#endif } public List? GetInstalledGames() diff --git a/SteamShared/SteamShared/SteamShared/SteamShared.csproj b/SteamShared/SteamShared/SteamShared/SteamShared.csproj index 0146f25..7ddbd8c 100644 --- a/SteamShared/SteamShared/SteamShared/SteamShared.csproj +++ b/SteamShared/SteamShared/SteamShared/SteamShared.csproj @@ -7,6 +7,22 @@ True AnyCPU;x64 + + + $(DefineConstants)TRACE;NEWLIBRARYLOCATION + + + + $(DefineConstants)TRACE;NEWLIBRARYLOCATION + + + + $(DefineConstants)TRACE;NEWLIBRARYLOCATION + + + + $(DefineConstants)TRACE;NEWLIBRARYLOCATION +