From ca9fef33eaafa9343213f42e2004d4397236de54 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Sat, 5 Mar 2016 15:56:02 -0600 Subject: [PATCH] Fixes for issues #37 and #39 --- GBM/Forms/frmFileFolderSearch.Designer.vb | 17 +++-------------- GBM/Forms/frmFileFolderSearch.vb | 7 ++----- GBM/Forms/frmGameManager.vb | 14 ++++++-------- GBM/Forms/frmMain.vb | 2 +- GBM/Managers/mgrCommon.vb | 4 ++-- GBM/Managers/mgrRestore.vb | 2 +- 6 files changed, 15 insertions(+), 31 deletions(-) diff --git a/GBM/Forms/frmFileFolderSearch.Designer.vb b/GBM/Forms/frmFileFolderSearch.Designer.vb index 0f11111..ebe0bbd 100644 --- a/GBM/Forms/frmFileFolderSearch.Designer.vb +++ b/GBM/Forms/frmFileFolderSearch.Designer.vb @@ -22,23 +22,14 @@ Partial Class frmFileFolderSearch 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.pgbProgress = New System.Windows.Forms.ProgressBar() Me.txtCurrentLocation = New System.Windows.Forms.TextBox() Me.btnCancel = New System.Windows.Forms.Button() Me.bwSearch = New System.ComponentModel.BackgroundWorker() Me.SuspendLayout() ' - 'pgbProgress - ' - Me.pgbProgress.Location = New System.Drawing.Point(12, 12) - Me.pgbProgress.MarqueeAnimationSpeed = 0 - Me.pgbProgress.Name = "pgbProgress" - Me.pgbProgress.Size = New System.Drawing.Size(460, 23) - Me.pgbProgress.TabIndex = 0 - ' 'txtCurrentLocation ' - Me.txtCurrentLocation.Location = New System.Drawing.Point(12, 43) + Me.txtCurrentLocation.Location = New System.Drawing.Point(12, 12) Me.txtCurrentLocation.Name = "txtCurrentLocation" Me.txtCurrentLocation.ReadOnly = True Me.txtCurrentLocation.Size = New System.Drawing.Size(379, 20) @@ -47,7 +38,7 @@ Partial Class frmFileFolderSearch ' 'btnCancel ' - Me.btnCancel.Location = New System.Drawing.Point(397, 41) + Me.btnCancel.Location = New System.Drawing.Point(397, 10) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.TabIndex = 0 @@ -62,10 +53,9 @@ Partial Class frmFileFolderSearch ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(484, 77) + Me.ClientSize = New System.Drawing.Size(484, 46) Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.txtCurrentLocation) - Me.Controls.Add(Me.pgbProgress) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.MaximizeBox = False Me.MinimizeBox = False @@ -77,7 +67,6 @@ Partial Class frmFileFolderSearch Me.PerformLayout() End Sub - Friend WithEvents pgbProgress As System.Windows.Forms.ProgressBar Friend WithEvents txtCurrentLocation As System.Windows.Forms.TextBox Friend WithEvents btnCancel As System.Windows.Forms.Button Friend WithEvents bwSearch As System.ComponentModel.BackgroundWorker diff --git a/GBM/Forms/frmFileFolderSearch.vb b/GBM/Forms/frmFileFolderSearch.vb index f82236c..a6f1149 100644 --- a/GBM/Forms/frmFileFolderSearch.vb +++ b/GBM/Forms/frmFileFolderSearch.vb @@ -60,7 +60,7 @@ Public Class frmFileFolderSearch Try 'Search Current Directory If dir.GetDirectories(sDirectoryName).Length > 0 Then - Return dir.FullName & "\" & sDirectoryName + Return dir.FullName & Path.DirectorySeparatorChar & sDirectoryName End If 'Search Sub Directory @@ -92,7 +92,7 @@ Public Class frmFileFolderSearch Try 'Search Current Directory If dir.GetFiles(sFileName).Length > 0 Then - Return dir.FullName & "\" & sFileName + Return dir.FullName & Path.DirectorySeparatorChar & sFileName End If 'Search Sub Directory @@ -122,8 +122,6 @@ Public Class frmFileFolderSearch End Sub Private Sub Search(ByVal oDrive As DriveInfo) - pgbProgress.Style = ProgressBarStyle.Marquee - pgbProgress.MarqueeAnimationSpeed = 5 oSearchDrive = oDrive.RootDirectory bwSearch.RunWorkerAsync() iCurrentDrive += 1 @@ -131,7 +129,6 @@ Public Class frmFileFolderSearch Private Sub EndSearch() Dim oResult As MsgBoxResult - pgbProgress.MarqueeAnimationSpeed = 0 If FoundItem = "Cancel" Then FoundItem = String.Empty diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 330de97..574ed32 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -469,14 +469,14 @@ Public Class frmGameManager If Not CurrentBackupItem.AbsolutePath Then If CurrentGame.ProcessPath <> String.Empty Then - CurrentBackupItem.RelativeRestorePath = CurrentGame.ProcessPath & "\" & CurrentBackupItem.RestorePath + CurrentBackupItem.RelativeRestorePath = CurrentGame.ProcessPath & Path.DirectorySeparatorChar & CurrentBackupItem.RestorePath Else sProcess = CurrentGame.TrueProcess If mgrCommon.IsProcessNotSearchable(CurrentGame) Then bNoAuto = True sRestorePath = mgrPath.ProcessPathSearch(CurrentBackupItem.Name, sProcess, mgrCommon.FormatString(frmGameManager_ErrorPathNotSet, CurrentBackupItem.Name), bNoAuto) If sRestorePath <> String.Empty Then - CurrentBackupItem.RelativeRestorePath = sRestorePath & "\" & CurrentBackupItem.RestorePath + CurrentBackupItem.RelativeRestorePath = sRestorePath & Path.DirectorySeparatorChar & CurrentBackupItem.RestorePath txtAppPath.Text = sRestorePath Else Return False @@ -557,11 +557,8 @@ Public Class frmGameManager txtFileSize.Text = frmGameManager_ErrorNoBackupExists End If - If oApp.Temporary Then - txtRestorePath.Text = CurrentBackupItem.RestorePath - Else - txtRestorePath.Text = oApp.Path - End If + mgrRestore.DoPathOverride(CurrentBackupItem, oApp) + txtRestorePath.Text = CurrentBackupItem.RestorePath Else txtCurrentBackup.Text = frmGameManager_Never txtFileSize.Text = String.Empty @@ -611,7 +608,7 @@ Public Class frmGameManager 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 + If CurrentBackupItem.FileName.StartsWith(CurrentBackupItem.Name & Path.DirectorySeparatorChar) Then 'Build sub-dir backup path sSubDir = BackupFolder & CurrentBackupItem.Name @@ -838,6 +835,7 @@ Public Class frmGameManager btnAdd.Enabled = True btnDelete.Enabled = False btnBackup.Enabled = False + btnOpenRestorePath.Enabled = False btnTags.Enabled = False lblTags.Visible = False btnInclude.Text = frmGameManager_btnInclude diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 5f905f0..d3f862f 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -97,7 +97,7 @@ Public Class frmMain If oGame.AbsolutePath Then sStatus2 = oGame.Path Else - sStatus2 = oGame.ProcessPath & "\" & oGame.Path + sStatus2 = oGame.ProcessPath & System.IO.Path.DirectorySeparatorChar & oGame.Path End If sStatus3 = String.Empty diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index f8a40dd..b4b345f 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -98,8 +98,8 @@ Public Class mgrCommon Dim sExemptList As String() = {"dosbox", "scummvm"} Dim bFound As Boolean = False - 'frmFileFolderSearch is currently very buggy in Mono, this will disable all searches on Unix - If IsUnix() Then + 'We can't search if we don't have a configuration + If oGame.Temporary Then Return True End If diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index e03e1fa..091f06e 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -28,7 +28,7 @@ Public Class mgrRestore Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event SetLastAction(sMessage As String) - Private Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) + Public Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) 'Always override the manifest restore path with the current configuration path if possible If Not oCheckGame.Temporary Then If Path.IsPathRooted(oCheckGame.Path) Then