Convert all related operations to use new wine data fields
This commit is contained in:
@@ -1370,8 +1370,14 @@ Public Class frmGameManager
|
||||
oApp.Parameter = txtParameter.Text
|
||||
oApp.OS = CType(cboOS.SelectedValue, clsGame.eOS)
|
||||
oApp.Path = mgrPath.ValidatePathForOS(txtSavePath.Text)
|
||||
'Only do a simple root check here in case the user doesn't really understand creating a proper configuration
|
||||
oApp.AbsolutePath = Path.IsPathRooted(oApp.Path)
|
||||
'We need to handle a special case here when working with Windows configurations in Linux
|
||||
If mgrCommon.IsUnix And mgrVariables.CheckForReservedVariables(oApp.Path) And oApp.OS = clsGame.eOS.Windows Then
|
||||
oApp.AbsolutePath = True
|
||||
Else
|
||||
'Only do a simple root check here in case the user doesn't really understand creating a proper configuration
|
||||
oApp.AbsolutePath = Path.IsPathRooted(oApp.Path)
|
||||
End If
|
||||
|
||||
oApp.FileType = txtFileType.Text
|
||||
oApp.ExcludeList = txtExclude.Text
|
||||
oApp.FolderSave = chkFolderSave.Checked
|
||||
|
||||
+61
-11
@@ -167,11 +167,46 @@ Public Class frmMain
|
||||
OperationEnded()
|
||||
End Sub
|
||||
|
||||
Private Function VerifyBackupForOS(ByVal oGame As clsGame, ByRef sPath As String) As Boolean
|
||||
Dim bOSVerified As Boolean
|
||||
|
||||
'Handle Windows configurations in Linux
|
||||
If mgrCommon.IsUnix Then
|
||||
If oGame.OS = clsGame.eOS.Windows Then
|
||||
If mgrVariables.CheckForReservedVariables(oGame.TruePath) Then
|
||||
'Absolute Path
|
||||
Dim oWineData As clsWineData = mgrWineData.DoWineDataGetbyID(oGame.ID)
|
||||
If oWineData.SavePath <> String.Empty Then
|
||||
sPath = oWineData.SavePath
|
||||
bOSVerified = True
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineSavePath, New String() {oGame.Name, oWineData.SavePath}), False)
|
||||
Else
|
||||
bOSVerified = False
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_ErrorNoWineSavePath, oGame.Name), True, ToolTipIcon.Error, True)
|
||||
End If
|
||||
Else
|
||||
'Relative Path
|
||||
bOSVerified = True
|
||||
End If
|
||||
mgrPath.ModWinePathData(oGame)
|
||||
Else
|
||||
'Linux Configuration
|
||||
bOSVerified = True
|
||||
End If
|
||||
Else
|
||||
'Windows
|
||||
bOSVerified = True
|
||||
End If
|
||||
|
||||
Return bOSVerified
|
||||
End Function
|
||||
|
||||
Private Sub RunRestore(ByVal oRestoreList As Hashtable)
|
||||
Dim oGame As clsGame
|
||||
Dim oReadyList As New List(Of clsBackup)
|
||||
Dim oRestoreInfo As clsBackup
|
||||
Dim bTriggerReload As Boolean = False
|
||||
Dim bOSVerified As Boolean
|
||||
Dim bPathVerified As Boolean
|
||||
eCurrentOperation = eOperation.Restore
|
||||
OperationStarted()
|
||||
@@ -179,16 +214,19 @@ Public Class frmMain
|
||||
'Build Restore List
|
||||
For Each de As DictionaryEntry In oRestoreList
|
||||
bPathVerified = False
|
||||
bOSVerified = False
|
||||
oGame = DirectCast(de.Key, clsGame)
|
||||
oRestoreInfo = DirectCast(de.Value, clsBackup)
|
||||
|
||||
bOSVerified = VerifyBackupForOS(oGame, oRestoreInfo.RestorePath)
|
||||
|
||||
If mgrRestore.CheckPath(oRestoreInfo, oGame, bTriggerReload) Then
|
||||
bPathVerified = True
|
||||
Else
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_ErrorRestorePath, oRestoreInfo.Name), False, ToolTipIcon.Error, True)
|
||||
End If
|
||||
|
||||
If bPathVerified Then
|
||||
If bOSVerified And bPathVerified Then
|
||||
If oRestore.CheckRestorePrereq(oRestoreInfo, oGame.CleanFolder) Then
|
||||
oReadyList.Add(oRestoreInfo)
|
||||
End If
|
||||
@@ -212,6 +250,7 @@ Public Class frmMain
|
||||
Private Sub RunManualBackup(ByVal oBackupList As List(Of clsGame))
|
||||
Dim oGame As clsGame
|
||||
Dim bNoAuto As Boolean
|
||||
Dim bOSVerified As Boolean
|
||||
Dim bPathVerified As Boolean
|
||||
Dim oReadyList As New List(Of clsGame)
|
||||
|
||||
@@ -221,11 +260,14 @@ Public Class frmMain
|
||||
'Build Backup List
|
||||
For Each oGame In oBackupList
|
||||
bNoAuto = False
|
||||
bOSVerified = False
|
||||
bPathVerified = False
|
||||
gMonStripStatusButton.Enabled = False
|
||||
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_ManualBackup, oGame.Name), False)
|
||||
|
||||
bOSVerified = VerifyBackupForOS(oGame, oGame.Path)
|
||||
|
||||
If oGame.AbsolutePath = False Then
|
||||
If oGame.ProcessPath = String.Empty Then
|
||||
If mgrCommon.IsProcessNotSearchable(oGame) Then bNoAuto = True
|
||||
@@ -241,7 +283,7 @@ Public Class frmMain
|
||||
bPathVerified = True
|
||||
End If
|
||||
|
||||
If bPathVerified Then
|
||||
If bOSVerified And bPathVerified Then
|
||||
If oBackup.CheckBackupPrereq(oGame) Then
|
||||
oReadyList.Add(oGame)
|
||||
End If
|
||||
@@ -1936,15 +1978,18 @@ Public Class frmMain
|
||||
If bWineProcess Then
|
||||
'Attempt a path conversion if the game configuration is using an absolute windows path that we can convert
|
||||
If mgrVariables.CheckForReservedVariables(oProcess.GameInfo.TruePath) Then
|
||||
Dim sWinePrefix As String = mgrPath.GetWinePrefix(oProcess.FoundProcess)
|
||||
Dim sWineSavePath As String
|
||||
If Not sWinePrefix = String.Empty Then
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WinePrefix, New String() {oProcess.GameInfo.Name, sWinePrefix}), False)
|
||||
sWineSavePath = mgrPath.GetWineSavePath(sWinePrefix, oProcess.GameInfo.TruePath)
|
||||
If Not sWineSavePath = oProcess.GameInfo.TruePath Then
|
||||
oProcess.GameInfo.TruePath = sWineSavePath
|
||||
oProcess.GameInfo.AbsolutePath = True
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineSavePath, New String() {oProcess.GameInfo.Name, sWineSavePath}), False)
|
||||
Dim oWineData As New clsWineData
|
||||
oWineData.MonitorID = oProcess.GameInfo.ID
|
||||
oWineData.Prefix = mgrPath.GetWinePrefix(oProcess.FoundProcess)
|
||||
oWineData.BinaryPath = Path.GetDirectoryName(oProcess.FoundProcess.MainModule.FileName)
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineBinaryPath, New String() {oProcess.GameInfo.Name, oWineData.BinaryPath}), False)
|
||||
If Not oWineData.Prefix = String.Empty Then
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WinePrefix, New String() {oProcess.GameInfo.Name, oWineData.Prefix}), False)
|
||||
oWineData.SavePath = mgrPath.GetWineSavePath(oWineData.Prefix, oProcess.GameInfo.TruePath)
|
||||
If Not oWineData.SavePath = oProcess.GameInfo.TruePath Then
|
||||
oProcess.GameInfo.TruePath = oWineData.SavePath
|
||||
oProcess.WineData = oWineData
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineSavePath, New String() {oProcess.GameInfo.Name, oWineData.SavePath}), False)
|
||||
Else
|
||||
bContinue = False
|
||||
End If
|
||||
@@ -2031,6 +2076,10 @@ Public Class frmMain
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_GameEnded, oProcess.GameInfo.Name), False)
|
||||
If oSettings.TimeTracking Then HandleTimeSpent()
|
||||
If oSettings.SessionTracking Then HandleSession()
|
||||
If Not oProcess.WineData Is Nothing Then
|
||||
oProcess.WineData.MonitorID = oProcess.GameInfo.ID
|
||||
mgrWineData.DoWineDataAddUpdate(oProcess.WineData)
|
||||
End If
|
||||
RunBackup()
|
||||
Else
|
||||
UpdateLog(frmMain_UnknownGameEnded, False)
|
||||
@@ -2045,6 +2094,7 @@ Public Class frmMain
|
||||
bPathDetectionFailure = False
|
||||
sPathDetectionError = String.Empty
|
||||
bCancelledByUser = False
|
||||
oProcess.WineData = Nothing
|
||||
oProcess.StartTime = Now : oProcess.EndTime = Now
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -497,6 +497,7 @@ Public Class mgrPath
|
||||
'Don't use these in Unix
|
||||
If Not mgrCommon.IsUnix Then
|
||||
hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments))
|
||||
hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData))
|
||||
hshFolders.Add(Guid.NewGuid.ToString, Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))
|
||||
End If
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Public Class mgrProcessDetection
|
||||
Private dStartTime As DateTime = Now, dEndTime As DateTime = Now
|
||||
Private lTimeSpent As Long = 0
|
||||
Private oGame As clsGame
|
||||
Private oWineData As clsWineData
|
||||
Private oDuplicateGames As New ArrayList
|
||||
Private bDuplicates As Boolean
|
||||
Private bVerified As Boolean = False
|
||||
@@ -63,6 +64,15 @@ Public Class mgrProcessDetection
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property WineData As clsWineData
|
||||
Get
|
||||
Return oWineData
|
||||
End Get
|
||||
Set(value As clsWineData)
|
||||
oWineData = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Duplicate As Boolean
|
||||
Get
|
||||
Return bDuplicates
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
oWineGame.MonitorID = CStr(dr("MonitorID"))
|
||||
If Not IsDBNull(dr("Prefix")) Then oWineGame.Prefix = CStr(dr("Prefix"))
|
||||
If Not IsDBNull(dr("SavePath")) Then oWineGame.Prefix = CStr(dr("SavePath"))
|
||||
If Not IsDBNull(dr("BinaryPath")) Then oWineGame.Prefix = CStr(dr("BinaryPath"))
|
||||
If Not IsDBNull(dr("SavePath")) Then oWineGame.SavePath = CStr(dr("SavePath"))
|
||||
If Not IsDBNull(dr("BinaryPath")) Then oWineGame.BinaryPath = CStr(dr("BinaryPath"))
|
||||
|
||||
Return oWineGame
|
||||
End Function
|
||||
|
||||
Generated
+19
-1
@@ -3336,6 +3336,15 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to [PARAM] uses a Windows configuration and requires a Wine save path to perform this operation..
|
||||
'''</summary>
|
||||
Friend ReadOnly Property frmMain_ErrorNoWineSavePath() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("frmMain_ErrorNoWineSavePath", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to [PARAM] uses a relative path and has never been detected on this computer..
|
||||
'''</summary>
|
||||
@@ -4056,6 +4065,15 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to [PARAM] Wine Binary Path: [PARAM].
|
||||
'''</summary>
|
||||
Friend ReadOnly Property frmMain_WineBinaryPath() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("frmMain_WineBinaryPath", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to [PARAM] Wine Prefix: [PARAM].
|
||||
'''</summary>
|
||||
@@ -4066,7 +4084,7 @@ Namespace My.Resources
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to [PARAM] Converted Save Path: [PARAM].
|
||||
''' Looks up a localized string similar to [PARAM] Wine Save Path: [PARAM].
|
||||
'''</summary>
|
||||
Friend ReadOnly Property frmMain_WineSavePath() As String
|
||||
Get
|
||||
|
||||
@@ -2207,7 +2207,7 @@
|
||||
<value>[PARAM] Wine Prefix: [PARAM]</value>
|
||||
</data>
|
||||
<data name="frmMain_WineSavePath" xml:space="preserve">
|
||||
<value>[PARAM] Converted Save Path: [PARAM]</value>
|
||||
<value>[PARAM] Wine Save Path: [PARAM]</value>
|
||||
</data>
|
||||
<data name="mgrPath_ErrorBuildingWinePath" xml:space="preserve">
|
||||
<value>An error occured when building a Wine path.[BR][BR][PARAM]</value>
|
||||
@@ -2296,4 +2296,10 @@
|
||||
<data name="frmFilter_FieldOS" xml:space="preserve">
|
||||
<value>OS</value>
|
||||
</data>
|
||||
<data name="frmMain_WineBinaryPath" xml:space="preserve">
|
||||
<value>[PARAM] Wine Binary Path: [PARAM]</value>
|
||||
</data>
|
||||
<data name="frmMain_ErrorNoWineSavePath" xml:space="preserve">
|
||||
<value>[PARAM] uses a Windows configuration and requires a Wine save path to perform this operation.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user