diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index ab1a6b0..df020ab 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -390,7 +390,7 @@ Public Class frmGameManager lstGames.BeginUpdate() lstGames.DataSource = oList lstGames.EndUpdate() - + lstGames.ClearSelected() IsLoading = False End Sub @@ -997,7 +997,6 @@ Public Class frmGameManager IsDirty = False LoadData() ModeChange() - lstGames.ClearSelected() If eCurrentMode = eModes.View Then lstGames.SelectedValue = oApp.ID End If End Sub @@ -1034,13 +1033,15 @@ Public Class frmGameManager End Sub Private Sub SwitchApp() - If lstGames.SelectedItems.Count = 1 Then - eCurrentMode = eModes.View - FillData() - ModeChange() - ElseIf lstGames.SelectedItems.Count > 1 Then - eCurrentMode = eModes.MultiSelect - ModeChange() + If Not bIsLoading Then + If lstGames.SelectedItems.Count = 1 Then + eCurrentMode = eModes.View + FillData() + ModeChange() + ElseIf lstGames.SelectedItems.Count > 1 Then + eCurrentMode = eModes.MultiSelect + ModeChange() + End If End If End Sub @@ -1312,6 +1313,7 @@ Public Class frmGameManager AssignDirtyHandlersMisc() LoadData(False) + ModeChange() End Sub Private Sub lstGames_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstGames.SelectedIndexChanged diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 01332df..be77db4 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -833,7 +833,14 @@ Public Class frmMain Private Sub ToggleLog() If bLogToggle = False Then txtLog.Visible = True - Me.Size = New System.Drawing.Size(Me.Size.Width, 440) + + 'Unix Handler + If mgrCommon.IsUnix Then + Me.Size = New System.Drawing.Size(Me.Size.Width, 440) + Else + Me.Size = New System.Drawing.Size(Me.Size.Width, 425) + End If + bLogToggle = True btnLogToggle.Text = frmMain_btnToggleLog_Hide txtLog.Select(txtLog.TextLength, 0) diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 67d09c8..f8a40dd 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -98,6 +98,11 @@ Public Class mgrCommon Dim sExemptList As String() = {"dosbox", "scummvm"} Dim bFound As Boolean = False + 'frmFileFolderSearch is currently very buggy in Mono, this will disable all searches on Unix + If IsUnix() Then + Return True + End If + For Each s As String In sExemptList If oGame.ProcessName.ToLower.Contains(s) Then bFound = True Next diff --git a/GBM/Managers/mgrPath.vb b/GBM/Managers/mgrPath.vb index d863d1a..3d46477 100644 --- a/GBM/Managers/mgrPath.vb +++ b/GBM/Managers/mgrPath.vb @@ -125,10 +125,14 @@ Public Class mgrPath Dim bDeep As Boolean Dim cDS As Char = Path.DirectorySeparatorChar 'Set the directory seperator based on the OS - 'If we are working with a case insenstive file system, use a uniform case. **Look into removing this completely** - If cDS <> "/" Then 'Checking the seperator to determine OS is better than messing with enumerations that weren't always supported + If Not mgrCommon.IsUnix Then + 'If we are working with a case insenstive file system, use a uniform case to reduce possible issues sProcessPath = sProcessPath.ToLower sSavePath = sSavePath.ToLower + Else + 'If we are on Unix trim the root off + sProcessPath = sProcessPath.TrimStart(cDS) + sSavePath = sSavePath.TrimStart(cDS) End If 'We need to ensure we have a single trailing slash on the parameters @@ -137,6 +141,7 @@ Public Class mgrPath sProcessPath &= cDS sSavePath &= cDS + 'Determines the direction we need to go, we always want to be relative to the process location If sSavePath.Split(cDS).Length > sProcessPath.Split(cDS).Length Then sPath1 = sProcessPath @@ -196,10 +201,6 @@ Public Class mgrPath Dim oCustomVariable As clsPathVariable - If sValue.Contains("*mydocs*") Then - Return sValue.Replace("*mydocs*", sMyDocs) - End If - If sValue.Contains("*appdatalocal*") Then Return sValue.Replace("*appdatalocal*", sAppDataLocal) End If @@ -208,8 +209,12 @@ Public Class mgrPath Return sValue.Replace("*appdataroaming*", sAppDataRoaming) End If - 'These don't work on Unix OS + 'Don't use these in Unix If Not mgrCommon.IsUnix Then + If sValue.Contains("*mydocs*") Then + Return sValue.Replace("*mydocs*", sMyDocs) + End If + If sValue.Contains("*publicdocs*") Then Return sValue.Replace("*publicdocs*", sPublicDocs) End If @@ -236,10 +241,7 @@ Public Class mgrPath Dim sCurrentUser As String = "*currentuser*" Dim oCustomVariable As clsPathVariable - If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) Then - Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), sMyDocs) - End If - + If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)) Then Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), sAppDataLocal) End If @@ -248,8 +250,12 @@ Public Class mgrPath Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), sAppDataRoaming) End If - 'These don't work on Unix OS + 'Don't use these in Unix If Not mgrCommon.IsUnix Then + If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) Then + Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), sMyDocs) + End If + If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)) Then Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), sPublicDocs) End If @@ -273,11 +279,16 @@ Public Class mgrPath Dim hshCustomVariables As Hashtable = mgrVariables.ReadVariables Dim oCustomVariable As clsPathVariable - hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) - hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)) + hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)) hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)) - hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)) + + 'Don't use these in Unix + If Not mgrCommon.IsUnix Then + hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) + hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)) + hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)) + End If 'Load Custom Variables For Each oCustomVariable In hshCustomVariables.Values diff --git a/GBM/Managers/mgrProcesses.vb b/GBM/Managers/mgrProcesses.vb index f3b149d..05fbdbd 100644 --- a/GBM/Managers/mgrProcesses.vb +++ b/GBM/Managers/mgrProcesses.vb @@ -85,7 +85,7 @@ Public Class mgrProcesses Next End Sub - 'This function will only works correctly on Unix + 'This function will only work correctly on Unix Private Function GetUnixProcessArguments(ByVal prs As Process) As String() Dim sArguments As String Try @@ -96,8 +96,8 @@ Public Class mgrProcesses End Try End Function - 'This function will only works correctly on Unix - Private Function GetUnixProcessWorkingDirectory(ByVal prs As Process) As String + 'This function will only work correctly on Unix + Private Function GetUnixSymLinkDirectory(ByVal prs As Process) As String Dim prsls As Process Dim slsinfo As String() @@ -110,7 +110,7 @@ Public Class mgrProcesses prsls.StartInfo.RedirectStandardOutput = True prsls.StartInfo.CreateNoWindow = True prsls.Start() - slsinfo = prsls.StandardOutput.ReadToEnd().Split(" ") + slsinfo = prsls.StandardOutput.ReadToEnd().Split(New Char() {" "}, 12) Return slsinfo(slsinfo.Length - 1).TrimEnd Catch ex As Exception Return String.Empty @@ -165,7 +165,7 @@ Public Class mgrProcesses If Not bWineProcess Then oGame.ProcessPath = Path.GetDirectoryName(prsCurrent.MainModule.FileName) Else - oGame.ProcessPath = GetUnixProcessWorkingDirectory(prsCurrent) + oGame.ProcessPath = GetUnixSymLinkDirectory(prsCurrent) End If Catch exWin32 As System.ComponentModel.Win32Exception 'If an exception occurs the process is: