diff --git a/SLAM/App.config b/SLAM/App.config index d6823ae..96b2c49 100644 --- a/SLAM/App.config +++ b/SLAM/App.config @@ -22,6 +22,21 @@ False + + True + + + True + + + False + + + True + + + = + \ No newline at end of file diff --git a/SLAM/Form1.Designer.vb b/SLAM/Form1.Designer.vb index 974adf4..d9d0e6a 100644 --- a/SLAM/Form1.Designer.vb +++ b/SLAM/Form1.Designer.vb @@ -31,6 +31,7 @@ Partial Class Form1 Me.LoadedCol = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) 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.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() @@ -45,6 +46,7 @@ Partial Class Form1 Me.ContextRefresh = New System.Windows.Forms.ToolStripMenuItem() Me.RemoveHotkeyToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ContextHotKey = New System.Windows.Forms.ToolStripMenuItem() + Me.SetVolumeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.PlayKeyButton = New System.Windows.Forms.Button() Me.TrackContextMenu.SuspendLayout() Me.SuspendLayout() @@ -86,12 +88,11 @@ Partial Class Form1 Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TrackList.AutoArrange = False - Me.TrackList.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.LoadedCol, Me.TrackCol, Me.HotKeyCol, Me.TagsCol}) + Me.TrackList.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.LoadedCol, Me.TrackCol, Me.HotKeyCol, Me.VolumeCol, Me.TagsCol}) Me.TrackList.FullRowSelect = True Me.TrackList.HideSelection = False Me.TrackList.ImeMode = System.Windows.Forms.ImeMode.Off Me.TrackList.Location = New System.Drawing.Point(15, 39) - Me.TrackList.MultiSelect = False Me.TrackList.Name = "TrackList" Me.TrackList.Size = New System.Drawing.Size(457, 252) Me.TrackList.TabIndex = 4 @@ -111,6 +112,11 @@ Partial Class Form1 ' Me.HotKeyCol.Text = "Bind" ' + 'VolumeCol + ' + Me.VolumeCol.Text = "Volume" + Me.VolumeCol.Width = 100 + ' 'TagsCol ' Me.TagsCol.Text = "Tags" @@ -158,51 +164,57 @@ Partial Class Form1 Me.ChangeDirButton.Name = "ChangeDirButton" Me.ChangeDirButton.Size = New System.Drawing.Size(75, 23) Me.ChangeDirButton.TabIndex = 7 - Me.ChangeDirButton.Text = "Change Dir" + Me.ChangeDirButton.Text = "Settings" Me.ChangeDirButton.UseVisualStyleBackColor = True ' 'TrackContextMenu ' - Me.TrackContextMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ContextDelete, Me.GoToToolStripMenuItem, Me.LoadToolStripMenuItem, Me.ContextRefresh, Me.RemoveHotkeyToolStripMenuItem, Me.ContextHotKey}) + Me.TrackContextMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ContextDelete, Me.GoToToolStripMenuItem, Me.LoadToolStripMenuItem, Me.ContextRefresh, Me.RemoveHotkeyToolStripMenuItem, Me.ContextHotKey, Me.SetVolumeToolStripMenuItem}) Me.TrackContextMenu.Name = "TrackContextMenu" - Me.TrackContextMenu.Size = New System.Drawing.Size(153, 158) + Me.TrackContextMenu.Size = New System.Drawing.Size(145, 158) ' 'ContextDelete ' Me.ContextDelete.Name = "ContextDelete" - Me.ContextDelete.Size = New System.Drawing.Size(158, 22) + Me.ContextDelete.Size = New System.Drawing.Size(144, 22) Me.ContextDelete.Text = "Delete" ' 'GoToToolStripMenuItem ' Me.GoToToolStripMenuItem.Name = "GoToToolStripMenuItem" - Me.GoToToolStripMenuItem.Size = New System.Drawing.Size(158, 22) + Me.GoToToolStripMenuItem.Size = New System.Drawing.Size(144, 22) Me.GoToToolStripMenuItem.Text = "Go To" ' 'LoadToolStripMenuItem ' Me.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem" - Me.LoadToolStripMenuItem.Size = New System.Drawing.Size(158, 22) + Me.LoadToolStripMenuItem.Size = New System.Drawing.Size(144, 22) Me.LoadToolStripMenuItem.Text = "Load" ' 'ContextRefresh ' Me.ContextRefresh.Name = "ContextRefresh" - Me.ContextRefresh.Size = New System.Drawing.Size(158, 22) + Me.ContextRefresh.Size = New System.Drawing.Size(144, 22) Me.ContextRefresh.Text = "Refresh" ' 'RemoveHotkeyToolStripMenuItem ' Me.RemoveHotkeyToolStripMenuItem.Name = "RemoveHotkeyToolStripMenuItem" - Me.RemoveHotkeyToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.RemoveHotkeyToolStripMenuItem.Size = New System.Drawing.Size(144, 22) Me.RemoveHotkeyToolStripMenuItem.Text = "Remove Bind" ' 'ContextHotKey ' Me.ContextHotKey.Name = "ContextHotKey" - Me.ContextHotKey.Size = New System.Drawing.Size(152, 22) + Me.ContextHotKey.Size = New System.Drawing.Size(144, 22) Me.ContextHotKey.Text = "Set Bind" ' + 'SetVolumeToolStripMenuItem + ' + Me.SetVolumeToolStripMenuItem.Name = "SetVolumeToolStripMenuItem" + Me.SetVolumeToolStripMenuItem.Size = New System.Drawing.Size(144, 22) + Me.SetVolumeToolStripMenuItem.Text = "Set Volume" + ' 'PlayKeyButton ' Me.PlayKeyButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) @@ -210,7 +222,7 @@ Partial Class Form1 Me.PlayKeyButton.Name = "PlayKeyButton" Me.PlayKeyButton.Size = New System.Drawing.Size(225, 23) Me.PlayKeyButton.TabIndex = 8 - Me.PlayKeyButton.Text = "Play key: {0} (change)" + Me.PlayKeyButton.Text = "Play key: """"{0}"""" (change)" Me.PlayKeyButton.UseVisualStyleBackColor = True ' 'Form1 @@ -258,5 +270,7 @@ Partial Class Form1 Friend WithEvents RemoveHotkeyToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents GoToToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents PlayKeyButton As System.Windows.Forms.Button + Friend WithEvents VolumeCol As System.Windows.Forms.ColumnHeader + Friend WithEvents SetVolumeToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/SLAM/Form1.vb b/SLAM/Form1.vb index 4b8ec8b..dab58c8 100644 --- a/SLAM/Form1.vb +++ b/SLAM/Form1.vb @@ -18,7 +18,9 @@ Public Class Form1 RefreshPlayKey() - CheckForUpdate() + If My.Settings.UpdateCheck Then + CheckForUpdate() + End If Dim csgo As New SourceGame csgo.name = "Counter-Strike: Global Offensive" @@ -26,6 +28,7 @@ Public Class Form1 csgo.ToCfg = "csgo\cfg\" csgo.libraryname = "csgo\" csgo.samplerate = 22050 + csgo.blacklist.AddRange({"drop", "buy", "go", "fallback", "sticktog", "holdpos", "followme", "coverme", "regroup", "roger", "negative", "cheer", "compliment", "thanks", "enemydown", "reportingin", "enemyspot", "takepoint", "sectorclear", "inposition", "takingfire", "report", "getout"}) Games.Add(csgo) Dim css As New SourceGame @@ -43,6 +46,10 @@ Public Class Form1 Games.Add(tf2) LoadGames() + + If My.Settings.StartEnabled Then + StartPoll() + End If End Sub Private Sub WaveCreator(File As String, outputFile As String, Game As SourceGame) @@ -74,12 +81,13 @@ Public Class Form1 Private Sub ImportButton_Click(sender As Object, e As EventArgs) Handles ImportButton.Click If File.Exists("NAudio.dll") Then + DisableInterface() If ImportDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then - DisableInterface() ProgressBar1.Maximum = ImportDialog.FileNames.Count Dim WorkerPassthrough() As Object = {GetCurrentGame(), ImportDialog.FileNames} WavWorker.RunWorkerAsync(WorkerPassthrough) - + Else + EnableInterface() End If Else @@ -100,6 +108,7 @@ Public Class Form1 WaveCreator(File, OutFile, Game) Catch ex As Exception + LogError(ex) FailedFiles.Add(File) End Try WavWorker.ReportProgress(0) @@ -172,14 +181,15 @@ Public Class Form1 Dim Game As SourceGame = GetCurrentGame() For Each Track In Game.tracks - TrackList.Items.Add(New ListViewItem({"False", Track.name, Track.hotkey, """" & String.Join(""", """, Track.tags) & """"})) + TrackList.Items.Add(New ListViewItem({"False", Track.name, Track.hotkey, Track.volume & "%", """" & String.Join(""", """, Track.tags) & """"})) Next TrackList.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize) TrackList.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent) TrackList.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.HeaderSize) - TrackList.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.ColumnContent) + TrackList.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.HeaderSize) + TrackList.AutoResizeColumn(4, ColumnHeaderAutoResizeStyle.ColumnContent) End Sub Private Sub StartButton_Click(sender As Object, e As EventArgs) Handles StartButton.Click @@ -202,12 +212,16 @@ Public Class Form1 CreateCfgFiles() DisableInterface() StartButton.Enabled = True + TrackList.Enabled = True + SetVolumeToolStripMenuItem.Enabled = True + LoadToolStripMenuItem.Enabled = True PollRelayWorker.RunWorkerAsync(GetCurrentGame) End Sub Private Sub StopPoll() running = False StartButton.Text = "Start" + DeleteCFGs(GetCurrentGame) EnableInterface() PollRelayWorker.CancelAsync() End Sub @@ -228,17 +242,20 @@ Public Class Form1 slam_cfg.WriteLine("alias slam_play_off ""-voicerecord; voice_inputfromfile 0; voice_loopback 0; alias slam_play slam_play_on""") slam_cfg.WriteLine("alias slam_updatecfg ""host_writeconfig slam_relay""") slam_cfg.WriteLine("bind {0} slam_play", My.Settings.PlayKey) + slam_cfg.WriteLine("alias slam_curtrack ""exec slam_curtrack.cfg""") + slam_cfg.WriteLine("alias slam_saycurtrack ""exec slam_saycurtrack.cfg""") + slam_cfg.WriteLine("alias slam_sayteamcurtrack ""exec slam_sayteamcurtrack.cfg""") For Each Track In Game.tracks Dim index As String = Game.tracks.IndexOf(Track) - slam_cfg.WriteLine("alias {0} ""bind {1} {0}; slam_updatecfg; echo Loaded: {2}""", index + 1, Game.RelayKey, Track.name) + slam_cfg.WriteLine("alias {0} ""bind {1} {0}; slam_updatecfg; echo Loaded: {2}""", index + 1, My.Settings.RelayKey, Track.name) For Each TrackTag In Track.tags - slam_cfg.WriteLine("alias {0} ""bind {1} {2}; slam_updatecfg; echo Loaded: {3}""", TrackTag, Game.RelayKey, index + 1, Track.name) + slam_cfg.WriteLine("alias {0} ""bind {1} {2}; slam_updatecfg; echo Loaded: {3}""", TrackTag, My.Settings.RelayKey, index + 1, Track.name) Next If Not String.IsNullOrEmpty(Track.hotkey) Then - slam_cfg.WriteLine("bind {0} ""bind {1} {2}; slam_updatecfg; echo Loaded: {3}""", Track.hotkey, Game.RelayKey, index + 1, Track.name) + slam_cfg.WriteLine("bind {0} ""bind {1} {2}; slam_updatecfg; echo Loaded: {3}""", Track.hotkey, My.Settings.RelayKey, index + 1, Track.name) End If Next @@ -251,7 +268,11 @@ Public Class Form1 slam_tracklist_cfg.WriteLine("echo ""--------------------Tracks--------------------""") For Each Track In Game.tracks Dim index As String = Game.tracks.IndexOf(Track) - slam_tracklist_cfg.WriteLine("echo ""{0}. {1} [{2}]""", index + 1, Track.name, "'" & String.Join("', '", Track.tags) & "'") + If My.Settings.WriteTags Then + slam_tracklist_cfg.WriteLine("echo ""{0}. {1} [{2}]""", index + 1, Track.name, "'" & String.Join("', '", Track.tags) & "'") + Else + slam_tracklist_cfg.WriteLine("echo ""{0}. {1}""", index + 1, Track.name) + End If Next slam_tracklist_cfg.WriteLine("echo ""----------------------------------------------""") End Using @@ -259,18 +280,47 @@ Public Class Form1 End Sub Private Function LoadTrack(ByVal Game As SourceGame, ByVal index As Integer) As Boolean - Dim TrackName As String + Dim Track As SourceGame.track If Game.tracks.Count > index Then - TrackName = Game.tracks(index).name + Track = Game.tracks(index) Dim voicefile As String = Path.Combine(SteamappsPath, Game.directory) & "voice_input.wav" Try If File.Exists(voicefile) Then File.Delete(voicefile) End If - File.Copy(Game.libraryname & TrackName & Game.FileExtension, voicefile) + + Dim trackfile As String = Game.libraryname & Track.name & Game.FileExtension + If File.Exists(trackfile) Then + + If Track.volume = 100 Then + File.Copy(trackfile, voicefile) + Else + Dim WaveFloat As New WaveChannel32(New WaveFileReader(trackfile)) + WaveFloat.PadWithZeroes = False + WaveFloat.Volume = (Track.volume / 100) ^ 6 + Dim Wave16 As New Wave32To16Stream(WaveFloat) + Dim outFormat = New WaveFormat(Game.samplerate, Game.bits, Game.channels) + Dim resampler = New MediaFoundationResampler(Wave16, outFormat) + WaveFileWriter.CreateWaveFile(voicefile, resampler) + End If + + Dim GameCfgFolder As String = Path.Combine(SteamappsPath, Game.directory, Game.ToCfg) + Using slam_curtrack As StreamWriter = New StreamWriter(GameCfgFolder & "slam_curtrack.cfg") + slam_curtrack.WriteLine("echo ""[SLAM] Track name: {0}""", Track.name) + End Using + Using slam_saycurtrack As StreamWriter = New StreamWriter(GameCfgFolder & "slam_saycurtrack.cfg") + slam_saycurtrack.WriteLine("say ""[SLAM] Track name: {0}""", Track.name) + End Using + Using slam_sayteamcurtrack As StreamWriter = New StreamWriter(GameCfgFolder & "slam_sayteamcurtrack.cfg") + slam_sayteamcurtrack.WriteLine("say_team ""[SLAM] Track name: {0}""", Track.name) + End Using + + + End If Catch ex As Exception + LogError(ex) Return False End Try @@ -299,7 +349,7 @@ Public Class Form1 RelayCfg = reader.ReadToEnd End Using - Dim command As String = recog(RelayCfg, String.Format("bind ""{0}"" ""(.*?)""", Game.RelayKey)) + 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 @@ -320,8 +370,6 @@ Public Class Form1 End Sub Private Sub CreateTags(ByVal Game As SourceGame) - Dim BadWords() As String = {"slam", "slam_listtracks", "list", "tracks", "la", "slam_play", "slam_play_on", "slam_play_off", "slam_updatecfg", "drop", "go", "fallback", "sticktog", "holdpos", "followme", - "coverme", "regroup", "roger", "negative", "cheer", "compliment", "thanks", "enemydown", "reportingin", "enemyspot", "takepoint", "sectorclear", "inposition", "takingfire", "report", "getout"} Dim NameWords As New Dictionary(Of String, Integer) Dim index As Integer @@ -330,7 +378,7 @@ Public Class Form1 For Each Word In Words - If Not IsNumeric(Word) And Not BadWords.Contains(Word.ToLower) Then + If Not IsNumeric(Word) And Not Game.blacklist.Contains(Word.ToLower) Then If NameWords.ContainsKey(Word) Then NameWords.Remove(Word) Else @@ -366,15 +414,11 @@ Public Class Form1 TrackList.Items(track).SubItems(0).Text = "True" End Sub - Private Sub ChangeDirButton_Click(sender As Object, e As EventArgs) Handles ChangeDirButton.Click - ShowFolderSelector() - End Sub - Private Sub LoadGames() GameSelector.Items.Clear() For Each Game In Games - Dim GameFullPath As String = Path.Combine(SteamappsPath, Game.directory) + Dim GameFullPath As String = Path.Combine(SteamappsPath, Game.directory, Game.ToCfg) If Directory.Exists(GameFullPath) Then GameSelector.Items.Add(Game.name) @@ -407,7 +451,7 @@ Public Class Form1 End Sub - Private Sub ShowFolderSelector() + Public Sub ShowFolderSelector() Dim ChangeDirDialog As New FolderBrowserDialog ChangeDirDialog.Description = "Select your steamapps folder:" ChangeDirDialog.ShowNewFolderButton = False @@ -420,47 +464,48 @@ Public Class Form1 End Sub Private Sub LoadTrackKeys(ByVal Game As SourceGame) - Dim HotKeys As New Dictionary(Of String, String) 'Name, Key - Dim HotkeyFile As String = Path.Combine(Game.libraryname, "HotKeys.xml") + Dim SettingsList As New List(Of SourceGame.track) + Dim SettingsFile As String = Path.Combine(Game.libraryname, "TrackSettings.xml") - If File.Exists(HotkeyFile) Then + If File.Exists(SettingsFile) Then Dim XmlFile As String - Using reader As StreamReader = New StreamReader(HotkeyFile) + Using reader As StreamReader = New StreamReader(SettingsFile) XmlFile = reader.ReadToEnd End Using - HotKeys = Deserialize(Of Dictionary(Of String, String))(XmlFile) + SettingsList = Deserialize(Of List(Of SourceGame.track))(XmlFile) End If For Each Track In Game.tracks - If HotKeys.ContainsKey(Track.name) Then - - Track.hotkey = HotKeys.Item(Track.name) - - End If + For Each SetTrack In SettingsList + If Track.name = SetTrack.name Then + Track.hotkey = SetTrack.hotkey + Track.volume = SetTrack.volume + End If + Next Next End Sub Private Sub SaveTrackKeys(ByVal Game As SourceGame) - Dim HotKeys As New Dictionary(Of String, String) 'Name, Key - Dim HotkeyFile As String = Path.Combine(Game.libraryname, "HotKeys.xml") + Dim SettingsList As New List(Of SourceGame.track) + Dim SettingsFile As String = Path.Combine(Game.libraryname, "TrackSettings.xml") For Each Track In Game.tracks - If Not String.IsNullOrEmpty(Track.hotkey) Then + If Not String.IsNullOrEmpty(Track.hotkey) Or Not Track.volume = 100 Then - HotKeys.Add(Track.name, Track.hotkey) + SettingsList.Add(Track) End If Next - If HotKeys.Count > 0 Then - Using writer As StreamWriter = New StreamWriter(HotkeyFile) - writer.Write(Serialize(HotKeys)) + If SettingsList.Count > 0 Then + Using writer As StreamWriter = New StreamWriter(SettingsFile) + writer.Write(Serialize(SettingsList)) End Using Else - If File.Exists(HotkeyFile) Then - File.Delete(HotkeyFile) + If File.Exists(SettingsFile) Then + File.Delete(SettingsFile) End If End If @@ -469,8 +514,36 @@ Public Class Form1 Private Sub TrackList_MouseClick(sender As Object, e As MouseEventArgs) Handles TrackList.MouseClick If e.Button = MouseButtons.Right Then If TrackList.FocusedItem.Bounds.Contains(e.Location) = True Then - TrackContextMenu.Show(Cursor.Position) + + For Each Control In TrackContextMenu.Items 'everything invisible + Control.visible = False + Next + + SetVolumeToolStripMenuItem.Visible = True 'always visible + ContextRefresh.Visible = True + + If TrackList.SelectedItems.Count > 1 Then + If Not running Then 'visible when multiple selected AND is not running + ContextDelete.Visible = True + End If + + Else + If running Then + LoadToolStripMenuItem.Visible = True 'visible when only one selected AND is running + Else + For Each Control In TrackContextMenu.Items 'visible when only one selected AND is not running (all) + Control.visible = True + Next + End If + + End If + 'Maybe I should have used a case... Maybe... + End If + + + + TrackContextMenu.Show(Cursor.Position) End If End Sub @@ -481,17 +554,26 @@ Public Class Form1 Private Sub ContextDelete_Click(sender As Object, e As EventArgs) Handles ContextDelete.Click Dim game As SourceGame = GetCurrentGame() - If MessageBox.Show(String.Format("Are you sure you want to delete {0}?", TrackList.SelectedItems(0).SubItems(1).Text), "Delete Track?", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then - Dim FilePath As String = Path.Combine(game.libraryname, TrackList.SelectedItems(0).SubItems(1).Text & game.FileExtension) + Dim SelectedNames As New List(Of String) + For Each item In TrackList.SelectedItems + SelectedNames.Add(item.SubItems(1).Text) + Next - If File.Exists(FilePath) Then - Try - File.Delete(FilePath) - Catch ex As Exception - MsgBox(String.Format("Failed to delete {0}.", FilePath)) - End Try - End If + If MessageBox.Show(String.Format("Are you sure you want to delete {0}?", String.Join(", ", SelectedNames)), "Delete Track?", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then + + For Each item In SelectedNames + Dim FilePath As String = Path.Combine(game.libraryname, item & game.FileExtension) + + If File.Exists(FilePath) Then + Try + File.Delete(FilePath) + Catch ex As Exception + LogError(ex) + MsgBox(String.Format("Failed to delete {0}.", FilePath)) + End Try + End If + Next End If @@ -508,29 +590,39 @@ Public Class Form1 Dim SelectKeyDialog As New SelectKey Dim SelectedIndex = TrackList.SelectedItems(0).Index If SelectKeyDialog.ShowDialog = Windows.Forms.DialogResult.OK Then + Dim Game = GetCurrentGame() + - For Each Game In Games.ToList - If Game Is GetCurrentGame() Then - Game.tracks(SelectedIndex).hotkey = SelectKeyDialog.ChosenKey - SaveTrackKeys(GetCurrentGame) - ReloadTracks(GetCurrentGame) - RefreshTrackList() + + Dim KeyIsFree As Boolean = True + For Each track In Game.tracks + If track.hotkey = SelectKeyDialog.ChosenKey Then 'Checking to see if any other track is already using this key + KeyIsFree = False End If Next - End If - End Sub - Private Sub RemoveHotkeyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RemoveHotkeyToolStripMenuItem.Click - Dim SelectedIndex = TrackList.SelectedItems(0).Index - For Each Game In Games.ToList - If Game Is GetCurrentGame() Then - Game.tracks(SelectedIndex).hotkey = vbNullString + If KeyIsFree Then + Game.tracks(SelectedIndex).hotkey = SelectKeyDialog.ChosenKey SaveTrackKeys(GetCurrentGame) ReloadTracks(GetCurrentGame) RefreshTrackList() + Else + MessageBox.Show(String.Format("""{0}"" has already been assigned!", SelectKeyDialog.ChosenKey), "Invalid Key") End If + + End If + End Sub + + Private Sub RemoveHotkeyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RemoveHotkeyToolStripMenuItem.Click + For Each SelectedIndex In TrackList.SelectedItems + Dim Game = GetCurrentGame() + Game.tracks(SelectedIndex.index).hotkey = vbNullString + SaveTrackKeys(GetCurrentGame) + ReloadTracks(GetCurrentGame) + Next + RefreshTrackList() End Sub Private Sub GoToToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GoToToolStripMenuItem.Click @@ -544,24 +636,40 @@ Public Class Form1 System.Diagnostics.Process.Start(pfi) End Sub - Private Async Function CheckForUpdate() As Task - Dim UpdateText As String + Private Sub SetVolumeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SetVolumeToolStripMenuItem.Click + Dim SetVolumeDialog As New SetVolume - Using client As New HttpClient - Dim UpdateTextTask As Task(Of String) = client.GetStringAsync("http://slam.flankers.net/updates.php") - UpdateText = Await UpdateTextTask - End Using + If SetVolumeDialog.ShowDialog = Windows.Forms.DialogResult.OK Then - Dim NewVersion As New Version("0.0.0.0") 'generic - Dim UpdateURL As String = UpdateText.Split()(1) - If Version.TryParse(UpdateText.Split()(0), NewVersion) Then - If My.Application.Info.Version.CompareTo(NewVersion) < 0 Then - If MessageBox.Show(String.Format("An update ({0}) is available! Click ""OK"" to be taken to the download page.", NewVersion.ToString), "SLAM Update", MessageBoxButtons.OKCancel) = Windows.Forms.DialogResult.OK Then - Process.Start(UpdateURL) - End If + For Each index In TrackList.SelectedIndices + GetCurrentGame.tracks(index).volume = SetVolumeDialog.Volume + SaveTrackKeys(GetCurrentGame) + ReloadTracks(GetCurrentGame) + RefreshTrackList() + Next + + End If + + End Sub + + Private Async Sub CheckForUpdate() + Dim UpdateText As String + + Using client As New HttpClient + Dim UpdateTextTask As Task(Of String) = client.GetStringAsync("http://slam.flankers.net/updates.php") + UpdateText = Await UpdateTextTask + End Using + + Dim NewVersion As New Version("0.0.0.0") 'generic + Dim UpdateURL As String = UpdateText.Split()(1) + If Version.TryParse(UpdateText.Split()(0), NewVersion) Then + If My.Application.Info.Version.CompareTo(NewVersion) < 0 Then + If MessageBox.Show(String.Format("An update ({0}) is available! Click ""OK"" to be taken to the download page.", NewVersion.ToString), "SLAM Update", MessageBoxButtons.OKCancel) = Windows.Forms.DialogResult.OK Then + Process.Start(UpdateURL) End If End If - End Function + End If + End Sub Private Sub PlayKeyButton_Click(sender As Object, e As EventArgs) Handles PlayKeyButton.Click Dim SelectKeyDialog As New SelectKey @@ -573,7 +681,52 @@ Public Class Form1 End Sub Private Sub RefreshPlayKey() - PlayKeyButton.Text = String.Format("Play key: {0} (change)", My.Settings.PlayKey) + PlayKeyButton.Text = String.Format("Play key: ""{0}"" (change)", My.Settings.PlayKey) + End Sub + + Private Sub LogError(ByVal ex As Exception) + If My.Settings.LogError Then + Using log As StreamWriter = New StreamWriter("log.txt", True) + log.WriteLine("--------------------{0}--------------------", DateTime.Now) + log.WriteLine(ex.ToString) + End Using + End If + End Sub + + Private Sub ChangeDirButton_Click(sender As Object, e As EventArgs) Handles ChangeDirButton.Click + SettingsForm.ShowDialog() + End Sub + + Private Sub DeleteCFGs(ByVal Game As SourceGame) + Dim GameDir As String = Path.Combine(SteamappsPath, Game.directory) + Dim GameCfgFolder As String = Path.Combine(GameDir, Game.ToCfg) + Dim SlamFiles() As String = {"slam.cfg", "slam_tracklist.cfg", "slam_relay.cfg", "slam_curtrack.cfg", "slam_saycurtrack.cfg", "slam_sayteamcurtrack.cfg"} + Dim voicefile As String = Path.Combine(SteamappsPath, Game.directory) & "voice_input.wav" + + + Try + If File.Exists(voicefile) Then + File.Delete(voicefile) + End If + + For Each FileName In SlamFiles + + If File.Exists(GameCfgFolder & FileName) Then + File.Delete(GameCfgFolder & FileName) + End If + + Next + + Catch ex As Exception + LogError(ex) + End Try + + End Sub + + Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing + If running Then + StopPoll() + End If End Sub End Class @@ -589,12 +742,13 @@ Public Class SourceGame Public channels As Integer = 1 Public PollInterval As Integer = 100 - Public RelayKey As String = "=" Public tracks As New List(Of track) + Public blacklist As New List(Of String) From {"slam", "slam_listtracks", "list", "tracks", "la", "slam_play", "slam_play_on", "slam_play_off", "slam_updatecfg", "slam_curtrack", "slam_saycurtrack", "slam_sayteamcurtrack"} Public Class track Public name As String Public tags As New List(Of String) - Public hotkey As String + Public hotkey As String = vbNullString + Public volume As Integer = 100 End Class End Class diff --git a/SLAM/My Project/Application.myapp b/SLAM/My Project/Application.myapp index 1243847..0f12f32 100644 --- a/SLAM/My Project/Application.myapp +++ b/SLAM/My Project/Application.myapp @@ -6,6 +6,5 @@ 0 true 0 - 0 true - + \ No newline at end of file diff --git a/SLAM/My Project/AssemblyInfo.vb b/SLAM/My Project/AssemblyInfo.vb index 84861bc..928d7f3 100644 --- a/SLAM/My Project/AssemblyInfo.vb +++ b/SLAM/My Project/AssemblyInfo.vb @@ -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 fe02b7f..af346bf 100644 --- a/SLAM/My Project/Settings.Designer.vb +++ b/SLAM/My Project/Settings.Designer.vb @@ -101,6 +101,66 @@ Namespace My Me("NoHint") = value End Set End Property + + _ + Public Property UpdateCheck() As Boolean + Get + Return CType(Me("UpdateCheck"),Boolean) + End Get + Set + Me("UpdateCheck") = value + End Set + End Property + + _ + Public Property LogError() As Boolean + Get + Return CType(Me("LogError"),Boolean) + End Get + Set + Me("LogError") = value + End Set + End Property + + _ + Public Property StartEnabled() As Boolean + Get + Return CType(Me("StartEnabled"),Boolean) + End Get + Set + Me("StartEnabled") = value + End Set + End Property + + _ + Public Property WriteTags() As Boolean + Get + Return CType(Me("WriteTags"),Boolean) + End Get + Set + Me("WriteTags") = value + End Set + End Property + + False + + True + + + True + + + False + + + True + + + = + \ No newline at end of file diff --git a/SLAM/SLAM.vbproj b/SLAM/SLAM.vbproj index c4aa327..e919cb8 100644 --- a/SLAM/SLAM.vbproj +++ b/SLAM/SLAM.vbproj @@ -100,6 +100,12 @@ Form1.vb Form + + SettingsForm.vb + + + Form + True @@ -115,6 +121,12 @@ Settings.settings True + + SetVolume.vb + + + Form + SelectKey.vb @@ -127,12 +139,18 @@ Form1.vb + + SettingsForm.vb + VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources Designer + + SetVolume.vb + SelectKey.vb diff --git a/SLAM/SetVolume.Designer.vb b/SLAM/SetVolume.Designer.vb new file mode 100644 index 0000000..ee7df0d --- /dev/null +++ b/SLAM/SetVolume.Designer.vb @@ -0,0 +1,80 @@ + _ +Partial Class SetVolume + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.SelectButton = New System.Windows.Forms.Button() + Me.VolumeBar = New System.Windows.Forms.TrackBar() + Me.VolumeNumber = New System.Windows.Forms.TextBox() + CType(Me.VolumeBar, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'SelectButton + ' + Me.SelectButton.Location = New System.Drawing.Point(272, 63) + Me.SelectButton.Name = "SelectButton" + Me.SelectButton.Size = New System.Drawing.Size(100, 23) + Me.SelectButton.TabIndex = 1 + Me.SelectButton.Text = "Done" + Me.SelectButton.UseVisualStyleBackColor = True + ' + 'VolumeBar + ' + Me.VolumeBar.Location = New System.Drawing.Point(12, 12) + Me.VolumeBar.Maximum = 20 + Me.VolumeBar.Name = "VolumeBar" + Me.VolumeBar.Size = New System.Drawing.Size(360, 45) + Me.VolumeBar.TabIndex = 3 + Me.VolumeBar.Value = 10 + ' + 'VolumeNumber + ' + Me.VolumeNumber.Location = New System.Drawing.Point(12, 59) + Me.VolumeNumber.MaxLength = 3 + Me.VolumeNumber.Name = "VolumeNumber" + Me.VolumeNumber.Size = New System.Drawing.Size(100, 20) + Me.VolumeNumber.TabIndex = 4 + Me.VolumeNumber.Text = "100" + ' + 'SetVolume + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(384, 91) + Me.Controls.Add(Me.VolumeNumber) + Me.Controls.Add(Me.VolumeBar) + Me.Controls.Add(Me.SelectButton) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "SetVolume" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Volume" + CType(Me.VolumeBar, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents SelectButton As System.Windows.Forms.Button + Friend WithEvents VolumeBar As System.Windows.Forms.TrackBar + Friend WithEvents VolumeNumber As System.Windows.Forms.TextBox +End Class diff --git a/SLAM/SetVolume.resx b/SLAM/SetVolume.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SLAM/SetVolume.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SLAM/SetVolume.vb b/SLAM/SetVolume.vb new file mode 100644 index 0000000..edae732 --- /dev/null +++ b/SLAM/SetVolume.vb @@ -0,0 +1,33 @@ +Public Class SetVolume + + Public Volume As Integer + + Private Sub SelectButton_Click(sender As Object, e As EventArgs) Handles SelectButton.Click + Volume = Convert.ToInt32(VolumeNumber.Text) + DialogResult = Windows.Forms.DialogResult.OK + End Sub + + Private Sub VolumeBar_Scroll(sender As Object, e As EventArgs) Handles VolumeBar.Scroll + VolumeNumber.Text = VolumeBar.Value * 10 + End Sub + + Private Sub VolumeNumber_KeyPress(sender As Object, e As KeyPressEventArgs) Handles VolumeNumber.KeyPress + If Asc(e.KeyChar) <> 8 Then + If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then + e.Handled = True + End If + End If + End Sub + + Private Sub VolumeNumber_TextChanged(sender As Object, e As EventArgs) Handles VolumeNumber.TextChanged + If Not String.IsNullOrEmpty(VolumeNumber.Text) Then + If Convert.ToInt32(VolumeNumber.Text) > 200 Then + VolumeNumber.Text = "200" + VolumeNumber.SelectionStart = VolumeNumber.TextLength + End If + + VolumeBar.Value = Convert.ToInt32(VolumeNumber.Text) / 10 + + End If + End Sub +End Class \ No newline at end of file diff --git a/SLAM/SettingsForm.Designer.vb b/SLAM/SettingsForm.Designer.vb new file mode 100644 index 0000000..8d823fa --- /dev/null +++ b/SLAM/SettingsForm.Designer.vb @@ -0,0 +1,245 @@ + _ +Partial Class SettingsForm + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() + Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel() + Me.VersionLabel = New System.Windows.Forms.ToolStripStatusLabel() + Me.TabPage1 = New System.Windows.Forms.TabPage() + Me.GroupBox3 = New System.Windows.Forms.GroupBox() + Me.ChangeRelayButton = New System.Windows.Forms.Button() + 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.StatusStrip1.SuspendLayout() + Me.TabPage1.SuspendLayout() + Me.GroupBox3.SuspendLayout() + Me.GroupBox2.SuspendLayout() + Me.GroupBox1.SuspendLayout() + Me.TabControl1.SuspendLayout() + Me.SuspendLayout() + ' + 'StatusStrip1 + ' + Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1, Me.VersionLabel}) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 309) + Me.StatusStrip1.Name = "StatusStrip1" + Me.StatusStrip1.Size = New System.Drawing.Size(284, 22) + Me.StatusStrip1.SizingGrip = False + Me.StatusStrip1.TabIndex = 1 + Me.StatusStrip1.Text = "StatusStrip1" + ' + 'ToolStripStatusLabel1 + ' + Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1" + Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(49, 17) + Me.ToolStripStatusLabel1.Text = "Version:" + ' + 'VersionLabel + ' + Me.VersionLabel.Name = "VersionLabel" + Me.VersionLabel.Size = New System.Drawing.Size(31, 17) + Me.VersionLabel.Text = "0.0.0" + ' + 'TabPage1 + ' + Me.TabPage1.Controls.Add(Me.GroupBox3) + Me.TabPage1.Controls.Add(Me.GroupBox2) + Me.TabPage1.Controls.Add(Me.GroupBox1) + Me.TabPage1.Location = New System.Drawing.Point(4, 22) + Me.TabPage1.Name = "TabPage1" + Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) + Me.TabPage1.Size = New System.Drawing.Size(276, 305) + Me.TabPage1.TabIndex = 0 + Me.TabPage1.Text = "General" + Me.TabPage1.UseVisualStyleBackColor = True + ' + 'GroupBox3 + ' + Me.GroupBox3.Controls.Add(Me.ChangeRelayButton) + Me.GroupBox3.Location = New System.Drawing.Point(8, 89) + Me.GroupBox3.Name = "GroupBox3" + Me.GroupBox3.Size = New System.Drawing.Size(260, 52) + Me.GroupBox3.TabIndex = 2 + Me.GroupBox3.TabStop = False + Me.GroupBox3.Text = "Relay Key" + ' + 'ChangeRelayButton + ' + Me.ChangeRelayButton.Location = New System.Drawing.Point(6, 19) + Me.ChangeRelayButton.Name = "ChangeRelayButton" + Me.ChangeRelayButton.Size = New System.Drawing.Size(248, 23) + Me.ChangeRelayButton.TabIndex = 0 + Me.ChangeRelayButton.Text = "Relay key: """"{0}"""" (change)" + Me.ChangeRelayButton.UseVisualStyleBackColor = True + ' + 'GroupBox2 + ' + Me.GroupBox2.Controls.Add(Me.ConTagsCheckBox) + Me.GroupBox2.Controls.Add(Me.StartEnabledCheckBox) + Me.GroupBox2.Controls.Add(Me.LogCheckBox) + Me.GroupBox2.Controls.Add(Me.HintCheckBox) + Me.GroupBox2.Controls.Add(Me.UpdateCheckBox) + Me.GroupBox2.Location = New System.Drawing.Point(8, 147) + Me.GroupBox2.Name = "GroupBox2" + Me.GroupBox2.Size = New System.Drawing.Size(260, 132) + Me.GroupBox2.TabIndex = 2 + Me.GroupBox2.TabStop = False + Me.GroupBox2.Text = "Other" + ' + 'ConTagsCheckBox + ' + Me.ConTagsCheckBox.AutoSize = True + Me.ConTagsCheckBox.Location = New System.Drawing.Point(6, 111) + Me.ConTagsCheckBox.Name = "ConTagsCheckBox" + Me.ConTagsCheckBox.Size = New System.Drawing.Size(101, 17) + Me.ConTagsCheckBox.TabIndex = 5 + Me.ConTagsCheckBox.Text = "Tags in console" + Me.ConTagsCheckBox.UseVisualStyleBackColor = True + ' + 'StartEnabledCheckBox + ' + Me.StartEnabledCheckBox.AutoSize = True + Me.StartEnabledCheckBox.Location = New System.Drawing.Point(6, 88) + Me.StartEnabledCheckBox.Name = "StartEnabledCheckBox" + Me.StartEnabledCheckBox.Size = New System.Drawing.Size(89, 17) + Me.StartEnabledCheckBox.TabIndex = 4 + Me.StartEnabledCheckBox.Text = "Start enabled" + Me.StartEnabledCheckBox.UseVisualStyleBackColor = True + ' + 'LogCheckBox + ' + Me.LogCheckBox.AutoSize = True + Me.LogCheckBox.Location = New System.Drawing.Point(6, 65) + Me.LogCheckBox.Name = "LogCheckBox" + Me.LogCheckBox.Size = New System.Drawing.Size(73, 17) + Me.LogCheckBox.TabIndex = 2 + Me.LogCheckBox.Text = "Log errors" + Me.LogCheckBox.UseVisualStyleBackColor = True + ' + 'HintCheckBox + ' + Me.HintCheckBox.AutoSize = True + Me.HintCheckBox.Location = New System.Drawing.Point(6, 42) + Me.HintCheckBox.Name = "HintCheckBox" + Me.HintCheckBox.Size = New System.Drawing.Size(65, 17) + Me.HintCheckBox.TabIndex = 3 + Me.HintCheckBox.Text = "No hints" + Me.HintCheckBox.UseVisualStyleBackColor = True + ' + 'UpdateCheckBox + ' + Me.UpdateCheckBox.AutoSize = True + Me.UpdateCheckBox.Location = New System.Drawing.Point(6, 19) + Me.UpdateCheckBox.Name = "UpdateCheckBox" + Me.UpdateCheckBox.Size = New System.Drawing.Size(113, 17) + Me.UpdateCheckBox.TabIndex = 2 + 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) + Me.TabControl1.Dock = System.Windows.Forms.DockStyle.Fill + Me.TabControl1.Location = New System.Drawing.Point(0, 0) + Me.TabControl1.Name = "TabControl1" + Me.TabControl1.SelectedIndex = 0 + Me.TabControl1.Size = New System.Drawing.Size(284, 331) + Me.TabControl1.TabIndex = 0 + ' + 'SettingsForm + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(284, 331) + Me.Controls.Add(Me.StatusStrip1) + Me.Controls.Add(Me.TabControl1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "SettingsForm" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Settings" + Me.StatusStrip1.ResumeLayout(False) + Me.StatusStrip1.PerformLayout() + Me.TabPage1.ResumeLayout(False) + Me.GroupBox3.ResumeLayout(False) + Me.GroupBox2.ResumeLayout(False) + Me.GroupBox2.PerformLayout() + Me.GroupBox1.ResumeLayout(False) + Me.GroupBox1.PerformLayout() + Me.TabControl1.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip + Friend WithEvents ToolStripStatusLabel1 As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents VersionLabel As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents TabPage1 As System.Windows.Forms.TabPage + Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox + Friend WithEvents StartEnabledCheckBox As System.Windows.Forms.CheckBox + Friend WithEvents LogCheckBox As System.Windows.Forms.CheckBox + Friend WithEvents HintCheckBox As System.Windows.Forms.CheckBox + Friend WithEvents UpdateCheckBox As System.Windows.Forms.CheckBox + Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox + Friend WithEvents ChangeDirButton As System.Windows.Forms.Button + Friend WithEvents DirText As System.Windows.Forms.TextBox + Friend WithEvents TabControl1 As System.Windows.Forms.TabControl + Friend WithEvents ConTagsCheckBox As System.Windows.Forms.CheckBox + Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox + Friend WithEvents ChangeRelayButton As System.Windows.Forms.Button +End Class diff --git a/SLAM/SettingsForm.resx b/SLAM/SettingsForm.resx new file mode 100644 index 0000000..7444364 --- /dev/null +++ b/SLAM/SettingsForm.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/SLAM/SettingsForm.vb b/SLAM/SettingsForm.vb new file mode 100644 index 0000000..8383299 --- /dev/null +++ b/SLAM/SettingsForm.vb @@ -0,0 +1,52 @@ +Public Class SettingsForm + + Private Sub SettingsForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load + VersionLabel.Text = Join({My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build}, ".") + DirText.Text = My.Settings.SteamAppsFolder + UpdateCheckBox.Checked = My.Settings.UpdateCheck + HintCheckBox.Checked = My.Settings.NoHint + LogCheckBox.Checked = My.Settings.LogError + StartEnabledCheckBox.Checked = My.Settings.StartEnabled + ConTagsCheckBox.Checked = My.Settings.WriteTags + ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey) + End Sub + + Private Sub ChangeDirButton_Click(sender As Object, e As EventArgs) Handles ChangeDirButton.Click + Form1.ShowFolderSelector() + DirText.Text = My.Settings.SteamAppsFolder + End Sub + + Private Sub UpdateCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles UpdateCheckBox.CheckedChanged + My.Settings.UpdateCheck = UpdateCheckBox.Checked + My.Settings.Save() + End Sub + + Private Sub HintCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles HintCheckBox.CheckedChanged + My.Settings.NoHint = HintCheckBox.Checked + My.Settings.Save() + End Sub + + Private Sub LogCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles LogCheckBox.CheckedChanged + My.Settings.LogError = LogCheckBox.Checked + My.Settings.Save() + End Sub + + Private Sub StartEnabledCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles StartEnabledCheckBox.CheckedChanged + My.Settings.StartEnabled = StartEnabledCheckBox.Checked + My.Settings.Save() + End Sub + + Private Sub ConTagsCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles ConTagsCheckBox.CheckedChanged + My.Settings.WriteTags = ConTagsCheckBox.Checked + My.Settings.Save() + End Sub + + Private Sub ChangeRelayButton_Click(sender As Object, e As EventArgs) Handles ChangeRelayButton.Click + Dim SelectKeyDialog As New SelectKey + If SelectKeyDialog.ShowDialog = Windows.Forms.DialogResult.OK Then + My.Settings.RelayKey = SelectKeyDialog.ChosenKey + My.Settings.Save() + ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey) + End If + End Sub +End Class \ No newline at end of file