diff --git a/GBM/Forms/frmAddWizard.vb b/GBM/Forms/frmAddWizard.vb index fadf86e..bd24eb1 100644 --- a/GBM/Forms/frmAddWizard.vb +++ b/GBM/Forms/frmAddWizard.vb @@ -83,7 +83,7 @@ Public Class frmAddWizard Dim sName As String = txtName.Text Dim sProcessFullPath As String = txtProcessPath.Text 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 sSavePath As String = txtSavePath.Text Dim bIsAbsolute As Boolean = mgrPath.IsAbsolute(sSavePath) @@ -100,6 +100,13 @@ Public Class frmAddWizard sSavePath = mgrPath.DetermineRelativePath(sProcessPath, sSavePath) End If + 'Unix Handler + If mgrCommon.IsUnix Then + sProcess = Path.GetFileName(sProcessFullPath) + Else + sProcess = Path.GetFileNameWithoutExtension(sProcessFullPath) + End If + 'Build Summary Listview lstSummary.Clear() lstSummary.Columns.Add("Item") @@ -178,11 +185,11 @@ Public Class frmAddWizard Return False End If - 'If Path.GetExtension(strPath.ToLower) <> ".exe" Then - ' sErrorMessage = frmAddWizard_ErrorNotAProcess - ' txtProcessPath.Focus() - ' Return False - 'End If + If Path.GetExtension(strPath.ToLower) <> ".exe" And Not mgrCommon.IsUnix Then + sErrorMessage = frmAddWizard_ErrorNotAProcess + txtProcessPath.Focus() + Return False + End If If Not Path.IsPathRooted(strPath) Then sErrorMessage = frmAddWizard_ErrorBadProcessPath diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index b93386b..91d9cab 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -597,7 +597,7 @@ Public Class frmGameManager mgrManifest.DoManifestDelete(CurrentBackupItem, mgrSQLite.Database.Remote) '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) 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 'Confirm 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 Else '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 @@ -942,7 +942,7 @@ Public Class frmGameManager oApp.ID = txtID.Text End If 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 oApp.ProcessName = Path.GetFileNameWithoutExtension(txtProcess.Text) Else @@ -1219,13 +1219,17 @@ Public Class frmGameManager End Sub 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 mgrMonitorList.DoImport(App_URLImport) Then LoadData() End If End If - End Sub Private Sub SetForm() diff --git a/GBM/Forms/frmIncludeExclude.Designer.vb b/GBM/Forms/frmIncludeExclude.Designer.vb index fb70520..73e8c03 100644 --- a/GBM/Forms/frmIncludeExclude.Designer.vb +++ b/GBM/Forms/frmIncludeExclude.Designer.vb @@ -170,7 +170,6 @@ Partial Class frmIncludeExclude ' 'optFileTypes ' - Me.optFileTypes.AutoSize = True Me.optFileTypes.Location = New System.Drawing.Point(6, 19) Me.optFileTypes.Name = "optFileTypes" Me.optFileTypes.Size = New System.Drawing.Size(73, 17) @@ -181,7 +180,6 @@ Partial Class frmIncludeExclude ' 'optIndividualFiles ' - Me.optIndividualFiles.AutoSize = True Me.optIndividualFiles.Location = New System.Drawing.Point(85, 19) Me.optIndividualFiles.Name = "optIndividualFiles" Me.optIndividualFiles.Size = New System.Drawing.Size(94, 17) @@ -250,7 +248,6 @@ Partial Class frmIncludeExclude Me.Text = "Include / Exclude Builder" Me.cmsItems.ResumeLayout(False) Me.grpFileOptions.ResumeLayout(False) - Me.grpFileOptions.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() diff --git a/GBM/Forms/frmIncludeExclude.resx b/GBM/Forms/frmIncludeExclude.resx index 487828b..c7440a4 100644 --- a/GBM/Forms/frmIncludeExclude.resx +++ b/GBM/Forms/frmIncludeExclude.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 - CQAAAk1TRnQBSQFMAgEBAwEAAbABAAGwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CQAAAk1TRnQBSQFMAgEBAwEAAbgBAAG4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 6a9e142..f40ee7e 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -37,6 +37,9 @@ Public Class frmMain Private sPriorCompany As String Private sPriorVersion As String + 'Developer Debug Flags + Private bProcessDebugMode As Boolean = False + WithEvents oFileWatcher As New System.IO.FileSystemWatcher WithEvents tmScanTimer As New Timer @@ -562,6 +565,9 @@ Public Class frmMain 'Parse Command Select Case sMainCommand Case "SQL" + 'Run a SQL command directly on any database + 'Usage: SQL {Local or Remote} SQL Command + Dim oDatabase As mgrSQLite Dim bSuccess As Boolean @@ -590,6 +596,34 @@ Public Class frmMain mgrCommon.ShowMessage(frmMain_CommandFail, MsgBoxStyle.Exclamation) 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 mgrCommon.ShowMessage(frmMain_ErrorCommandInvalid, sMainCommand, MsgBoxStyle.Exclamation) End Select @@ -1434,6 +1468,7 @@ Public Class frmMain If bShutdown = False Then e.Cancel = True If Not mgrCommon.IsUnix Then + bShowToggle = False Me.Visible = False Me.ShowInTaskbar = False End If @@ -1447,7 +1482,7 @@ Public Class frmMain Dim iErrorCode As Integer = 0 Dim sErrorMessage As String = String.Empty - If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, iErrorCode) Then + If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, iErrorCode, bProcessDebugMode) Then PauseScan() If bNeedsPath Then diff --git a/GBM/Forms/frmStartUpWizard.Designer.vb b/GBM/Forms/frmStartUpWizard.Designer.vb index 3617741..36628c1 100644 --- a/GBM/Forms/frmStartUpWizard.Designer.vb +++ b/GBM/Forms/frmStartUpWizard.Designer.vb @@ -96,11 +96,10 @@ Partial Class frmStartUpWizard ' 'llbManual ' - Me.llbManual.AutoSize = True Me.llbManual.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.llbManual.Location = New System.Drawing.Point(14, 158) 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.TabStop = True Me.llbManual.Text = "Game Backup Monitor Manual" diff --git a/GBM/Forms/frmStartUpWizard.vb b/GBM/Forms/frmStartUpWizard.vb index 82de3e7..1020093 100644 --- a/GBM/Forms/frmStartUpWizard.vb +++ b/GBM/Forms/frmStartUpWizard.vb @@ -98,6 +98,12 @@ Public Class frmStartUpWizard End Sub 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 mgrMonitorList.DoImport(App_URLImport) Then oGameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList) diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index f2a7cf9..67d09c8 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -134,12 +134,38 @@ Public Class mgrCommon oProcess.Start() 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 Public Shared Sub SaveText(ByVal sText As String, ByVal sPath As String) Dim oStream As StreamWriter 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.Write(sText) oStream.Flush() diff --git a/GBM/Managers/mgrProcesses.vb b/GBM/Managers/mgrProcesses.vb index 579b0cf..5c0891a 100644 --- a/GBM/Managers/mgrProcesses.vb +++ b/GBM/Managers/mgrProcesses.vb @@ -85,13 +85,17 @@ Public Class mgrProcesses Next 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 sProcessCheck As String = String.Empty + Dim sProcessList As String = String.Empty For Each prsCurrent As Process In prsList + + 'This needs to be wrapped due to issues with Mono. Try - sProcessCheck = prsCurrent.ProcessName + sProcessCheck = prsCurrent.ProcessName + If bDebugMode Then sProcessList &= sProcessCheck & vbCrLf Catch ex As Exception 'Do Nothing End Try @@ -121,12 +125,12 @@ Public Class mgrProcesses bNeedsPath = True iErrorCode = 299 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. Return False End If 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. Return False End Try @@ -143,6 +147,8 @@ Public Class mgrProcesses End If Next + If bDebugMode Then mgrCommon.SaveText(sProcessList, mgrPath.SettingsRoot & "/gbm_process_list.txt") + Return False End Function diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 886862e..5ac6629 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1383,6 +1383,15 @@ Namespace My.Resources End Get End Property + ''' + ''' 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?. + ''' + Friend ReadOnly Property frmGameManager_ConfirmUnixImportWarning() As String + Get + Return ResourceManager.GetString("frmGameManager_ConfirmUnixImportWarning", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Game Backup Monitor Export. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index a09b048..0229203 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1564,4 +1564,7 @@ This function is currently not available on a Unix based operating system. + + 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? + \ No newline at end of file