Unix path fixes and search lock out

This commit is contained in:
Michael J. Seiferling
2016-03-03 15:22:47 -06:00
parent feb8a9d0b2
commit 0cafd00bf3
5 changed files with 55 additions and 30 deletions
+4 -2
View File
@@ -390,7 +390,7 @@ Public Class frmGameManager
lstGames.BeginUpdate() lstGames.BeginUpdate()
lstGames.DataSource = oList lstGames.DataSource = oList
lstGames.EndUpdate() lstGames.EndUpdate()
lstGames.ClearSelected()
IsLoading = False IsLoading = False
End Sub End Sub
@@ -997,7 +997,6 @@ Public Class frmGameManager
IsDirty = False IsDirty = False
LoadData() LoadData()
ModeChange() ModeChange()
lstGames.ClearSelected()
If eCurrentMode = eModes.View Then lstGames.SelectedValue = oApp.ID If eCurrentMode = eModes.View Then lstGames.SelectedValue = oApp.ID
End If End If
End Sub End Sub
@@ -1034,6 +1033,7 @@ Public Class frmGameManager
End Sub End Sub
Private Sub SwitchApp() Private Sub SwitchApp()
If Not bIsLoading Then
If lstGames.SelectedItems.Count = 1 Then If lstGames.SelectedItems.Count = 1 Then
eCurrentMode = eModes.View eCurrentMode = eModes.View
FillData() FillData()
@@ -1042,6 +1042,7 @@ Public Class frmGameManager
eCurrentMode = eModes.MultiSelect eCurrentMode = eModes.MultiSelect
ModeChange() ModeChange()
End If End If
End If
End Sub End Sub
Private Function CoreValidatation(ByVal oApp As clsGame) As Boolean Private Function CoreValidatation(ByVal oApp As clsGame) As Boolean
@@ -1312,6 +1313,7 @@ Public Class frmGameManager
AssignDirtyHandlersMisc() AssignDirtyHandlersMisc()
LoadData(False) LoadData(False)
ModeChange()
End Sub End Sub
Private Sub lstGames_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstGames.SelectedIndexChanged Private Sub lstGames_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstGames.SelectedIndexChanged
+7
View File
@@ -833,7 +833,14 @@ Public Class frmMain
Private Sub ToggleLog() Private Sub ToggleLog()
If bLogToggle = False Then If bLogToggle = False Then
txtLog.Visible = True txtLog.Visible = True
'Unix Handler
If mgrCommon.IsUnix Then
Me.Size = New System.Drawing.Size(Me.Size.Width, 440) 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 bLogToggle = True
btnLogToggle.Text = frmMain_btnToggleLog_Hide btnLogToggle.Text = frmMain_btnToggleLog_Hide
txtLog.Select(txtLog.TextLength, 0) txtLog.Select(txtLog.TextLength, 0)
+5
View File
@@ -98,6 +98,11 @@ Public Class mgrCommon
Dim sExemptList As String() = {"dosbox", "scummvm"} Dim sExemptList As String() = {"dosbox", "scummvm"}
Dim bFound As Boolean = False 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 For Each s As String In sExemptList
If oGame.ProcessName.ToLower.Contains(s) Then bFound = True If oGame.ProcessName.ToLower.Contains(s) Then bFound = True
Next Next
+24 -13
View File
@@ -125,10 +125,14 @@ Public Class mgrPath
Dim bDeep As Boolean Dim bDeep As Boolean
Dim cDS As Char = Path.DirectorySeparatorChar 'Set the directory seperator based on the OS 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 Not mgrCommon.IsUnix Then
If cDS <> "/" Then 'Checking the seperator to determine OS is better than messing with enumerations that weren't always supported 'If we are working with a case insenstive file system, use a uniform case to reduce possible issues
sProcessPath = sProcessPath.ToLower sProcessPath = sProcessPath.ToLower
sSavePath = sSavePath.ToLower sSavePath = sSavePath.ToLower
Else
'If we are on Unix trim the root off
sProcessPath = sProcessPath.TrimStart(cDS)
sSavePath = sSavePath.TrimStart(cDS)
End If End If
'We need to ensure we have a single trailing slash on the parameters 'We need to ensure we have a single trailing slash on the parameters
@@ -137,6 +141,7 @@ Public Class mgrPath
sProcessPath &= cDS sProcessPath &= cDS
sSavePath &= cDS sSavePath &= cDS
'Determines the direction we need to go, we always want to be relative to the process location '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 If sSavePath.Split(cDS).Length > sProcessPath.Split(cDS).Length Then
sPath1 = sProcessPath sPath1 = sProcessPath
@@ -196,10 +201,6 @@ Public Class mgrPath
Dim oCustomVariable As clsPathVariable Dim oCustomVariable As clsPathVariable
If sValue.Contains("*mydocs*") Then
Return sValue.Replace("*mydocs*", sMyDocs)
End If
If sValue.Contains("*appdatalocal*") Then If sValue.Contains("*appdatalocal*") Then
Return sValue.Replace("*appdatalocal*", sAppDataLocal) Return sValue.Replace("*appdatalocal*", sAppDataLocal)
End If End If
@@ -208,8 +209,12 @@ Public Class mgrPath
Return sValue.Replace("*appdataroaming*", sAppDataRoaming) Return sValue.Replace("*appdataroaming*", sAppDataRoaming)
End If End If
'These don't work on Unix OS 'Don't use these in Unix
If Not mgrCommon.IsUnix Then If Not mgrCommon.IsUnix Then
If sValue.Contains("*mydocs*") Then
Return sValue.Replace("*mydocs*", sMyDocs)
End If
If sValue.Contains("*publicdocs*") Then If sValue.Contains("*publicdocs*") Then
Return sValue.Replace("*publicdocs*", sPublicDocs) Return sValue.Replace("*publicdocs*", sPublicDocs)
End If End If
@@ -236,9 +241,6 @@ Public Class mgrPath
Dim sCurrentUser As String = "*currentuser*" Dim sCurrentUser As String = "*currentuser*"
Dim oCustomVariable As clsPathVariable 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 If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)) Then
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), sAppDataLocal) Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), sAppDataLocal)
@@ -248,8 +250,12 @@ Public Class mgrPath
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), sAppDataRoaming) Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), sAppDataRoaming)
End If End If
'These don't work on Unix OS 'Don't use these in Unix
If Not mgrCommon.IsUnix Then 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 If sValue.Contains(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)) Then
Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), sPublicDocs) Return sValue.Replace(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), sPublicDocs)
End If End If
@@ -273,11 +279,16 @@ Public Class mgrPath
Dim hshCustomVariables As Hashtable = mgrVariables.ReadVariables Dim hshCustomVariables As Hashtable = mgrVariables.ReadVariables
Dim oCustomVariable As clsPathVariable 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.ApplicationData))
hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)) hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData))
'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)) hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))
End If
'Load Custom Variables 'Load Custom Variables
For Each oCustomVariable In hshCustomVariables.Values For Each oCustomVariable In hshCustomVariables.Values
+5 -5
View File
@@ -85,7 +85,7 @@ Public Class mgrProcesses
Next Next
End Sub 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() Private Function GetUnixProcessArguments(ByVal prs As Process) As String()
Dim sArguments As String Dim sArguments As String
Try Try
@@ -96,8 +96,8 @@ Public Class mgrProcesses
End Try End Try
End Function End Function
'This function will only works correctly on Unix 'This function will only work correctly on Unix
Private Function GetUnixProcessWorkingDirectory(ByVal prs As Process) As String Private Function GetUnixSymLinkDirectory(ByVal prs As Process) As String
Dim prsls As Process Dim prsls As Process
Dim slsinfo As String() Dim slsinfo As String()
@@ -110,7 +110,7 @@ Public Class mgrProcesses
prsls.StartInfo.RedirectStandardOutput = True prsls.StartInfo.RedirectStandardOutput = True
prsls.StartInfo.CreateNoWindow = True prsls.StartInfo.CreateNoWindow = True
prsls.Start() prsls.Start()
slsinfo = prsls.StandardOutput.ReadToEnd().Split(" ") slsinfo = prsls.StandardOutput.ReadToEnd().Split(New Char() {" "}, 12)
Return slsinfo(slsinfo.Length - 1).TrimEnd Return slsinfo(slsinfo.Length - 1).TrimEnd
Catch ex As Exception Catch ex As Exception
Return String.Empty Return String.Empty
@@ -165,7 +165,7 @@ Public Class mgrProcesses
If Not bWineProcess Then If Not bWineProcess Then
oGame.ProcessPath = Path.GetDirectoryName(prsCurrent.MainModule.FileName) oGame.ProcessPath = Path.GetDirectoryName(prsCurrent.MainModule.FileName)
Else Else
oGame.ProcessPath = GetUnixProcessWorkingDirectory(prsCurrent) oGame.ProcessPath = GetUnixSymLinkDirectory(prsCurrent)
End If End If
Catch exWin32 As System.ComponentModel.Win32Exception Catch exWin32 As System.ComponentModel.Win32Exception
'If an exception occurs the process is: 'If an exception occurs the process is: