Steam Lib search for beat saber folder
This commit is contained in:
parent
a2f01c6100
commit
aa2e6cbc60
@ -17,7 +17,7 @@ namespace BeatSaber_Versions
|
|||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
if (staticHelpers.IsElevated)
|
if (staticHelpers.IsElevated)
|
||||||
{
|
{
|
||||||
getNormalBeatSaberFolder.getBSFolder();
|
|
||||||
Storage.CC = new Config();
|
Storage.CC = new Config();
|
||||||
Application.Run(new VersionChanger());
|
Application.Run(new VersionChanger());
|
||||||
}
|
}
|
||||||
|
@ -12,31 +12,44 @@ namespace BeatSaber_Versions.controller.helper
|
|||||||
public static String getBSFolder()
|
public static String getBSFolder()
|
||||||
{
|
{
|
||||||
String f = @"C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf";
|
String f = @"C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf";
|
||||||
|
String basicBeatSaberPath = "";
|
||||||
|
|
||||||
if (File.Exists(f))
|
if (File.Exists(f))
|
||||||
{
|
{
|
||||||
dynamic steam = VdfConvert.Deserialize(File.ReadAllText(f));
|
dynamic steam = VdfConvert.Deserialize(File.ReadAllText(f));
|
||||||
dynamic libs = steam.Value;
|
dynamic libs = steam.Value;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
foreach (dynamic lib in libs)
|
foreach (dynamic lib in libs)
|
||||||
{
|
{
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
Console.Write(lib);
|
Console.Write(lib);
|
||||||
foreach(dynamic opt in lib)
|
foreach(dynamic opt in lib)
|
||||||
{
|
{
|
||||||
Console.Write(opt);
|
Console.Write(opt);
|
||||||
}
|
}
|
||||||
|
String path = lib.Value[0].Value.Value;
|
||||||
dynamic games = lib.Value[lib.Value.Count-1];
|
dynamic games = lib.Value.apps;
|
||||||
foreach(dynamic game in games)
|
foreach (dynamic game in games)
|
||||||
{
|
{
|
||||||
Console.Write(game);
|
Console.Write(game);
|
||||||
|
if (game.Key == "620980")
|
||||||
|
{
|
||||||
|
basicBeatSaberPath = $"{path}\\Beat Saber";
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return basicBeatSaberPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
ui/BeatSaberFolders_Modal.Designer.cs
generated
13
ui/BeatSaberFolders_Modal.Designer.cs
generated
@ -38,6 +38,7 @@
|
|||||||
this.saveModal = new System.Windows.Forms.Button();
|
this.saveModal = new System.Windows.Forms.Button();
|
||||||
this.setNormalBeatSaberFolder = new System.Windows.Forms.FolderBrowserDialog();
|
this.setNormalBeatSaberFolder = new System.Windows.Forms.FolderBrowserDialog();
|
||||||
this.setCustomSongsFolder = new System.Windows.Forms.FolderBrowserDialog();
|
this.setCustomSongsFolder = new System.Windows.Forms.FolderBrowserDialog();
|
||||||
|
this.chkBSBasicFolderViaSteam = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// beatSaberFolder
|
// beatSaberFolder
|
||||||
@ -105,12 +106,23 @@
|
|||||||
this.saveModal.UseVisualStyleBackColor = true;
|
this.saveModal.UseVisualStyleBackColor = true;
|
||||||
this.saveModal.Click += new System.EventHandler(this.saveModal_Click);
|
this.saveModal.Click += new System.EventHandler(this.saveModal_Click);
|
||||||
//
|
//
|
||||||
|
// chkBSBasicFolderViaSteam
|
||||||
|
//
|
||||||
|
this.chkBSBasicFolderViaSteam.Location = new System.Drawing.Point(332, 82);
|
||||||
|
this.chkBSBasicFolderViaSteam.Name = "chkBSBasicFolderViaSteam";
|
||||||
|
this.chkBSBasicFolderViaSteam.Size = new System.Drawing.Size(164, 23);
|
||||||
|
this.chkBSBasicFolderViaSteam.TabIndex = 7;
|
||||||
|
this.chkBSBasicFolderViaSteam.Text = "Check Steam for BS Folder";
|
||||||
|
this.chkBSBasicFolderViaSteam.UseVisualStyleBackColor = true;
|
||||||
|
this.chkBSBasicFolderViaSteam.Click += new System.EventHandler(this.chkBSBasicFolderViaSteam_Click);
|
||||||
|
//
|
||||||
// BeatSaberFolders_Modal
|
// BeatSaberFolders_Modal
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||||
this.ClientSize = new System.Drawing.Size(584, 115);
|
this.ClientSize = new System.Drawing.Size(584, 115);
|
||||||
|
this.Controls.Add(this.chkBSBasicFolderViaSteam);
|
||||||
this.Controls.Add(this.saveModal);
|
this.Controls.Add(this.saveModal);
|
||||||
this.Controls.Add(this.setBSSongsFolder);
|
this.Controls.Add(this.setBSSongsFolder);
|
||||||
this.Controls.Add(this.setBSFolder);
|
this.Controls.Add(this.setBSFolder);
|
||||||
@ -139,5 +151,6 @@
|
|||||||
private Button saveModal;
|
private Button saveModal;
|
||||||
private FolderBrowserDialog setNormalBeatSaberFolder;
|
private FolderBrowserDialog setNormalBeatSaberFolder;
|
||||||
private FolderBrowserDialog setCustomSongsFolder;
|
private FolderBrowserDialog setCustomSongsFolder;
|
||||||
|
private Button chkBSBasicFolderViaSteam;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using BeatSaber_Versions.controller;
|
using BeatSaber_Versions.controller;
|
||||||
|
using BeatSaber_Versions.controller.helper;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -68,5 +69,10 @@ namespace BeatSaber_Versions
|
|||||||
|
|
||||||
Storage.CC.writeConfig();
|
Storage.CC.writeConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void chkBSBasicFolderViaSteam_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
beatSaberFolder.Text = getNormalBeatSaberFolder.getBSFolder();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user