2022-05-14 20:43:22 +02:00
|
|
|
|
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-14 20:43:22 +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;
|
2022-05-14 20:43:22 +02:00
|
|
|
|
|
|
|
|
|
foreach (dynamic lib in libs)
|
|
|
|
|
{
|
2022-05-15 01:04:38 +02:00
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-14 20:43:22 +02:00
|
|
|
|
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)
|
2022-05-14 20:43:22 +02:00
|
|
|
|
{
|
|
|
|
|
Console.Write(game);
|
2022-05-15 01:04:38 +02:00
|
|
|
|
if (game.Key == "620980")
|
|
|
|
|
{
|
|
|
|
|
basicBeatSaberPath = $"{path}\\Beat Saber";
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-14 20:43:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-15 01:04:38 +02:00
|
|
|
|
return basicBeatSaberPath;
|
2022-05-14 20:43:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|