Removed unique DOSBox handling

This commit is contained in:
Michael J. Seiferling
2015-12-01 12:43:58 -06:00
parent 07a4981488
commit b96f797bbf
10 changed files with 213 additions and 458 deletions
+15
View File
@@ -91,6 +91,21 @@ Public Class mgrCommon
Return String.Empty
End Function
Public Shared Function IsProcessNotSearchable(ByVal oGame As clsGame) As Boolean
Dim sExemptList As String() = {"dosbox", "scummvm"}
Dim bFound As Boolean = False
For Each s As String In sExemptList
If oGame.ProcessName.ToLower.Contains(s) Then bFound = True
Next
If bFound Or oGame.Duplicate = True Then
Return True
Else
Return False
End If
End Function
Public Shared Function IsElevated() As Boolean
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
Return True
+1
View File
@@ -121,6 +121,7 @@ Public Class mgrPath
Return sCheckString.Trim
End Function
Public Shared Function DetermineRelativePath(ByVal sProcessPath As String, ByVal sSavePath As String) As String
Dim sPath1Array As String()
Dim sPath2Array As String()
+2 -23
View File
@@ -77,15 +77,7 @@ Public Class mgrProcesses
bDuplicates = True
oDuplicateGames.Clear()
For Each o As clsGame In hshScanList.Values
If o.ProcessName.Contains("dosbox") Then
If o.ProcessName.Split(":").Length = 3 Then
sProcess = o.ProcessName.Remove(o.ProcessName.LastIndexOf(":"))
Else
sProcess = o.ProcessName
End If
Else
sProcess = o.ProcessName.Split(":")(0)
End If
sProcess = o.ProcessName.Split(":")(0)
If o.Duplicate = True And sProcess = oGame.TrueProcess Then
oDuplicateGames.Add(o.ShallowCopy)
@@ -95,23 +87,10 @@ Public Class mgrProcesses
Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef iErrorCode As Integer) As Boolean
Dim prsList() As Process = Process.GetProcesses
Dim sDBoxProcess As String()
Dim sProcessCheck As String = String.Empty
For Each prsCurrent As Process In prsList
'Handle DOSBox Processes
If prsCurrent.ProcessName.ToLower = "dosbox" Then
sDBoxProcess = prsCurrent.MainWindowTitle.Split(":")
'If the dosbox process title doesn't have 3 elements it's not ready yet.
If sDBoxProcess.Length = 3 Then
sProcessCheck = "dosbox:" & sDBoxProcess(2).Trim
Else
'Drop out for now
Return False
End If
Else
sProcessCheck = prsCurrent.ProcessName
End If
sProcessCheck = prsCurrent.ProcessName
If hshScanList.ContainsKey(sProcessCheck) Then
prsFoundProcess = prsCurrent
+1 -1
View File
@@ -37,7 +37,7 @@ Public Class mgrRestore
oRestoreInfo.RelativeRestorePath = oGame.ProcessPath & "\" & oRestoreInfo.RestorePath
Else
sProcess = oGame.TrueProcess
If oGame.Duplicate = True Or oGame.ProcessName.Contains("dosbox") Then bNoAuto = True
If mgrCommon.IsProcessNotSearchable(oGame) Then bNoAuto = True
sRestorePath = mgrPath.ProcessPathSearch(oRestoreInfo.Name, sProcess, oRestoreInfo.Name & " uses a relative path and has never been detected on this computer.", bNoAuto)
If sRestorePath <> String.Empty Then
+56
View File
@@ -326,6 +326,38 @@ Public Class mgrSQLite
End Sub
Public Sub UpgradeDOSBox()
Dim sSQL As String
Dim sCurrentID As String
Dim sCurrentName As String
Dim sCurrentProcess As String
Dim sDosProcess As String
Dim sNewName As String
Dim oData As DataSet
Dim hshParams As Hashtable
Dim oParamList As New List(Of Hashtable)
sSQL = "SELECT MonitorID, Name, Process FROM monitorlist WHERE Process LIKE '%dosbox:%'"
oData = ReadParamData(sSQL, New Hashtable)
sSQL = "UPDATE monitorlist SET Name=@NewName, Process=@NewProcess WHERE MonitorID=@ID;"
For Each dr As DataRow In oData.Tables(0).Rows
hshParams = New Hashtable
sCurrentID = CStr(dr("MonitorID"))
sCurrentName = CStr(dr("Name"))
sCurrentProcess = CStr(dr("Process"))
sDosProcess = sCurrentProcess.Split(":")(1)
sNewName = sCurrentName & " (" & sDosProcess & ")"
hshParams.Add("NewName", sNewName)
hshParams.Add("NewProcess", "DOSBox")
hshParams.Add("ID", sCurrentID)
oParamList.Add(hshParams)
Next
RunMassParamQuery(sSQL, oParamList)
End Sub
Public Sub DatabaseUpgrade()
Dim sSQL As String
@@ -480,6 +512,30 @@ Public Class mgrSQLite
End If
End If
'0.95 Upgrade
If GetDatabaseVersion() < 95 Then
If eDatabase = Database.Local Then
'Backup DB before starting
BackupDB("v94")
UpgradeDOSBox()
sSQL = "PRAGMA user_version=95"
RunParamQuery(sSQL, New Hashtable)
End If
If eDatabase = Database.Remote Then
'Backup DB before starting
BackupDB("v94")
UpgradeDOSBox()
sSQL = "PRAGMA user_version=95"
RunParamQuery(sSQL, New Hashtable)
End If
End If
End Sub
Public Function GetDBSize() As Long