From 4b6352228628b6167e5d173c5472edcc8872185e Mon Sep 17 00:00:00 2001 From: SilentSys Date: Fri, 1 Jan 2016 20:08:12 -0800 Subject: [PATCH] v1.2.2 Changes: * Now supports .mp3, .wav, .aac, .wma, .m4a, .mp4, .wmv, .avi, .m4v, and .mov file types. * Better folder selection process. * Better Error reporting for errors occurring while "started". * Able to disable the use of the userdata folder (1.2.0/legacy mode). * Fixed "Alias name is too long" error. --- README.md | 2 +- SLAM/App.config | 7 +- SLAM/Form1.Designer.vb | 14 +-- SLAM/Form1.vb | 127 +++++++++++++++-------- SLAM/My Project/AssemblyInfo.vb | 6 +- SLAM/My Project/Settings.Designer.vb | 16 ++- SLAM/My Project/Settings.settings | 7 +- SLAM/SettingsForm.Designer.vb | 147 +++++++++++++++------------ SLAM/SettingsForm.vb | 16 +-- 9 files changed, 211 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index 7506e7c..4746d2f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ SLAM is a new way to share sounds with your friends over the built in communicat Current features: - Simple in-game interface. - Select tracks either by their track number, or tags. -- Import multiple .mp3 and .wav files at once with the click of a button. +- Import multiple media files at once with the click of a button (.mp3, .wav, .aac, .wma, .m4a, .mp4, .wmv, .avi, .m4v, and .mov file types). - Support for multiple games, such as: Counter-Strike: Global Offensive (CS:GO), Counter-Strike: Source (CS:S), and Team Fortress 2 (TF2) - Create binds to load specific songs. - Change track volume on the go. diff --git a/SLAM/App.config b/SLAM/App.config index 6c1ecb4..36a8624 100644 --- a/SLAM/App.config +++ b/SLAM/App.config @@ -11,7 +11,7 @@ - C:\Program Files (x86)\Steam\steamapps\ + X @@ -38,7 +38,10 @@ = - C:\Program Files (x86)\Steam\userdata\ + + + + True diff --git a/SLAM/Form1.Designer.vb b/SLAM/Form1.Designer.vb index 235a2b3..46495b1 100644 --- a/SLAM/Form1.Designer.vb +++ b/SLAM/Form1.Designer.vb @@ -32,6 +32,7 @@ Partial Class Form1 Me.TrackCol = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.HotKeyCol = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.VolumeCol = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.Trimmed = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.TagsCol = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.StartButton = New System.Windows.Forms.Button() Me.ImportDialog = New System.Windows.Forms.OpenFileDialog() @@ -49,7 +50,6 @@ Partial Class Form1 Me.SetVolumeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.TrimToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.PlayKeyButton = New System.Windows.Forms.Button() - Me.Trimmed = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.TrackContextMenu.SuspendLayout() Me.SuspendLayout() ' @@ -119,6 +119,10 @@ Partial Class Form1 Me.VolumeCol.Text = "Volume" Me.VolumeCol.Width = 100 ' + 'Trimmed + ' + Me.Trimmed.Text = "Trimmed" + ' 'TagsCol ' Me.TagsCol.Text = "Tags" @@ -137,7 +141,9 @@ Partial Class Form1 'ImportDialog ' Me.ImportDialog.FileName = "ImportDialog" - Me.ImportDialog.Filter = "Audio Files|*.mp3;*.wav" + Me.ImportDialog.Filter = "Media files|*.mp3;*.wav;*.aac;*.wma;*.m4a;*.mp4;*.wmv;*.avi;*.m4v;*.mov;|Audio fi" & _ + "les|*.mp3;*.wav;*.aac;*.wma;*.m4a;|Video files|*.mp4;*.wmv;*.avi;*.m4v;*.mov;|Al" & _ + "l files|*.*" Me.ImportDialog.Multiselect = True ' 'ProgressBar1 @@ -233,10 +239,6 @@ Partial Class Form1 Me.PlayKeyButton.Text = "Play key: """"{0}"""" (change)" Me.PlayKeyButton.UseVisualStyleBackColor = True ' - 'Trimmed - ' - Me.Trimmed.Text = "Trimmed" - ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/SLAM/Form1.vb b/SLAM/Form1.vb index be72209..08f6ac8 100644 --- a/SLAM/Form1.vb +++ b/SLAM/Form1.vb @@ -54,13 +54,7 @@ Public Class Form1 End Sub Private Sub WaveCreator(File As String, outputFile As String, Game As SourceGame) - Dim reader As New Object - - If Path.GetExtension(File) = ".mp3" Then - reader = New Mp3FileReader(File) - ElseIf Path.GetExtension(File) = ".wav" Then - reader = New WaveFileReader(File) - End If + Dim reader As New MediaFoundationReader(File) Dim outFormat = New WaveFormat(Game.samplerate, Game.bits, Game.channels) @@ -215,6 +209,28 @@ Public Class Form1 End Sub Private Sub StartPoll() + + Dim Game As SourceGame = GetCurrentGame() + If Not Game.id = 0 And My.Settings.UserDataEnabled Then 'The CFG's are located in the userdata folder + Dim CFGExists As Boolean = False + If Directory.Exists(My.Settings.UserdataPath) Then + For Each userdir As String In Directory.GetDirectories(My.Settings.UserdataPath) + Dim CFGPath As String = Path.Combine(userdir, Game.id.ToString) & "\local\cfg\" + If Directory.Exists(CFGPath) Then + CFGExists = True + Exit For + End If + Next + End If + If Not CFGExists Then + MessageBox.Show("The set ""UserData"" folder does not seem to be correct! Please choose the correct folder.", "Folder does not exist!", MessageBoxButtons.OK, MessageBoxIcon.Error) + If ShowUserDataSelector() Then + StartPoll() + End If + Return + End If + End If + running = True StartButton.Text = "Stop" CreateCfgFiles() @@ -364,45 +380,51 @@ Public Class Form1 Dim GameDir As String = Path.Combine(SteamappsPath, Game.directory) Dim GameCfg As String = Path.Combine(GameDir, Game.ToCfg) & "slam_relay.cfg" + Try + Do + If PollRelayWorker.CancellationPending Then + Exit Do + End If - Do - If PollRelayWorker.CancellationPending Then - Exit Do - End If + If Not Game.id = 0 And My.Settings.UserDataEnabled Then + GameCfg = UserDataCFG(Game) + End If - If Not String.IsNullOrEmpty(Game.id) Then - GameCfg = UserDataCFG(Game) - End If + If File.Exists(GameCfg) Then + Dim RelayCfg As String + Using reader As StreamReader = New StreamReader(GameCfg) + RelayCfg = reader.ReadToEnd + End Using - If File.Exists(GameCfg) Then - Dim RelayCfg As String - Using reader As StreamReader = New StreamReader(GameCfg) - RelayCfg = reader.ReadToEnd - End Using - - Dim command As String = recog(RelayCfg, String.Format("bind ""{0}"" ""(.*?)""", My.Settings.RelayKey)) - If Not String.IsNullOrEmpty(command) Then - 'load audiofile - If IsNumeric(command) Then - If LoadTrack(Game, Convert.ToInt32(command) - 1) Then - PollRelayWorker.ReportProgress(Convert.ToInt32(command) - 1) + Dim command As String = recog(RelayCfg, String.Format("bind ""{0}"" ""(.*?)""", My.Settings.RelayKey)) + If Not String.IsNullOrEmpty(command) Then + 'load audiofile + If IsNumeric(command) Then + If LoadTrack(Game, Convert.ToInt32(command) - 1) Then + PollRelayWorker.ReportProgress(Convert.ToInt32(command) - 1) + End If End If + File.Delete(GameCfg) End If - File.Delete(GameCfg) End If - End If - Thread.Sleep(Game.PollInterval) - Loop + Thread.Sleep(Game.PollInterval) + Loop + Catch ex As Exception + LogError(ex) + e.Result = ex + End Try End Sub Public Function UserDataCFG(Game As SourceGame) As String - For Each userdir As String In Directory.GetDirectories(My.Settings.UserdataPath) - Dim CFGPath As String = Path.Combine(userdir, Game.id.ToString) & "\local\cfg\slam_relay.cfg" - If File.Exists(CFGPath) Then - Return CFGPath - End If - Next + If Directory.Exists(My.Settings.UserdataPath) Then + For Each userdir As String In Directory.GetDirectories(My.Settings.UserdataPath) + Dim CFGPath As String = Path.Combine(userdir, Game.id.ToString) & "\local\cfg\slam_relay.cfg" + If File.Exists(CFGPath) Then + Return CFGPath + End If + Next + End If Return vbNullString End Function @@ -414,6 +436,10 @@ Public Class Form1 If running Then StopPoll() End If + + If Not IsNothing(e.Result) Then 'Result is always an exception + MessageBox.Show(e.Result.Message & " See errorlog.txt for more info.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If End Sub Private Sub CreateTags(ByVal Game As SourceGame) @@ -425,7 +451,7 @@ Public Class Form1 For Each Word In Words - If Not IsNumeric(Word) And Not Game.blacklist.Contains(Word.ToLower) Then + If Not IsNumeric(Word) And Not Game.blacklist.Contains(Word.ToLower) And Word.Length < 32 Then If NameWords.ContainsKey(Word) Then NameWords.Remove(Word) Else @@ -485,6 +511,12 @@ Public Class Form1 ReloadTracks(GetCurrentGame) RefreshTrackList() + 'This should set the UserData path drive to the same as the drive on the SteamApps path on first run + If String.IsNullOrEmpty(My.Settings.UserdataPath) Then + My.Settings.UserdataPath = SteamappsPath.Split("\")(0) & "\Program Files (x86)\Steam\userdata\" + End If + + My.Settings.SteamAppsFolder = SteamappsPath My.Settings.Save() @@ -498,7 +530,7 @@ Public Class Form1 End Sub - Public Sub ShowFolderSelector() + Public Function ShowFolderSelector() As Boolean Dim ChangeDirDialog As New FolderBrowserDialog ChangeDirDialog.Description = "Select your steamapps folder:" ChangeDirDialog.ShowNewFolderButton = False @@ -506,9 +538,11 @@ Public Class Form1 If ChangeDirDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then SteamappsPath = ChangeDirDialog.SelectedPath & "\" LoadGames() + Return True End If - End Sub + Return False + End Function Private Sub LoadTrackKeys(ByVal Game As SourceGame) Dim SettingsList As New List(Of SourceGame.track) @@ -755,7 +789,7 @@ Public Class Form1 Private Sub LogError(ByVal ex As Exception) If My.Settings.LogError Then - Using log As StreamWriter = New StreamWriter("log.txt", True) + Using log As StreamWriter = New StreamWriter("errorlog.txt", True) log.WriteLine("--------------------{0}--------------------", DateTime.Now) log.WriteLine(ex.ToString) End Using @@ -792,6 +826,19 @@ Public Class Form1 End Sub + Public Function ShowUserDataSelector() As Boolean + Dim ChangeDirDialog As New FolderBrowserDialog + ChangeDirDialog.Description = "Select your userdata folder:" + ChangeDirDialog.ShowNewFolderButton = False + + If ChangeDirDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then + My.Settings.UserdataPath = ChangeDirDialog.SelectedPath & "\" + Return True + End If + + Return False + End Function + Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing If running Then StopPoll() diff --git a/SLAM/My Project/AssemblyInfo.vb b/SLAM/My Project/AssemblyInfo.vb index 6c7f4c9..718ba92 100644 --- a/SLAM/My Project/AssemblyInfo.vb +++ b/SLAM/My Project/AssemblyInfo.vb @@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/SLAM/My Project/Settings.Designer.vb b/SLAM/My Project/Settings.Designer.vb index 17632bd..f824af8 100644 --- a/SLAM/My Project/Settings.Designer.vb +++ b/SLAM/My Project/Settings.Designer.vb @@ -56,7 +56,7 @@ Namespace My _ + Global.System.Configuration.DefaultSettingValueAttribute("")> _ Public Property SteamAppsFolder() As String Get Return CType(Me("SteamAppsFolder"),String) @@ -164,7 +164,7 @@ Namespace My _ + Global.System.Configuration.DefaultSettingValueAttribute("")> _ Public Property UserdataPath() As String Get Return CType(Me("UserdataPath"),String) @@ -173,6 +173,18 @@ Namespace My Me("UserdataPath") = value End Set End Property + + _ + Public Property UserDataEnabled() As Boolean + Get + Return CType(Me("UserDataEnabled"), Boolean) + End Get + Set(value As Boolean) + Me("UserDataEnabled") = value + End Set + End Property End Class End Namespace diff --git a/SLAM/My Project/Settings.settings b/SLAM/My Project/Settings.settings index aa3ab4b..c072639 100644 --- a/SLAM/My Project/Settings.settings +++ b/SLAM/My Project/Settings.settings @@ -3,7 +3,7 @@ - C:\Program Files (x86)\Steam\steamapps\ + X @@ -30,7 +30,10 @@ = - C:\Program Files (x86)\Steam\userdata\ + + + + True \ No newline at end of file diff --git a/SLAM/SettingsForm.Designer.vb b/SLAM/SettingsForm.Designer.vb index cc69419..425bf78 100644 --- a/SLAM/SettingsForm.Designer.vb +++ b/SLAM/SettingsForm.Designer.vb @@ -26,30 +26,31 @@ Partial Class SettingsForm Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel() Me.VersionLabel = New System.Windows.Forms.ToolStripStatusLabel() Me.TabPage1 = New System.Windows.Forms.TabPage() + Me.GroupBox4 = New System.Windows.Forms.GroupBox() + Me.ChangeDataDirButton = New System.Windows.Forms.Button() + Me.UserDataDir = New System.Windows.Forms.TextBox() Me.GroupBox3 = New System.Windows.Forms.GroupBox() Me.ChangeRelayButton = New System.Windows.Forms.Button() + Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.ChangeDirButton = New System.Windows.Forms.Button() + Me.DirText = New System.Windows.Forms.TextBox() Me.GroupBox2 = New System.Windows.Forms.GroupBox() Me.ConTagsCheckBox = New System.Windows.Forms.CheckBox() Me.StartEnabledCheckBox = New System.Windows.Forms.CheckBox() Me.LogCheckBox = New System.Windows.Forms.CheckBox() Me.HintCheckBox = New System.Windows.Forms.CheckBox() Me.UpdateCheckBox = New System.Windows.Forms.CheckBox() - Me.GroupBox1 = New System.Windows.Forms.GroupBox() - Me.ChangeDirButton = New System.Windows.Forms.Button() - Me.DirText = New System.Windows.Forms.TextBox() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.TabPage2 = New System.Windows.Forms.TabPage() - Me.GroupBox4 = New System.Windows.Forms.GroupBox() - Me.Button1 = New System.Windows.Forms.Button() - Me.UserDataDir = New System.Windows.Forms.TextBox() + Me.UserDataCheckBox = New System.Windows.Forms.CheckBox() Me.StatusStrip1.SuspendLayout() Me.TabPage1.SuspendLayout() + Me.GroupBox4.SuspendLayout() Me.GroupBox3.SuspendLayout() - Me.GroupBox2.SuspendLayout() Me.GroupBox1.SuspendLayout() + Me.GroupBox2.SuspendLayout() Me.TabControl1.SuspendLayout() Me.TabPage2.SuspendLayout() - Me.GroupBox4.SuspendLayout() Me.SuspendLayout() ' 'StatusStrip1 @@ -87,6 +88,35 @@ Partial Class SettingsForm Me.TabPage1.Text = "General" Me.TabPage1.UseVisualStyleBackColor = True ' + 'GroupBox4 + ' + Me.GroupBox4.Controls.Add(Me.UserDataCheckBox) + Me.GroupBox4.Controls.Add(Me.ChangeDataDirButton) + Me.GroupBox4.Controls.Add(Me.UserDataDir) + Me.GroupBox4.Location = New System.Drawing.Point(8, 147) + Me.GroupBox4.Name = "GroupBox4" + Me.GroupBox4.Size = New System.Drawing.Size(260, 75) + Me.GroupBox4.TabIndex = 2 + Me.GroupBox4.TabStop = False + Me.GroupBox4.Text = "UserData Directory" + ' + 'ChangeDataDirButton + ' + Me.ChangeDataDirButton.Location = New System.Drawing.Point(179, 45) + Me.ChangeDataDirButton.Name = "ChangeDataDirButton" + Me.ChangeDataDirButton.Size = New System.Drawing.Size(75, 23) + Me.ChangeDataDirButton.TabIndex = 1 + Me.ChangeDataDirButton.Text = "Change" + Me.ChangeDataDirButton.UseVisualStyleBackColor = True + ' + 'UserDataDir + ' + Me.UserDataDir.Location = New System.Drawing.Point(6, 19) + Me.UserDataDir.Name = "UserDataDir" + Me.UserDataDir.ReadOnly = True + Me.UserDataDir.Size = New System.Drawing.Size(248, 20) + Me.UserDataDir.TabIndex = 0 + ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.ChangeRelayButton) @@ -106,6 +136,34 @@ Partial Class SettingsForm Me.ChangeRelayButton.Text = "Relay key: """"{0}"""" (change)" Me.ChangeRelayButton.UseVisualStyleBackColor = True ' + 'GroupBox1 + ' + Me.GroupBox1.Controls.Add(Me.ChangeDirButton) + Me.GroupBox1.Controls.Add(Me.DirText) + Me.GroupBox1.Location = New System.Drawing.Point(8, 8) + Me.GroupBox1.Name = "GroupBox1" + Me.GroupBox1.Size = New System.Drawing.Size(260, 75) + Me.GroupBox1.TabIndex = 0 + Me.GroupBox1.TabStop = False + Me.GroupBox1.Text = "SteamApps Directory" + ' + 'ChangeDirButton + ' + Me.ChangeDirButton.Location = New System.Drawing.Point(179, 45) + Me.ChangeDirButton.Name = "ChangeDirButton" + Me.ChangeDirButton.Size = New System.Drawing.Size(75, 23) + Me.ChangeDirButton.TabIndex = 1 + Me.ChangeDirButton.Text = "Change" + Me.ChangeDirButton.UseVisualStyleBackColor = True + ' + 'DirText + ' + Me.DirText.Location = New System.Drawing.Point(6, 19) + Me.DirText.Name = "DirText" + Me.DirText.ReadOnly = True + Me.DirText.Size = New System.Drawing.Size(248, 20) + Me.DirText.TabIndex = 0 + ' 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.ConTagsCheckBox) @@ -170,34 +228,6 @@ Partial Class SettingsForm Me.UpdateCheckBox.Text = "Check for updates" Me.UpdateCheckBox.UseVisualStyleBackColor = True ' - 'GroupBox1 - ' - Me.GroupBox1.Controls.Add(Me.ChangeDirButton) - Me.GroupBox1.Controls.Add(Me.DirText) - Me.GroupBox1.Location = New System.Drawing.Point(8, 8) - Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(260, 75) - Me.GroupBox1.TabIndex = 0 - Me.GroupBox1.TabStop = False - Me.GroupBox1.Text = "SteamApps Directory" - ' - 'ChangeDirButton - ' - Me.ChangeDirButton.Location = New System.Drawing.Point(179, 45) - Me.ChangeDirButton.Name = "ChangeDirButton" - Me.ChangeDirButton.Size = New System.Drawing.Size(75, 23) - Me.ChangeDirButton.TabIndex = 1 - Me.ChangeDirButton.Text = "Change" - Me.ChangeDirButton.UseVisualStyleBackColor = True - ' - 'DirText - ' - Me.DirText.Location = New System.Drawing.Point(6, 19) - Me.DirText.Name = "DirText" - Me.DirText.ReadOnly = True - Me.DirText.Size = New System.Drawing.Size(248, 20) - Me.DirText.TabIndex = 0 - ' 'TabControl1 ' Me.TabControl1.Controls.Add(Me.TabPage1) @@ -220,33 +250,15 @@ Partial Class SettingsForm Me.TabPage2.Text = "Misc." Me.TabPage2.UseVisualStyleBackColor = True ' - 'GroupBox4 + 'UserDataCheckBox ' - Me.GroupBox4.Controls.Add(Me.Button1) - Me.GroupBox4.Controls.Add(Me.UserDataDir) - Me.GroupBox4.Location = New System.Drawing.Point(8, 147) - Me.GroupBox4.Name = "GroupBox4" - Me.GroupBox4.Size = New System.Drawing.Size(260, 75) - Me.GroupBox4.TabIndex = 2 - Me.GroupBox4.TabStop = False - Me.GroupBox4.Text = "UserData Directory" - ' - 'Button1 - ' - Me.Button1.Location = New System.Drawing.Point(179, 45) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(75, 23) - Me.Button1.TabIndex = 1 - Me.Button1.Text = "Change" - Me.Button1.UseVisualStyleBackColor = True - ' - 'UserDataDir - ' - Me.UserDataDir.Location = New System.Drawing.Point(6, 19) - Me.UserDataDir.Name = "UserDataDir" - Me.UserDataDir.ReadOnly = True - Me.UserDataDir.Size = New System.Drawing.Size(248, 20) - Me.UserDataDir.TabIndex = 0 + Me.UserDataCheckBox.AutoSize = True + Me.UserDataCheckBox.Location = New System.Drawing.Point(6, 49) + Me.UserDataCheckBox.Name = "UserDataCheckBox" + Me.UserDataCheckBox.Size = New System.Drawing.Size(65, 17) + Me.UserDataCheckBox.TabIndex = 2 + Me.UserDataCheckBox.Text = "Enabled" + Me.UserDataCheckBox.UseVisualStyleBackColor = True ' 'SettingsForm ' @@ -262,15 +274,15 @@ Partial Class SettingsForm Me.StatusStrip1.ResumeLayout(False) Me.StatusStrip1.PerformLayout() Me.TabPage1.ResumeLayout(False) + Me.GroupBox4.ResumeLayout(False) + Me.GroupBox4.PerformLayout() Me.GroupBox3.ResumeLayout(False) - Me.GroupBox2.ResumeLayout(False) - Me.GroupBox2.PerformLayout() Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() + Me.GroupBox2.ResumeLayout(False) + Me.GroupBox2.PerformLayout() Me.TabControl1.ResumeLayout(False) Me.TabPage2.ResumeLayout(False) - Me.GroupBox4.ResumeLayout(False) - Me.GroupBox4.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -292,7 +304,8 @@ Partial Class SettingsForm Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox Friend WithEvents ChangeRelayButton As System.Windows.Forms.Button Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox - Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents ChangeDataDirButton As System.Windows.Forms.Button Friend WithEvents UserDataDir As System.Windows.Forms.TextBox Friend WithEvents TabPage2 As System.Windows.Forms.TabPage + Friend WithEvents UserDataCheckBox As System.Windows.Forms.CheckBox End Class diff --git a/SLAM/SettingsForm.vb b/SLAM/SettingsForm.vb index 8764c74..16b5ced 100644 --- a/SLAM/SettingsForm.vb +++ b/SLAM/SettingsForm.vb @@ -9,6 +9,7 @@ LogCheckBox.Checked = My.Settings.LogError StartEnabledCheckBox.Checked = My.Settings.StartEnabled ConTagsCheckBox.Checked = My.Settings.WriteTags + UserDataCheckBox.Checked = My.Settings.UserDataEnabled ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey) End Sub @@ -51,14 +52,13 @@ End If End Sub - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - Dim ChangeDirDialog As New FolderBrowserDialog - ChangeDirDialog.Description = "Select your userdata folder:" - ChangeDirDialog.ShowNewFolderButton = False - - If ChangeDirDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then - My.Settings.UserdataPath = ChangeDirDialog.SelectedPath & "\" + Private Sub ChangeDataDirButton_Click(sender As Object, e As EventArgs) Handles ChangeDataDirButton.Click + Form1.ShowUserDataSelector() UserDataDir.Text = My.Settings.UserdataPath - End If + End Sub + + Private Sub UserDataCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles UserDataCheckBox.CheckedChanged + My.Settings.UserDataEnabled = UserDataCheckBox.Checked + My.Settings.Save() End Sub End Class \ No newline at end of file