BeatSaber-version-changer/controller/helper/getNormalBeatSaberFolder.cs

56 lines
1.6 KiB
C#
Raw Permalink Normal View History

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";
2022-05-15 01:04:38 +02:00
String basicBeatSaberPath = "";
2022-05-15 03:02:51 +02:00
if (File.Exists(f))
{
dynamic steam = VdfConvert.Deserialize(File.ReadAllText(f));
dynamic libs = steam.Value;
2022-05-15 01:04:38 +02:00
bool found = false;
foreach (dynamic lib in libs)
{
2022-05-15 01:04:38 +02:00
if (found)
{
break;
}
Console.Write(lib);
foreach(dynamic opt in lib)
{
Console.Write(opt);
}
2022-05-15 01:04:38 +02:00
String path = lib.Value[0].Value.Value;
dynamic games = lib.Value.apps;
foreach (dynamic game in games)
{
Console.Write(game);
2022-05-15 01:04:38 +02:00
if (game.Key == "620980")
{
2022-05-15 03:02:51 +02:00
basicBeatSaberPath = $"{path}\\steamapps\\common\\Beat Saber";
2022-05-15 01:04:38 +02:00
found = true;
break;
}
}
}
}
2022-05-15 01:04:38 +02:00
return basicBeatSaberPath;
}
}
}