private static string[] SteamPaths
=> new string[]
{
Microsoft.Win32.Registry.GetValue(steamRegKey, steamRegValue, null) as string,
};
static string GamePath()
{
// Attempt to get the Steam path.
string? steamPath = null;
foreach (var steam in SteamPaths.Where(p => !string.IsNullOrEmpty(p)))
if (Directory.Exists(steam))
steamPath = steam;
if (steamPath == null)
return null;
// find game folder through library file
string librarypath = Path.Combine(steamPath, "config", "libraryfolders.vdf");
if (File.Exists(librarypath))
{
var stream = File.OpenRead(librarypath);
var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
KVObject data = kv.Deserialize(stream);
int i = 0;
while (i < data.Count())
{
var libraryfolder = data[i.ToString()]["path"];
var librarygames = data[i.ToString()]["apps"];
foreach (var game in (IEnumerable<KVObject>)librarygames)
if (game.Name.Contains(appID))
return libraryfolder.ToString() + "\\steamapps\\common\\Lethal Company";
i++;
}
}