diff --git a/BeatSaber-Versions.csproj b/BeatSaber-Versions.csproj index f5135ed..9c7d017 100644 --- a/BeatSaber-Versions.csproj +++ b/BeatSaber-Versions.csproj @@ -10,6 +10,7 @@ + diff --git a/Program.cs b/Program.cs index ffbe86e..7cbc284 100644 --- a/Program.cs +++ b/Program.cs @@ -17,6 +17,7 @@ namespace BeatSaber_Versions ApplicationConfiguration.Initialize(); if (staticHelpers.IsElevated) { + getNormalBeatSaberFolder.getBSFolder(); Storage.CC = new Config(); Application.Run(new VersionChanger()); } diff --git a/controller/helper/getNormalBeatSaberFolder.cs b/controller/helper/getNormalBeatSaberFolder.cs new file mode 100644 index 0000000..fd8eb51 --- /dev/null +++ b/controller/helper/getNormalBeatSaberFolder.cs @@ -0,0 +1,42 @@ +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"; + + if (File.Exists(f)) + { + dynamic steam = VdfConvert.Deserialize(File.ReadAllText(f)); + dynamic libs = steam.Value; + + foreach (dynamic lib in libs) + { + Console.Write(lib); + foreach(dynamic opt in lib) + { + Console.Write(opt); + } + + dynamic games = lib.Value[lib.Value.Count-1]; + foreach(dynamic game in games) + { + Console.Write(game); + } + } + + + } + + return ""; + } + } +} diff --git a/ui/BeatSaberFolders_Modal.Designer.cs b/ui/BeatSaberFolders_Modal.Designer.cs index 0af4b0b..32860a7 100644 --- a/ui/BeatSaberFolders_Modal.Designer.cs +++ b/ui/BeatSaberFolders_Modal.Designer.cs @@ -29,21 +29,23 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BeatSaberFolders_Modal)); - this.textBox1 = new System.Windows.Forms.TextBox(); + this.beatSaberFolder = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.textBox2 = new System.Windows.Forms.TextBox(); + this.songsFolder = new System.Windows.Forms.TextBox(); this.setBSFolder = new System.Windows.Forms.Button(); this.setBSSongsFolder = new System.Windows.Forms.Button(); this.saveModal = new System.Windows.Forms.Button(); + this.setNormalBeatSaberFolder = new System.Windows.Forms.FolderBrowserDialog(); + this.setCustomSongsFolder = new System.Windows.Forms.FolderBrowserDialog(); this.SuspendLayout(); // - // textBox1 + // beatSaberFolder // - this.textBox1.Location = new System.Drawing.Point(113, 7); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(387, 23); - this.textBox1.TabIndex = 0; + this.beatSaberFolder.Location = new System.Drawing.Point(113, 7); + this.beatSaberFolder.Name = "beatSaberFolder"; + this.beatSaberFolder.Size = new System.Drawing.Size(387, 23); + this.beatSaberFolder.TabIndex = 0; // // label1 // @@ -64,12 +66,12 @@ this.label2.Text = "BeatSaber Songs"; this.label2.Click += new System.EventHandler(this.label2_Click); // - // textBox2 + // songsFolder // - this.textBox2.Location = new System.Drawing.Point(113, 36); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(387, 23); - this.textBox2.TabIndex = 3; + this.songsFolder.Location = new System.Drawing.Point(113, 36); + this.songsFolder.Name = "songsFolder"; + this.songsFolder.Size = new System.Drawing.Size(387, 23); + this.songsFolder.TabIndex = 3; // // setBSFolder // @@ -80,6 +82,7 @@ this.setBSFolder.Text = "Set Folder"; this.setBSFolder.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.setBSFolder.UseVisualStyleBackColor = true; + this.setBSFolder.Click += new System.EventHandler(this.setBSFolder_Click); // // setBSSongsFolder // @@ -90,6 +93,7 @@ this.setBSSongsFolder.Text = "Set Folder"; this.setBSSongsFolder.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.setBSSongsFolder.UseVisualStyleBackColor = true; + this.setBSSongsFolder.Click += new System.EventHandler(this.setBSSongsFolder_Click); // // saveModal // @@ -99,6 +103,7 @@ this.saveModal.TabIndex = 6; this.saveModal.Text = "Save"; this.saveModal.UseVisualStyleBackColor = true; + this.saveModal.Click += new System.EventHandler(this.saveModal_Click); // // BeatSaberFolders_Modal // @@ -109,10 +114,10 @@ this.Controls.Add(this.saveModal); this.Controls.Add(this.setBSSongsFolder); this.Controls.Add(this.setBSFolder); - this.Controls.Add(this.textBox2); + this.Controls.Add(this.songsFolder); this.Controls.Add(this.label2); this.Controls.Add(this.label1); - this.Controls.Add(this.textBox1); + this.Controls.Add(this.beatSaberFolder); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.HelpButton = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -125,12 +130,14 @@ #endregion - private TextBox textBox1; + private TextBox beatSaberFolder; private Label label1; private Label label2; - private TextBox textBox2; + private TextBox songsFolder; private Button setBSFolder; private Button setBSSongsFolder; private Button saveModal; + private FolderBrowserDialog setNormalBeatSaberFolder; + private FolderBrowserDialog setCustomSongsFolder; } } \ No newline at end of file diff --git a/ui/BeatSaberFolders_Modal.cs b/ui/BeatSaberFolders_Modal.cs index 1648153..bce01bf 100644 --- a/ui/BeatSaberFolders_Modal.cs +++ b/ui/BeatSaberFolders_Modal.cs @@ -1,4 +1,5 @@ -using System; +using BeatSaber_Versions.controller; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -15,11 +16,57 @@ namespace BeatSaber_Versions public BeatSaberFolders_Modal() { InitializeComponent(); + songsFolder.Text = Storage.Config.beatsabersongs; + beatSaberFolder.Text = Storage.Config.beatsaberfolder; + } private void label2_Click(object sender, EventArgs e) { } + + private void setBSSongsFolder_Click(object sender, EventArgs e) + { + DialogResult folder = setCustomSongsFolder.ShowDialog(); + if (folder == DialogResult.OK) + { + MessageBox.Show("" + setCustomSongsFolder.SelectedPath); + songsFolder.Text = setCustomSongsFolder.SelectedPath; + + + } + else + { + + } + } + + private void setBSFolder_Click(object sender, EventArgs e) + { + DialogResult folder = setNormalBeatSaberFolder.ShowDialog(); + if (folder == DialogResult.OK) + { + MessageBox.Show("" + setNormalBeatSaberFolder.SelectedPath); + beatSaberFolder.Text = setNormalBeatSaberFolder.SelectedPath; + + + } + else + { + + } + } + + private void saveModal_Click(object sender, EventArgs e) + { + String bsFolder = beatSaberFolder.Text; + String songFolder = songsFolder.Text; + + Storage.Config.beatsaberfolder = bsFolder; + Storage.Config.beatsabersongs = songFolder; + + Storage.CC.writeConfig(); + } } } diff --git a/ui/BeatSaberFolders_Modal.resx b/ui/BeatSaberFolders_Modal.resx index 4e59bc2..c11cf0c 100644 --- a/ui/BeatSaberFolders_Modal.resx +++ b/ui/BeatSaberFolders_Modal.resx @@ -57,6 +57,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 186, 17 + True diff --git a/ui/VersionChanger.Designer.cs b/ui/VersionChanger.Designer.cs index ca0bb4d..125f981 100644 --- a/ui/VersionChanger.Designer.cs +++ b/ui/VersionChanger.Designer.cs @@ -30,7 +30,7 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VersionChanger)); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.settingBSFolder = new System.Windows.Forms.ToolStripMenuItem(); this.panel1 = new System.Windows.Forms.Panel(); this.button2 = new System.Windows.Forms.Button(); this.button_deleteVersion = new System.Windows.Forms.Button(); @@ -54,18 +54,19 @@ // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem1}); + this.settingBSFolder}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(1008, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // - // toolStripMenuItem1 + // settingBSFolder // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(125, 20); - this.toolStripMenuItem1.Text = "toolStripMenuItem1"; + this.settingBSFolder.Name = "settingBSFolder"; + this.settingBSFolder.Size = new System.Drawing.Size(126, 20); + this.settingBSFolder.Text = "Set BeatSaber Folder"; + this.settingBSFolder.Click += new System.EventHandler(this.settingBSFolder_Click); // // panel1 // @@ -233,7 +234,7 @@ #endregion private MenuStrip menuStrip1; - private ToolStripMenuItem toolStripMenuItem1; + private ToolStripMenuItem settingBSFolder; private Panel panel1; private Button playSelected; private ListBox gameVersions; diff --git a/ui/VersionChanger.cs b/ui/VersionChanger.cs index d9ef0dd..fc8cd3f 100644 --- a/ui/VersionChanger.cs +++ b/ui/VersionChanger.cs @@ -186,5 +186,10 @@ namespace BeatSaber_Versions } + private void settingBSFolder_Click(object sender, EventArgs e) + { + BeatSaberFolders_Modal mod = new BeatSaberFolders_Modal(); + mod.Show(); + } } } \ No newline at end of file