More compatability updates

This commit is contained in:
Michael J. Seiferling
2016-03-02 19:15:32 -06:00
parent ca8798a460
commit d46360b244
11 changed files with 115 additions and 23 deletions
+13 -6
View File
@@ -83,7 +83,7 @@ Public Class frmAddWizard
Dim sName As String = txtName.Text Dim sName As String = txtName.Text
Dim sProcessFullPath As String = txtProcessPath.Text Dim sProcessFullPath As String = txtProcessPath.Text
Dim sProcessPath As String = Path.GetDirectoryName(sProcessFullPath) Dim sProcessPath As String = Path.GetDirectoryName(sProcessFullPath)
Dim sProcess As String = Path.GetFileNameWithoutExtension(sProcessFullPath) Dim sProcess As String
Dim sProcessSummaryText As String = Path.GetFileName(sProcessFullPath) & " (" & sProcessPath & ")" Dim sProcessSummaryText As String = Path.GetFileName(sProcessFullPath) & " (" & sProcessPath & ")"
Dim sSavePath As String = txtSavePath.Text Dim sSavePath As String = txtSavePath.Text
Dim bIsAbsolute As Boolean = mgrPath.IsAbsolute(sSavePath) Dim bIsAbsolute As Boolean = mgrPath.IsAbsolute(sSavePath)
@@ -100,6 +100,13 @@ Public Class frmAddWizard
sSavePath = mgrPath.DetermineRelativePath(sProcessPath, sSavePath) sSavePath = mgrPath.DetermineRelativePath(sProcessPath, sSavePath)
End If End If
'Unix Handler
If mgrCommon.IsUnix Then
sProcess = Path.GetFileName(sProcessFullPath)
Else
sProcess = Path.GetFileNameWithoutExtension(sProcessFullPath)
End If
'Build Summary Listview 'Build Summary Listview
lstSummary.Clear() lstSummary.Clear()
lstSummary.Columns.Add("Item") lstSummary.Columns.Add("Item")
@@ -178,11 +185,11 @@ Public Class frmAddWizard
Return False Return False
End If End If
'If Path.GetExtension(strPath.ToLower) <> ".exe" Then If Path.GetExtension(strPath.ToLower) <> ".exe" And Not mgrCommon.IsUnix Then
' sErrorMessage = frmAddWizard_ErrorNotAProcess sErrorMessage = frmAddWizard_ErrorNotAProcess
' txtProcessPath.Focus() txtProcessPath.Focus()
' Return False Return False
'End If End If
If Not Path.IsPathRooted(strPath) Then If Not Path.IsPathRooted(strPath) Then
sErrorMessage = frmAddWizard_ErrorBadProcessPath sErrorMessage = frmAddWizard_ErrorBadProcessPath
+9 -5
View File
@@ -597,7 +597,7 @@ Public Class frmGameManager
mgrManifest.DoManifestDelete(CurrentBackupItem, mgrSQLite.Database.Remote) mgrManifest.DoManifestDelete(CurrentBackupItem, mgrSQLite.Database.Remote)
'Delete referenced backup file from the backup folder 'Delete referenced backup file from the backup folder
If File.Exists(BackupFolder & CurrentBackupItem.FileName) Then My.Computer.FileSystem.DeleteFile(BackupFolder & CurrentBackupItem.FileName, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin) mgrCommon.DeleteFile(BackupFolder & CurrentBackupItem.FileName)
'Check if using backup sub-directories (Probably not the best way to check for this) 'Check if using backup sub-directories (Probably not the best way to check for this)
If CurrentBackupItem.FileName.StartsWith(CurrentBackupItem.Name & "\") Then If CurrentBackupItem.FileName.StartsWith(CurrentBackupItem.Name & "\") Then
@@ -610,11 +610,11 @@ Public Class frmGameManager
If oDir.GetDirectories.Length > 0 Or oDir.GetFiles.Length > 0 Then If oDir.GetDirectories.Length > 0 Or oDir.GetFiles.Length > 0 Then
'Confirm 'Confirm
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupFolderDelete, New String() {sSubDir, oDir.GetDirectories.Length, oDir.GetFiles.Length}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupFolderDelete, New String() {sSubDir, oDir.GetDirectories.Length, oDir.GetFiles.Length}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
If Directory.Exists(sSubDir) Then My.Computer.FileSystem.DeleteDirectory(sSubDir, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin) If Directory.Exists(sSubDir) Then mgrCommon.DeleteDirectory(sSubDir, True)
End If End If
Else Else
'Folder is empty, delete the empty sub-folder 'Folder is empty, delete the empty sub-folder
If Directory.Exists(sSubDir) Then My.Computer.FileSystem.DeleteDirectory(sSubDir, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin) If Directory.Exists(sSubDir) Then mgrCommon.DeleteDirectory(sSubDir)
End If End If
End If End If
End If End If
@@ -942,7 +942,7 @@ Public Class frmGameManager
oApp.ID = txtID.Text oApp.ID = txtID.Text
End If End If
oApp.Name = mgrPath.ValidateForFileSystem(txtName.Text) oApp.Name = mgrPath.ValidateForFileSystem(txtName.Text)
If Path.HasExtension(txtProcess.Text) Then If Path.HasExtension(txtProcess.Text) And Not mgrCommon.IsUnix Then
If txtProcess.Text.ToLower.EndsWith(".exe") Then If txtProcess.Text.ToLower.EndsWith(".exe") Then
oApp.ProcessName = Path.GetFileNameWithoutExtension(txtProcess.Text) oApp.ProcessName = Path.GetFileNameWithoutExtension(txtProcess.Text)
Else Else
@@ -1219,13 +1219,17 @@ Public Class frmGameManager
End Sub End Sub
Private Sub ImportOfficialGameList() Private Sub ImportOfficialGameList()
If mgrCommon.IsUnix Then
If mgrCommon.ShowMessage(frmGameManager_ConfirmUnixImportWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
Exit Sub
End If
End If
If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
If mgrMonitorList.DoImport(App_URLImport) Then If mgrMonitorList.DoImport(App_URLImport) Then
LoadData() LoadData()
End If End If
End If End If
End Sub End Sub
Private Sub SetForm() Private Sub SetForm()
-3
View File
@@ -170,7 +170,6 @@ Partial Class frmIncludeExclude
' '
'optFileTypes 'optFileTypes
' '
Me.optFileTypes.AutoSize = True
Me.optFileTypes.Location = New System.Drawing.Point(6, 19) Me.optFileTypes.Location = New System.Drawing.Point(6, 19)
Me.optFileTypes.Name = "optFileTypes" Me.optFileTypes.Name = "optFileTypes"
Me.optFileTypes.Size = New System.Drawing.Size(73, 17) Me.optFileTypes.Size = New System.Drawing.Size(73, 17)
@@ -181,7 +180,6 @@ Partial Class frmIncludeExclude
' '
'optIndividualFiles 'optIndividualFiles
' '
Me.optIndividualFiles.AutoSize = True
Me.optIndividualFiles.Location = New System.Drawing.Point(85, 19) Me.optIndividualFiles.Location = New System.Drawing.Point(85, 19)
Me.optIndividualFiles.Name = "optIndividualFiles" Me.optIndividualFiles.Name = "optIndividualFiles"
Me.optIndividualFiles.Size = New System.Drawing.Size(94, 17) Me.optIndividualFiles.Size = New System.Drawing.Size(94, 17)
@@ -250,7 +248,6 @@ Partial Class frmIncludeExclude
Me.Text = "Include / Exclude Builder" Me.Text = "Include / Exclude Builder"
Me.cmsItems.ResumeLayout(False) Me.cmsItems.ResumeLayout(False)
Me.grpFileOptions.ResumeLayout(False) Me.grpFileOptions.ResumeLayout(False)
Me.grpFileOptions.PerformLayout()
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
+1 -1
View File
@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6
CQAAAk1TRnQBSQFMAgEBAwEAAbABAAGwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CQAAAk1TRnQBSQFMAgEBAwEAAbgBAAG4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
+36 -1
View File
@@ -37,6 +37,9 @@ Public Class frmMain
Private sPriorCompany As String Private sPriorCompany As String
Private sPriorVersion As String Private sPriorVersion As String
'Developer Debug Flags
Private bProcessDebugMode As Boolean = False
WithEvents oFileWatcher As New System.IO.FileSystemWatcher WithEvents oFileWatcher As New System.IO.FileSystemWatcher
WithEvents tmScanTimer As New Timer WithEvents tmScanTimer As New Timer
@@ -562,6 +565,9 @@ Public Class frmMain
'Parse Command 'Parse Command
Select Case sMainCommand Select Case sMainCommand
Case "SQL" Case "SQL"
'Run a SQL command directly on any database
'Usage: SQL {Local or Remote} SQL Command
Dim oDatabase As mgrSQLite Dim oDatabase As mgrSQLite
Dim bSuccess As Boolean Dim bSuccess As Boolean
@@ -590,6 +596,34 @@ Public Class frmMain
mgrCommon.ShowMessage(frmMain_CommandFail, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(frmMain_CommandFail, MsgBoxStyle.Exclamation)
End If End If
Case "DEBUG"
'Enable or disable various debug modes
'Usage: DEBUG Mode {Enable or Disable}
sCommand = sFullCommand.Split(cDelimters, 3)
Dim bDebugEnable As Boolean = False
'Check Paramters
If sCommand.Length < 3 Then
mgrCommon.ShowMessage(frmMain_ErrorMissingParams, sCommand(0), MsgBoxStyle.Exclamation)
Exit Select
End If
If sCommand(2) = "Enable" Then
bDebugEnable = True
ElseIf sCommand(2) = "Disable" Then
bDebugEnable = False
Else
mgrCommon.ShowMessage(frmMain_ErrorCommandBadParam, New String() {sCommand(1), sCommand(0)}, MsgBoxStyle.Exclamation)
Exit Select
End If
Select Case sCommand(1)
Case "Process"
bProcessDebugMode = bDebugEnable
mgrCommon.ShowMessage(frmMain_CommandSucess, MsgBoxStyle.Exclamation)
End Select
Case Else Case Else
mgrCommon.ShowMessage(frmMain_ErrorCommandInvalid, sMainCommand, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(frmMain_ErrorCommandInvalid, sMainCommand, MsgBoxStyle.Exclamation)
End Select End Select
@@ -1434,6 +1468,7 @@ Public Class frmMain
If bShutdown = False Then If bShutdown = False Then
e.Cancel = True e.Cancel = True
If Not mgrCommon.IsUnix Then If Not mgrCommon.IsUnix Then
bShowToggle = False
Me.Visible = False Me.Visible = False
Me.ShowInTaskbar = False Me.ShowInTaskbar = False
End If End If
@@ -1447,7 +1482,7 @@ Public Class frmMain
Dim iErrorCode As Integer = 0 Dim iErrorCode As Integer = 0
Dim sErrorMessage As String = String.Empty Dim sErrorMessage As String = String.Empty
If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, iErrorCode) Then If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, iErrorCode, bProcessDebugMode) Then
PauseScan() PauseScan()
If bNeedsPath Then If bNeedsPath Then
+1 -2
View File
@@ -96,11 +96,10 @@ Partial Class frmStartUpWizard
' '
'llbManual 'llbManual
' '
Me.llbManual.AutoSize = True
Me.llbManual.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.llbManual.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!)
Me.llbManual.Location = New System.Drawing.Point(14, 158) Me.llbManual.Location = New System.Drawing.Point(14, 158)
Me.llbManual.Name = "llbManual" Me.llbManual.Name = "llbManual"
Me.llbManual.Size = New System.Drawing.Size(151, 13) Me.llbManual.Size = New System.Drawing.Size(303, 13)
Me.llbManual.TabIndex = 3 Me.llbManual.TabIndex = 3
Me.llbManual.TabStop = True Me.llbManual.TabStop = True
Me.llbManual.Text = "Game Backup Monitor Manual" Me.llbManual.Text = "Game Backup Monitor Manual"
+6
View File
@@ -98,6 +98,12 @@ Public Class frmStartUpWizard
End Sub End Sub
Private Sub DownloadSettings() Private Sub DownloadSettings()
If mgrCommon.IsUnix Then
If mgrCommon.ShowMessage(frmGameManager_ConfirmUnixImportWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
Exit Sub
End If
End If
If mgrCommon.ShowMessage(frmStartUpWizard_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then If mgrCommon.ShowMessage(frmStartUpWizard_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
If mgrMonitorList.DoImport(App_URLImport) Then If mgrMonitorList.DoImport(App_URLImport) Then
oGameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList) oGameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList)
+27 -1
View File
@@ -134,12 +134,38 @@ Public Class mgrCommon
oProcess.Start() oProcess.Start()
End Sub End Sub
'Delete file based on OS type
Public Shared Sub DeleteFile(ByVal sPath As String, Optional ByVal bRecycle As Boolean = True)
If File.Exists(sPath) Then
If IsUnix() Then
File.Delete(sPath)
Else
If bRecycle Then
My.Computer.FileSystem.DeleteFile(sPath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
Else
File.Delete(sPath)
End If
End If
End If
End Sub
'Delete directory based on OS type
Public Shared Sub DeleteDirectory(ByVal sPath As String, Optional ByVal bRecursive As Boolean = False)
If Directory.Exists(sPath) Then
If IsUnix() Then
Directory.Delete(sPath, bRecursive)
Else
My.Computer.FileSystem.DeleteDirectory(sPath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
End If
End If
End Sub
'Save string as text file 'Save string as text file
Public Shared Sub SaveText(ByVal sText As String, ByVal sPath As String) Public Shared Sub SaveText(ByVal sText As String, ByVal sPath As String)
Dim oStream As StreamWriter Dim oStream As StreamWriter
Try Try
If File.Exists(sPath) Then My.Computer.FileSystem.DeleteFile(sPath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin) If File.Exists(sPath) Then DeleteFile(sPath, False)
oStream = New StreamWriter(sPath) oStream = New StreamWriter(sPath)
oStream.Write(sText) oStream.Write(sText)
oStream.Flush() oStream.Flush()
+10 -4
View File
@@ -85,13 +85,17 @@ Public Class mgrProcesses
Next Next
End Sub End Sub
Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef iErrorCode As Integer) As Boolean Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef iErrorCode As Integer, ByVal bDebugMode As Boolean) As Boolean
Dim prsList() As Process = Process.GetProcesses Dim prsList() As Process = Process.GetProcesses
Dim sProcessCheck As String = String.Empty Dim sProcessCheck As String = String.Empty
Dim sProcessList As String = String.Empty
For Each prsCurrent As Process In prsList For Each prsCurrent As Process In prsList
'This needs to be wrapped due to issues with Mono.
Try Try
sProcessCheck = prsCurrent.ProcessName sProcessCheck = prsCurrent.ProcessName
If bDebugMode Then sProcessList &= sProcessCheck & vbCrLf
Catch ex As Exception Catch ex As Exception
'Do Nothing 'Do Nothing
End Try End Try
@@ -121,12 +125,12 @@ Public Class mgrProcesses
bNeedsPath = True bNeedsPath = True
iErrorCode = 299 iErrorCode = 299
Else Else
MsgBox(exWin32.Message & vbCrLf & exWin32.StackTrace) If bDebugMode Then mgrCommon.ShowMessage(exWin32.NativeErrorCode & " " & exWin32.Message & vbCrLf & vbCrLf & exWin32.StackTrace, MsgBoxStyle.Critical)
'A different failure occured, drop out and continue to scan. 'A different failure occured, drop out and continue to scan.
Return False Return False
End If End If
Catch exAll As Exception Catch exAll As Exception
MsgBox(exAll.Message & vbCrLf & exAll.StackTrace) If bDebugMode Then mgrCommon.ShowMessage(exAll.Message & vbCrLf & vbCrLf & exAll.StackTrace, MsgBoxStyle.Critical)
'A different failure occured, drop out and continue to scan. 'A different failure occured, drop out and continue to scan.
Return False Return False
End Try End Try
@@ -143,6 +147,8 @@ Public Class mgrProcesses
End If End If
Next Next
If bDebugMode Then mgrCommon.SaveText(sProcessList, mgrPath.SettingsRoot & "/gbm_process_list.txt")
Return False Return False
End Function End Function
+9
View File
@@ -1383,6 +1383,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Looks up a localized string similar to You appear to be using a Unix based operating system. The official list currently contains only Microsoft Windows game configurations.[BR][BR]Do you wish to continue?.
'''</summary>
Friend ReadOnly Property frmGameManager_ConfirmUnixImportWarning() As String
Get
Return ResourceManager.GetString("frmGameManager_ConfirmUnixImportWarning", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Game Backup Monitor Export. ''' Looks up a localized string similar to Game Backup Monitor Export.
'''</summary> '''</summary>
+3
View File
@@ -1564,4 +1564,7 @@
<data name="App_ErrorUnixNotAvailable" xml:space="preserve"> <data name="App_ErrorUnixNotAvailable" xml:space="preserve">
<value>This function is currently not available on a Unix based operating system.</value> <value>This function is currently not available on a Unix based operating system.</value>
</data> </data>
<data name="frmGameManager_ConfirmUnixImportWarning" xml:space="preserve">
<value>You appear to be using a Unix based operating system. The official list currently contains only Microsoft Windows game configurations.[BR][BR]Do you wish to continue?</value>
</data>
</root> </root>