BeatSaber-version-changer/controller/helper/getNormalBeatSaberFolder.cs
2022-05-15 03:02:51 +02:00

56 lines
1.6 KiB
C#

using Gameloop.Vdf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeatSaber_Versions.controller.helper
{
internal class getNormalBeatSaberFolder
{
public static String getBSFolder()
{
String f = @"C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf";
String basicBeatSaberPath = "";
if (File.Exists(f))
{
dynamic steam = VdfConvert.Deserialize(File.ReadAllText(f));
dynamic libs = steam.Value;
bool found = false;
foreach (dynamic lib in libs)
{
if (found)
{
break;
}
Console.Write(lib);
foreach(dynamic opt in lib)
{
Console.Write(opt);
}
String path = lib.Value[0].Value.Value;
dynamic games = lib.Value.apps;
foreach (dynamic game in games)
{
Console.Write(game);
if (game.Key == "620980")
{
basicBeatSaberPath = $"{path}\\steamapps\\common\\Beat Saber";
found = true;
break;
}
}
}
}
return basicBeatSaberPath;
}
}
}