This commit is contained in:
Michael J. Seiferling
2019-02-27 19:02:31 -06:00
parent b7eaec2dca
commit 0b7d382f0f
5 changed files with 51 additions and 26 deletions
+31 -24
View File
@@ -127,32 +127,39 @@ Public Class mgrBackup
'Verify saved game path 'Verify saved game path
sSavePath = VerifySavePath(oGame) sSavePath = VerifySavePath(oGame)
'Calculate space 'When the backup folder is using a UNC path, skip the disk space check because we can't do it properly.
lAvailableSpace = mgrCommon.GetAvailableDiskSpace(oSettings.BackupFolder) If Not mgrPath.IsPathUNC(oSettings.BackupFolder) Then
'If any includes are using a deep path and we aren't using recursion, we need to go directly to folders to do file size calculations or they will be missed. 'Calculate space
If Not oGame.RecurseSubFolders Then lAvailableSpace = mgrCommon.GetAvailableDiskSpace(oSettings.BackupFolder)
For Each s As String In oGame.IncludeArray
If s.Contains(Path.DirectorySeparatorChar) Then 'If any includes are using a deep path and we aren't using recursion, we need to go directly to folders to do file size calculations or they will be missed.
sDeepFolder = Path.GetDirectoryName(sSavePath & Path.DirectorySeparatorChar & s) If Not oGame.RecurseSubFolders Then
If Directory.Exists(sDeepFolder) Then For Each s As String In oGame.IncludeArray
lFolderSize += mgrCommon.GetFolderSize(sDeepFolder, oGame.IncludeArray, oGame.ExcludeArray, oGame.RecurseSubFolders) If s.Contains(Path.DirectorySeparatorChar) Then
sDeepFolder = Path.GetDirectoryName(sSavePath & Path.DirectorySeparatorChar & s)
If Directory.Exists(sDeepFolder) Then
lFolderSize += mgrCommon.GetFolderSize(sDeepFolder, oGame.IncludeArray, oGame.ExcludeArray, oGame.RecurseSubFolders)
End If
End If End If
End If Next
Next
End If
lFolderSize += mgrCommon.GetFolderSize(sSavePath, oGame.IncludeArray, oGame.ExcludeArray, oGame.RecurseSubFolders)
'Show Available Space
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_AvailableDiskSpace, mgrCommon.FormatDiskSpace(lAvailableSpace)), False, ToolTipIcon.Info, True)
'Show Save Folder Size
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_SavedGameFolderSize, New String() {oGame.Name, mgrCommon.FormatDiskSpace(lFolderSize)}), False, ToolTipIcon.Info, True)
If lFolderSize >= lAvailableSpace Then
If mgrCommon.ShowMessage(mgrBackup_ConfirmDiskSpace, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
RaiseEvent UpdateLog(mgrBackup_ErrorDiskSpace, False, ToolTipIcon.Error, True)
Return False
End If End If
lFolderSize += mgrCommon.GetFolderSize(sSavePath, oGame.IncludeArray, oGame.ExcludeArray, oGame.RecurseSubFolders)
'Show Available Space
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_AvailableDiskSpace, mgrCommon.FormatDiskSpace(lAvailableSpace)), False, ToolTipIcon.Info, True)
'Show Save Folder Size
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_SavedGameFolderSize, New String() {oGame.Name, mgrCommon.FormatDiskSpace(lFolderSize)}), False, ToolTipIcon.Info, True)
If lFolderSize >= lAvailableSpace Then
If mgrCommon.ShowMessage(mgrBackup_ConfirmDiskSpace, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
RaiseEvent UpdateLog(mgrBackup_ErrorDiskSpace, False, ToolTipIcon.Error, True)
Return False
End If
End If
Else
'Show that disk space check was skipped
RaiseEvent UpdateLog(mgrBackup_ErrorBackupPathIsUNC, False, ToolTipIcon.Info, True)
End If End If
'A manifest check is only required when "Save Multiple Backups" is disabled 'A manifest check is only required when "Save Multiple Backups" is disabled
+2 -2
View File
@@ -117,9 +117,9 @@ Public Class mgrCommon
End If End If
Return fbBrowser.FileName Return fbBrowser.FileName
End If End If
Return String.Empty Return String.Empty
End Function End Function
Private Shared Function BuildFileBrowser(ByVal sName As String, ByVal sTitle As String, ByVal sExtension As String, ByVal sFileType As String, ByVal sDefaultFolder As String, Private Shared Function BuildFileBrowser(ByVal sName As String, ByVal sTitle As String, ByVal sExtension As String, ByVal sFileType As String, ByVal sDefaultFolder As String,
+6
View File
@@ -484,6 +484,12 @@ Public Class mgrPath
Return sValue Return sValue
End Function End Function
Public Shared Function IsPathUNC(sPath As String) As Boolean
Dim sPrefix As String = Path.DirectorySeparatorChar & Path.DirectorySeparatorChar
If sPath.StartsWith(sPrefix) Then Return True
Return False
End Function
Public Shared Function IsAbsolute(sValue As String) As Boolean Public Shared Function IsAbsolute(sValue As String) As Boolean
Dim hshFolders As New Hashtable Dim hshFolders As New Hashtable
Dim hshCustomVariables As Hashtable = mgrVariables.ReadVariables Dim hshCustomVariables As Hashtable = mgrVariables.ReadVariables
+9
View File
@@ -6006,6 +6006,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Looks up a localized string similar to The backup folder is a UNC path. The disk space check has been skipped..
'''</summary>
Friend ReadOnly Property mgrBackup_ErrorBackupPathIsUNC() As String
Get
Return ResourceManager.GetString("mgrBackup_ErrorBackupPathIsUNC", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Backup aborted due to lack of disk space.. ''' Looks up a localized string similar to Backup aborted due to lack of disk space..
'''</summary> '''</summary>
+3
View File
@@ -2335,4 +2335,7 @@
<data name="App_ErrorLaunchExternal" xml:space="preserve"> <data name="App_ErrorLaunchExternal" xml:space="preserve">
<value>An error occured attempting to launch the application:[BR][BR][PARAM]</value> <value>An error occured attempting to launch the application:[BR][BR][PARAM]</value>
</data> </data>
<data name="mgrBackup_ErrorBackupPathIsUNC" xml:space="preserve">
<value>The backup folder is a UNC path. The disk space check has been skipped.</value>
</data>
</root> </root>