Added a timed check to verify backup path for #180

This commit is contained in:
Michael J. Seiferling
2019-02-28 08:22:27 -06:00
parent 5ee55ef2ef
commit 64a01c97c5
3 changed files with 24 additions and 13 deletions
+14 -3
View File
@@ -2,6 +2,7 @@
Imports System.IO Imports System.IO
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports System.Reflection Imports System.Reflection
Imports System.Threading.Thread
Public Class mgrPath Public Class mgrPath
'Important Note: Any changes to sSettingsRoot & sDBLocation need to be mirrored in frmMain.vb -> VerifyGameDataPath 'Important Note: Any changes to sSettingsRoot & sDBLocation need to be mirrored in frmMain.vb -> VerifyGameDataPath
@@ -612,9 +613,16 @@ Public Class mgrPath
Public Shared Function VerifyBackupPath(ByRef sBackupPath As String) As Boolean Public Shared Function VerifyBackupPath(ByRef sBackupPath As String) As Boolean
Dim dBrowser As FolderBrowserDialog Dim dBrowser As FolderBrowserDialog
Dim oDialogResult As DialogResult
Dim iTotalWait As Integer
Dim iTimeOut As Integer = 60000
If Not Directory.Exists(sBackupPath) Then Do While Not (Directory.Exists(sBackupPath))
If mgrCommon.ShowMessage(mgrPath_ConfirmBackupLocation, sBackupPath, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Sleep(5000)
iTotalWait += 5000
If iTotalWait >= iTimeOut Then
oDialogResult = mgrCommon.ShowMessage(mgrPath_ConfirmBackupLocation, sBackupPath, MsgBoxStyle.YesNoCancel)
If oDialogResult = MsgBoxResult.Yes Then
dBrowser = New FolderBrowserDialog dBrowser = New FolderBrowserDialog
dBrowser.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) dBrowser.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
If dBrowser.ShowDialog = DialogResult.OK Then If dBrowser.ShowDialog = DialogResult.OK Then
@@ -623,10 +631,13 @@ Public Class mgrPath
Else Else
Return False Return False
End If End If
Else ElseIf oDialogResult = DialogResult.No Then
Return False Return False
Else
iTotalWait = 0
End If End If
End If End If
Loop
Return True Return True
End Function End Function
+1 -1
View File
@@ -6439,7 +6439,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to The backup location [PARAM] is not available.[BR]It may be on an external or network drive that isn&apos;t connected.[BR][BR]Do you want to select another backup location and continue?. ''' Looks up a localized string similar to The backup location [PARAM] is not available.[BR]It may be on an external or network drive that isn&apos;t connected.[BR][BR]Do you want to select another backup location?[BR][BR]Select &quot;No&quot; to quit or &quot;Cancel&quot; to continue waiting for the location to become available..
'''</summary> '''</summary>
Friend ReadOnly Property mgrPath_ConfirmBackupLocation() As String Friend ReadOnly Property mgrPath_ConfirmBackupLocation() As String
Get Get
+1 -1
View File
@@ -1361,7 +1361,7 @@
<value>[PARAM][BR][BR]Do you wish to automatically search for the game path? (Path will be saved)</value> <value>[PARAM][BR][BR]Do you wish to automatically search for the game path? (Path will be saved)</value>
</data> </data>
<data name="mgrPath_ConfirmBackupLocation" xml:space="preserve"> <data name="mgrPath_ConfirmBackupLocation" xml:space="preserve">
<value>The backup location [PARAM] is not available.[BR]It may be on an external or network drive that isn't connected.[BR][BR]Do you want to select another backup location and continue?</value> <value>The backup location [PARAM] is not available.[BR]It may be on an external or network drive that isn't connected.[BR][BR]Do you want to select another backup location?[BR][BR]Select "No" to quit or "Cancel" to continue waiting for the location to become available.</value>
</data> </data>
<data name="mgrPath_ConfirmManualPath" xml:space="preserve"> <data name="mgrPath_ConfirmManualPath" xml:space="preserve">
<value>[PARAM][BR][BR]Do you wish to manually set the game path? (Path will be saved)</value> <value>[PARAM][BR][BR]Do you wish to manually set the game path? (Path will be saved)</value>