Update SteamPathsUtil.cs

* fix read steam config
This commit is contained in:
AlexZ 2020-05-29 23:15:31 +03:00
parent 614275b3be
commit 3957f87103

View File

@ -85,15 +85,18 @@
libraryPaths.Add(Path.Combine(steamPath, "steamapps")); libraryPaths.Add(Path.Combine(steamPath, "steamapps"));
dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value; try {
var configLibraryPaths = ((VObject)configObject.Software.Valve.Steam) dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value;
.Children() var valve = configObject.Software.Valve ?? configObject.Software.valve;
.Where(item => item.Key.StartsWith("BaseInstallFolder")) var configLibraryPaths = ((VObject)valve.Steam)
.Select(item => item.Value.ToString()) .Children()
.Select(line => new DirectoryInfo(line).FullName) .Where(item => item.Key.StartsWith("BaseInstallFolder"))
.Select(line => Path.Combine(line, "steamapps")); .Select(item => item.Value.ToString())
.Select(line => new DirectoryInfo(line).FullName)
.Select(line => Path.Combine(line, "steamapps"));
libraryPaths.AddRange(configLibraryPaths); libraryPaths.AddRange(configLibraryPaths);
} catch { }
result.SteamLibraryFolders = libraryPaths.ToArray(); result.SteamLibraryFolders = libraryPaths.ToArray();