bugfixes and Doc

dev
Theenoro 2022-05-15 03:02:51 +02:00
parent aa2e6cbc60
commit 764dcf50a5
22 changed files with 259 additions and 65 deletions

2
.gitattributes vendored 100644
View File

@ -0,0 +1,2 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text

View File

@ -7,6 +7,8 @@
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86</Platforms>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeatSaber-Versions", "BeatSaber-Versions.csproj", "{92403BEE-848E-4C1D-9629-AE45CFE516C6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeatSaber-Versions", "BeatSaber-Versions.csproj", "{92403BEE-848E-4C1D-9629-AE45CFE516C6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D699286A-E227-419D-B679-C06476A92A01}"
ProjectSection(SolutionItems) = preProject
@ -13,13 +13,19 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Debug|x86.ActiveCfg = Debug|x86
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Debug|x86.Build.0 = Debug|x86
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Release|Any CPU.Build.0 = Release|Any CPU
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Release|x86.ActiveCfg = Release|Any CPU
{92403BEE-848E-4C1D-9629-AE45CFE516C6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,5 +1,9 @@
# BeatSaber-version-changer
Setup [Link](./doc/setup.md)
Releases [Link](https://git.dev-c.at/Theenoro/BeatSaber-version-changer/releases)
## Base Config
The config file is the `config.yaml`. You can open it with any editor you want, I recommend `Visual Studio Code` or `Notepad++`.

81
app.manifest 100644
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC-Manifestoptionen
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
Knoten "requestedExecutionLevel" wie folgt.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
für die Anwendung erforderlich ist.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel, eine Aktivierung
ist nicht erforderlich. Für Windows Forms-Anwendungen für .NET Framework 4.6, die diese Einstellung aktivieren, muss
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der Datei "app.config" auf TRUE festgelegt werden.
Hierdurch können für die Anwendung lange Pfade verwendet werden. Weitere Informationen finden Sie unter https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation.-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@ -14,7 +14,7 @@ namespace BeatSaber_Versions.controller.helper
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 libs = steam.Value;
@ -38,7 +38,7 @@ namespace BeatSaber_Versions.controller.helper
Console.Write(game);
if (game.Key == "620980")
{
basicBeatSaberPath = $"{path}\\Beat Saber";
basicBeatSaberPath = $"{path}\\steamapps\\common\\Beat Saber";
found = true;
break;
}

BIN
doc/img/contains.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/firstView.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/renameBeatSaberFolder.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/running_as_nonAdmin.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/setBeatSaberFolders1.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/setBeatSaberFolders2.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/setupYourBeatSaberVersion.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/setupYourBeatSaberVersion2.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/setupYourBeatSaberVersion3.png (Stored with Git LFS) 100644

Binary file not shown.

BIN
doc/img/setupYourBeatSaberVersion4.png (Stored with Git LFS) 100644

Binary file not shown.

39
doc/setup.md 100644
View File

@ -0,0 +1,39 @@
[Readme.md](../README.md)
# Setup
## Contains
![./img/contains.png](./img/contains.png)
## Run for the first time
If you running the `BeatSaber-Versions.exe` you have to run it with admin rights, cause the normal user is unable to create symbolic links.
>This is the window if you doesn't run it as admin, you can close the window or press `reopen as Admin`. This will restart the programm as Admin.
>![./img/running_as_nonAdmin.png](./img/running_as_nonAdmin.png)
The first thing you will see is, that there is already a `1.21.0` in the list. This is the default one in the freshly generated configuration file.
![./img/firstView.png](./img/firstView.png)
To setup the normal BeatSaber folders you hit the `Set BeatSaber Folder` button at the top left. Then a new window will open. There you can set the normal BS folder or let the programm detect itsef where BS is installed. (This is only working if Steam is installed on C:\\ drive)
![./img/setBeatSaberFolders1.png](./img/setBeatSaberFolders1.png)
I also recommend to relocate your custom songs folder to use the songs in every version of BS. This cleans up some space that you don't have your song lib multiple times on your drive.
![](img/setBeatSaberFolders2.png)
## Adding your current version of BeatSaber to it
Currently is the newest version of BeatSaber the `1.22.0` therfore rename the BeatSaber folder to `Beat Saber-1.22.0` on your harddrive. After that edit the values `Name`, `Version` and `Folder`. With the `Set Folder` button you can set the Folder over a dialog window.
![](img/setupYourBeatSaberVersion.png)
![](img/setupYourBeatSaberVersion2.png)
After the editing hit "Save" and all will be written in your `config.yaml` file.
![](img/setupYourBeatSaberVersion3.png)
Then if you wanna select your BeatSaber version hit `Play Selected` then the programm will create a symbolic link in your `steamapps` folder with the name `Beat Saber` and will link it to your version folder. If you don't have a custom songs folder or removed it from your `Beat Saber_Data` folder, it will ask if you wanna create a symbolic link to your secified song folder under `Set BeatSaber Folder` which you may have previusly set.
![](img/setupYourBeatSaberVersion4.png)
After all that you are good to go, play BeatSaber or change versions if you have another on your drive.
## Preventing your BeatSaber version from updates
To completly prevent your custom BeatSaber from updates, I recommend to create one version which is normally set as symbolic link, this is the version steam will update. The second one is your custom one, only set this version if you wanna play BeatSaber.

View File

@ -134,7 +134,7 @@
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "BeatSaberFolders_Modal";
this.Text = "BeatSaberFolders_Modal";
this.Text = "BeatSaber Folders";
this.ResumeLayout(false);
this.PerformLayout();

22
ui/NoAdmin.Designer.cs generated
View File

@ -31,16 +31,18 @@
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(426, 24);
this.button1.Location = new System.Drawing.Point(201, 72);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 30);
this.button1.Size = new System.Drawing.Size(196, 23);
this.button1.TabIndex = 0;
this.button1.Text = "OK";
this.button1.Text = "reopen as Admin";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
@ -63,11 +65,22 @@
"caused that the normal user can\'t create symbolic links.";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 72);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(183, 23);
this.button2.TabIndex = 3;
this.button2.Text = "Close";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// NoAdmin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(513, 71);
this.ClientSize = new System.Drawing.Size(403, 107);
this.Controls.Add(this.button2);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
@ -87,5 +100,6 @@
private Button button1;
private Label label1;
private Label label2;
private Button button2;
}
}

View File

@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -16,5 +18,32 @@ namespace BeatSaber_Versions.ui
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StartAsAdmin($@"{AppDomain.CurrentDomain.BaseDirectory}BeatSaber-Versions.exe");
}
public static void StartAsAdmin(string fileName)
{
var proc = new Process
{
StartInfo =
{
FileName = fileName,
UseShellExecute = true,
Verb = "runas"
}
};
proc.Start();
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

View File

@ -114,7 +114,7 @@
this.versionListBox.ItemHeight = 15;
this.versionListBox.Location = new System.Drawing.Point(2, 66);
this.versionListBox.Name = "versionListBox";
this.versionListBox.Size = new System.Drawing.Size(164, 454);
this.versionListBox.Size = new System.Drawing.Size(164, 184);
this.versionListBox.TabIndex = 2;
this.versionListBox.SelectedIndexChanged += new System.EventHandler(this.versionListBox_SelectedIndexChanged);
//
@ -130,10 +130,10 @@
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(167, 66);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(838, 454);
this.groupBox1.Size = new System.Drawing.Size(838, 184);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
this.groupBox1.Text = "Version";
//
// saveSetting
//
@ -211,7 +211,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1008, 525);
this.ClientSize = new System.Drawing.Size(1008, 261);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.versionListBox);
this.Controls.Add(this.panel1);
@ -220,7 +220,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "VersionChanger";
this.Text = "Form1";
this.Text = "Version Changer";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.panel1.ResumeLayout(false);

View File

@ -15,7 +15,7 @@ namespace BeatSaber_Versions
string lpTargetFileName, int dwFlags);
private string Path = $@"{AppDomain.CurrentDomain.BaseDirectory}config.yaml";
private VersionConfigDict Versionen = null;
private VersionConfigDict Versionen = Storage.Config;
private String beatsaberfolder = @"A:\BS";
public VersionChanger()
@ -23,16 +23,9 @@ namespace BeatSaber_Versions
InitializeComponent();
var deserializer = new DeserializerBuilder()
.WithNamingConvention(UnderscoredNamingConvention.Instance) // see height_in_inches in sample yml
.Build();
string yml = File.ReadAllText(Path);
var p = deserializer.Deserialize<VersionConfigDict>(yml);
Versionen = p;
beatsaberfolder = p.beatsaberfolder;
foreach (var key in (p.versions).Keys)
VersionConfigDict Versionen = Storage.Config;
beatsaberfolder = Versionen.beatsaberfolder;
foreach (var key in (Versionen.versions).Keys)
{
versionListBox.Items.Add(key);
}
@ -75,15 +68,15 @@ namespace BeatSaber_Versions
private void playSelected_Click(object sender, EventArgs e)
{
String Target = folderPath.Text;
if (Directory.Exists(beatsaberfolder))
if (Directory.Exists(Storage.Config.beatsaberfolder))
{
if (staticHelpers.IsSymbolic(beatsaberfolder))
if (staticHelpers.IsSymbolic(Storage.Config.beatsaberfolder))
{
Directory.Delete(beatsaberfolder);
Directory.Delete(Storage.Config.beatsaberfolder);
if (Directory.Exists(Target))
{
CreateSymbolicLink(beatsaberfolder, Target, 0x1);
CreateSymbolicLink(Storage.Config.beatsaberfolder, Target, 0x1);
setSongFolder();
}
}
@ -92,47 +85,49 @@ namespace BeatSaber_Versions
{
if (Directory.Exists(Target))
{
CreateSymbolicLink(beatsaberfolder, Target, 0x1);
CreateSymbolicLink(Storage.Config.beatsaberfolder, Target, 0x1);
setSongFolder();
}
}
}
private void setSongFolder()
{
String songFolderConf = Versionen.beatsabersongs;
String songFolder = beatsaberfolder+ "\\Beat Saber_Data\\CustomLevels";
if (Directory.Exists(songFolder))
{
if (staticHelpers.IsSymbolic(songFolder))
String songFolderConf = Storage.Config.beatsabersongs;
if (songFolderConf != "") {
String songFolder = Storage.Config.beatsaberfolder + "\\Beat Saber_Data\\CustomLevels";
if (Directory.Exists(songFolder))
{
MessageBox.Show("Is a symbolic link <3");
if (staticHelpers.IsSymbolic(songFolder))
{
MessageBox.Show("Is a symbolic link <3");
}
else
{
MessageBox.Show("Is a normal folder.");
}
}
else
{
MessageBox.Show("Is a normal folder.");
DialogResult dialogResult = MessageBox.Show("Create symbolic link, may deduplicate your song library", "Settings", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
CreateSymbolicLink(songFolder, songFolderConf, 0x1);
MessageBox.Show("Created symbolic link to song folder.");
}
else if (dialogResult == DialogResult.No)
{
//do something else
}
}
}
else
{
DialogResult dialogResult = MessageBox.Show("Create symbolic link, may deduplicate your song library", "Settings", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
CreateSymbolicLink(songFolder, songFolderConf, 0x1);
MessageBox.Show("Created symbolic link to song folder.");
}
else if (dialogResult == DialogResult.No)
{
//do something else
}
}
}
private void saveSetting_Click(object sender, EventArgs e)
{
Versionen = Storage.Config;
VersionConfig tmp = new VersionConfig();
tmp.path = folderPath.Text;
tmp.name = versionName.Text;
@ -151,13 +146,8 @@ namespace BeatSaber_Versions
{
versionListBox.Items.Add(key);
}
var serializer = new SerializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
var yaml = serializer.Serialize(Versionen);
File.WriteAllTextAsync(Path,yaml);
System.Console.WriteLine(yaml);
Storage.Config = Versionen;
Storage.CC.writeConfig();
}
private void addVersion(object sender,EventArgs e){
folderPath.Text = "";
@ -167,6 +157,7 @@ namespace BeatSaber_Versions
}
private void deleteVersion(object sender, EventArgs e){
var Item = versionVersion.Text;
Versionen = Storage.Config;
if(Item != null)
{
Versionen.versions.Remove((String)Item);
@ -177,12 +168,8 @@ namespace BeatSaber_Versions
versionListBox.Items.Add(key);
}
var serializer = new SerializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
var yaml = serializer.Serialize(Versionen);
File.WriteAllTextAsync(Path,yaml);
System.Console.WriteLine(yaml);
Storage.Config = Versionen;
Storage.CC.writeConfig();
}