Fixed issues #104 and #105

This commit is contained in:
MikeMaximus
2017-11-18 10:01:35 -06:00
parent 3e913cc091
commit c4a7f9bb2c
2 changed files with 30 additions and 13 deletions
+28 -11
View File
@@ -85,14 +85,38 @@ Public Class mgrBackup
End Try End Try
End Sub End Sub
Private Function VerifySavePath(ByVal oGame As clsGame) As String
Dim sSavePath As String
If oGame.AbsolutePath = False Then
If oGame.Path <> String.Empty Then
sSavePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oGame.Path
Else
sSavePath = oGame.ProcessPath
End If
Else
sSavePath = oGame.Path
End If
Return sSavePath
End Function
Public Function CheckBackupPrereq(ByVal oGame As clsGame) As Boolean Public Function CheckBackupPrereq(ByVal oGame As clsGame) As Boolean
Dim sBackupFile As String = oSettings.BackupFolder Dim sBackupFile As String = oSettings.BackupFolder
Dim lAvailableSpace As Long = mgrCommon.GetAvailableDiskSpace(sBackupFile) Dim sSavePath As String
Dim lFolderSize As Long = mgrCommon.GetFolderSize(oGame.Path, oGame.IncludeArray, oGame.ExcludeArray) Dim lAvailableSpace As Long
Dim lFolderSize As Long
If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & ".7z" sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & ".7z"
'Verify saved game path
sSavePath = VerifySavePath(oGame)
'Calculate space
lAvailableSpace = mgrCommon.GetAvailableDiskSpace(sBackupFile)
lFolderSize = mgrCommon.GetFolderSize(sSavePath, oGame.IncludeArray, oGame.ExcludeArray)
'Show Available Space 'Show Available Space
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_AvailableDiskSpace, mgrCommon.FormatDiskSpace(lAvailableSpace)), False, ToolTipIcon.Info, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_AvailableDiskSpace, mgrCommon.FormatDiskSpace(lAvailableSpace)), False, ToolTipIcon.Info, True)
@@ -194,15 +218,8 @@ Public Class mgrBackup
End If End If
If bDoBackup Then If bDoBackup Then
If oGame.AbsolutePath = False Then
If oGame.Path <> String.Empty Then sSavePath = VerifySavePath(oGame)
sSavePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oGame.Path
Else
sSavePath = oGame.ProcessPath
End If
Else
sSavePath = oGame.Path
End If
If oGame.FolderSave = True Then If oGame.FolderSave = True Then
BuildFileList(sSavePath, "*", mgrPath.IncludeFileLocation) BuildFileList(sSavePath, "*", mgrPath.IncludeFileLocation)
+2 -2
View File
@@ -283,13 +283,13 @@ Public Class mgrCommon
'Files 'Files
For Each fi As FileInfo In oFolder.EnumerateFiles() For Each fi As FileInfo In oFolder.EnumerateFiles()
If sInclude.Length > 0 Then If sInclude.Length > 0 Then
bInclude = CompareValueToArrayRegEx(fi.Name, sInclude) Or CompareValueToArrayRegEx(Path.GetDirectoryName(sPath), sInclude) bInclude = CompareValueToArrayRegEx(fi.Name, sInclude) Or CompareValueToArrayRegEx(fi.DirectoryName, sInclude)
Else Else
bInclude = True bInclude = True
End If End If
If sExclude.Length > 0 Then If sExclude.Length > 0 Then
bExclude = CompareValueToArrayRegEx(fi.Name, sExclude) Or CompareValueToArrayRegEx(Path.GetDirectoryName(sPath), sExclude) bExclude = CompareValueToArrayRegEx(fi.Name, sExclude) Or CompareValueToArrayRegEx(fi.DirectoryName, sExclude)
Else Else
bExclude = False bExclude = False
End If End If