diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb
index d5555ab..ba162a5 100644
--- a/GBM/Forms/frmMain.vb
+++ b/GBM/Forms/frmMain.vb
@@ -811,13 +811,6 @@ Public Class frmMain
Private Sub LoadAndVerify()
- 'The application cannot continue if this fails
- If Not oBackup.CheckForUtilities(mgrPath.Utility7zLocation) Then
- mgrCommon.ShowMessage(frmMain_Error7zip, MsgBoxStyle.Critical)
- bShutdown = True
- Me.Close()
- End If
-
'Local Database Check
VerifyDBVersion(mgrSQLite.Database.Local)
LocalDatabaseCheck()
@@ -855,6 +848,20 @@ Public Class frmMain
End If
End If
+ 'Check for any custom 7z utility and display a warning if it's missing
+ If oSettings.Custom7zLocation <> String.Empty Then
+ If Not oBackup.CheckForUtilities(oSettings.Custom7zLocation) Then
+ mgrCommon.ShowMessage(frmMain_Error7zCustom, oSettings.Custom7zLocation, MsgBoxStyle.Exclamation)
+ End If
+ End If
+
+ 'If the default utility is missing we cannot continue
+ If Not oBackup.CheckForUtilities(mgrPath.Default7zLocation) Then
+ mgrCommon.ShowMessage(frmMain_Error7zip, MsgBoxStyle.Critical)
+ bShutdown = True
+ Me.Close()
+ End If
+
End Sub
'Functions that handle buttons, menus and other GUI features on this form
diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb
index 5c3adfd..dc61002 100644
--- a/GBM/Forms/frmSettings.vb
+++ b/GBM/Forms/frmSettings.vb
@@ -1,4 +1,5 @@
Imports GBM.My.Resources
+Imports System.IO
Public Class frmSettings
Dim bShutdown As Boolean = False
@@ -83,10 +84,13 @@ Public Class frmSettings
oSettings.SupressBackup = chkSupressBackup.Checked
oSettings.SupressBackupThreshold = nudSupressBackupThreshold.Value
oSettings.CompressionLevel = cboCompression.SelectedValue
- oSettings.Custom7zArguments = txt7zArguments.Text
- 'TODO: Add Custom Location Validation!
- oSettings.Custom7zLocation = txt7zLocation.Text
+ If oSettings.Custom7zArguments <> txt7zArguments.Text.Trim And txt7zArguments.Text.Trim <> String.Empty Then
+ mgrCommon.ShowMessage(frmSettings_WarningArguments, MsgBoxStyle.Exclamation)
+ End If
+
+ oSettings.Custom7zArguments = txt7zArguments.Text.Trim
+ oSettings.Custom7zLocation = txt7zLocation.Text.Trim
'We need to clear all checksums its turned off
If chkCheckSum.Checked = False And oSettings.CheckSum = True Then
@@ -105,7 +109,7 @@ Public Class frmSettings
oSettings.SyncTags = chkSyncTags.Checked
oSettings.SyncAll = chkSyncAll.Checked
- If IO.Directory.Exists(txtBackupFolder.Text) Then
+ If Directory.Exists(txtBackupFolder.Text) Then
If oSettings.BackupFolder <> txtBackupFolder.Text Then
If chkSync.Checked Then bBackupLocationChanged = True
End If
@@ -115,8 +119,15 @@ Public Class frmSettings
Return False
End If
- If oSettings.Custom7zArguments <> String.Empty Then
- mgrCommon.ShowMessage(frmSettings_WarningArguments, MsgBoxStyle.Exclamation)
+ If oSettings.Custom7zLocation <> String.Empty Then
+ If File.Exists(oSettings.Custom7zLocation) Then
+ If Path.GetFileNameWithoutExtension(oSettings.Custom7zLocation) <> "7za" Then
+ mgrCommon.ShowMessage(frmSettings_WarningLocation, MsgBoxStyle.Exclamation)
+ End If
+ Else
+ mgrCommon.ShowMessage(frmSettings_ErrorLocation, oSettings.Custom7zLocation, MsgBoxStyle.Critical)
+ Return False
+ End If
End If
Return True
@@ -137,7 +148,7 @@ Public Class frmSettings
Try
'Use default when no custom location is set
If sLocation = String.Empty Then
- sLocation = mgrPath.Utility7zLocation
+ sLocation = mgrPath.Default7zLocation
End If
'Get info
@@ -146,9 +157,17 @@ Public Class frmSettings
lbl7zCopyright.Text = oFileInfo.LegalCopyright
Catch ex As Exception
lbl7zProduct.Text = mgrCommon.FormatString(frmSettings_Error7zInfo)
+ lbl7zCopyright.Text = String.Empty
End Try
End Sub
+ Private Sub SetDefaults()
+ If mgrCommon.ShowMessage(frmSettings_ConfirmDefaults, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
+ oSettings = New mgrSettings
+ LoadSettings()
+ End If
+ End Sub
+
Private Sub LoadSettings()
chkStartWindows.Checked = oSettings.StartWithWindows
chkMonitorOnStartup.Checked = oSettings.MonitorOnStartup
@@ -298,6 +317,10 @@ Public Class frmSettings
End Sub
Private Sub txt7zLocation_Leave(sender As Object, e As EventArgs) Handles txt7zLocation.Leave
- Get7zInfo(txt7zLocation.Text)
+ Get7zInfo(txt7zLocation.Text.Trim)
+ End Sub
+
+ Private Sub btnDefaults_Click(sender As Object, e As EventArgs) Handles btnDefaults.Click
+ SetDefaults()
End Sub
End Class
\ No newline at end of file
diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb
index b5d29e5..0a1e77d 100644
--- a/GBM/Managers/mgrBackup.vb
+++ b/GBM/Managers/mgrBackup.vb
@@ -169,20 +169,15 @@ Public Class mgrBackup
BuildFileList(sSavePath, oGame.ExcludeList, mgrPath.ExcludeFileLocation)
Try
- 'Need to delete any prior archive if it exists, the 7za utility does not support overwriting or deleting existing archives.
- 'If we let 7za update existing archives it will lead to excessive bloat with games that routinely add and remove files with many different file names.
- If File.Exists(sBackupFile) Then
- File.Delete(sBackupFile)
- End If
-
If Directory.Exists(sSavePath) Then
- 'The Linux version of 7za doesn't support the new verbose parameters and fails out. Just split this up for now until we have a better solution.
- If mgrCommon.IsUnix Then
- prs7z.StartInfo.Arguments = "a -t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r"
- Else
- prs7z.StartInfo.Arguments = "a -bb1 -bt -t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r"
+ 'Need to delete any prior archive if it exists, the 7za utility does not support overwriting or deleting existing archives.
+ 'If we let 7za update existing archives it will lead to excessive bloat with games that routinely add and remove files with many different file names.
+ If File.Exists(sBackupFile) Then
+ File.Delete(sBackupFile)
End If
- prs7z.StartInfo.FileName = mgrPath.Utility7zLocation
+
+ prs7z.StartInfo.Arguments = "a" & oSettings.Prepared7zArguments & "-t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r"
+ prs7z.StartInfo.FileName = oSettings.Utility7zLocation
prs7z.StartInfo.UseShellExecute = False
prs7z.StartInfo.RedirectStandardOutput = True
prs7z.StartInfo.CreateNoWindow = True
diff --git a/GBM/Managers/mgrPath.vb b/GBM/Managers/mgrPath.vb
index 4f78348..7be3d47 100644
--- a/GBM/Managers/mgrPath.vb
+++ b/GBM/Managers/mgrPath.vb
@@ -37,7 +37,7 @@ Public Class mgrPath
End Get
End Property
- Shared ReadOnly Property Utility7zLocation As String
+ Shared ReadOnly Property Default7zLocation As String
Get
If mgrCommon.IsUnix Then
Return "/usr/bin/7za"
diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb
index 95a70cf..ba02fc4 100644
--- a/GBM/Managers/mgrRestore.vb
+++ b/GBM/Managers/mgrRestore.vb
@@ -231,12 +231,8 @@ Public Class mgrRestore
Try
If File.Exists(sBackupFile) Then
- If mgrCommon.IsUnix Then
- prs7z.StartInfo.Arguments = "x """ & sBackupFile & """ -o""" & sExtractPath & Path.DirectorySeparatorChar & """ -aoa -r"
- Else
- prs7z.StartInfo.Arguments = "x -bb1 -bt """ & sBackupFile & """ -o""" & sExtractPath & Path.DirectorySeparatorChar & """ -aoa -r"
- End If
- prs7z.StartInfo.FileName = mgrPath.Utility7zLocation
+ prs7z.StartInfo.Arguments = "x" & oSettings.Prepared7zArguments & """" & sBackupFile & """ -o""" & sExtractPath & Path.DirectorySeparatorChar & """ -aoa -r"
+ prs7z.StartInfo.FileName = oSettings.Utility7zLocation
prs7z.StartInfo.UseShellExecute = False
prs7z.StartInfo.RedirectStandardOutput = True
prs7z.StartInfo.CreateNoWindow = True
diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb
index fef6feb..e8c7231 100644
--- a/GBM/Managers/mgrSettings.vb
+++ b/GBM/Managers/mgrSettings.vb
@@ -204,6 +204,21 @@ Public Class mgrSettings
End Set
End Property
+ ReadOnly Property Prepared7zArguments As String
+ Get
+ 'Prepare custom 7z arguments
+ Dim sPreparedArguments As String
+ If s7zArguments <> String.Empty Then
+ 'Surround the arguments with spaces to be inserted into command
+ sPreparedArguments = " " & s7zArguments & " "
+ Else
+ 'The command always needs at least one space inserted
+ sPreparedArguments = " "
+ End If
+ Return sPreparedArguments
+ End Get
+ End Property
+
Property Custom7zLocation As String
Get
Return s7zLocation
@@ -213,6 +228,22 @@ Public Class mgrSettings
End Set
End Property
+ ReadOnly Property Utility7zLocation As String
+ Get
+ 'Return default utility when custom setting is not used
+ If s7zLocation = String.Empty Then
+ Return mgrPath.Default7zLocation
+ Else
+ 'Check if custom utility is available, if not use the default utility
+ If File.Exists(s7zLocation) Then
+ Return s7zLocation
+ Else
+ Return mgrPath.Default7zLocation
+ End If
+ End If
+ End Get
+ End Property
+
Property BackupFolder As String
Get
Return sBackupFolder
diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb
index c093fb1..760e72d 100644
--- a/GBM/My Project/Resources.Designer.vb
+++ b/GBM/My Project/Resources.Designer.vb
@@ -2310,6 +2310,15 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized string similar to The custom 7-Zip utility could not be found at:[BR][BR][PARAM][BR][BR]Please check your settings, the default 7-Zip utility will be used..
+ '''
+ Friend ReadOnly Property frmMain_Error7zCustom() As String
+ Get
+ Return ResourceManager.GetString("frmMain_Error7zCustom", resourceCulture)
+ End Get
+ End Property
+
'''
''' Looks up a localized string similar to 7-Zip was not found. The application cannot continue..
'''
@@ -3327,6 +3336,15 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized string similar to Do you want to revert all settings to their defaults?.
+ '''
+ Friend ReadOnly Property frmSettings_ConfirmDefaults() As String
+ Get
+ Return ResourceManager.GetString("frmSettings_ConfirmDefaults", resourceCulture)
+ End Get
+ End Property
+
'''
''' Looks up a localized string similar to Unable to retrieve 7z product information!.
'''
@@ -3345,6 +3363,15 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized string similar to The custom 7-Zip location [PARAM] does not exist..
+ '''
+ Friend ReadOnly Property frmSettings_ErrorLocation() As String
+ Get
+ Return ResourceManager.GetString("frmSettings_ErrorLocation", resourceCulture)
+ End Get
+ End Property
+
'''
''' Looks up a localized string similar to Settings.
'''
@@ -3454,7 +3481,7 @@ Namespace My.Resources
End Property
'''
- ''' Looks up a localized string similar to Custom 7-Zip arguments can cause backup or restore operations to fail.[BR][BR]If problems occur, clear the arguments and refer to the GBM manual..
+ ''' Looks up a localized string similar to Invalid or poorly formatted 7-Zip arguments can cause backup or restore operations to fail.[BR][BR]If problems occur, clear the arguments and refer to the GBM manual..
'''
Friend ReadOnly Property frmSettings_WarningArguments() As String
Get
@@ -3462,6 +3489,15 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized string similar to You have chosen a custom utility that does not appear to be 7-Zip Console (7za). GBM only supports the use of 7-Zip..
+ '''
+ Friend ReadOnly Property frmSettings_WarningLocation() As String
+ Get
+ Return ResourceManager.GetString("frmSettings_WarningLocation", resourceCulture)
+ End Get
+ End Property
+
'''
''' Looks up a localized string similar to Choose a backup folder:.
'''
diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx
index 0d677f4..94f341a 100644
--- a/GBM/My Project/Resources.resx
+++ b/GBM/My Project/Resources.resx
@@ -1637,6 +1637,18 @@
Locate 7-Zip Console (7za)
- Custom 7-Zip arguments can cause backup or restore operations to fail.[BR][BR]If problems occur, clear the arguments and refer to the GBM manual.
+ Invalid or poorly formatted 7-Zip arguments can cause backup or restore operations to fail.[BR][BR]If problems occur, clear the arguments and refer to the GBM manual.
+
+
+ The custom 7-Zip utility could not be found at:[BR][BR][PARAM][BR][BR]Please check your settings, the default 7-Zip utility will be used.
+
+
+ Do you want to revert all settings to their defaults?
+
+
+ The custom 7-Zip location [PARAM] does not exist.
+
+
+ You have chosen a custom utility that does not appear to be 7-Zip Console (7za). GBM only supports the use of 7-Zip.
\ No newline at end of file