Changes for multi-platform support
This commit is contained in:
+35
-24
@@ -23,6 +23,7 @@ Public Class frmMain
|
|||||||
Private eCurrentOperation As eOperation = eOperation.None
|
Private eCurrentOperation As eOperation = eOperation.None
|
||||||
Private bCancelledByUser As Boolean = False
|
Private bCancelledByUser As Boolean = False
|
||||||
Private bShutdown As Boolean = False
|
Private bShutdown As Boolean = False
|
||||||
|
Private bInitFail As Boolean = False
|
||||||
Private bMenuEnabled As Boolean = True
|
Private bMenuEnabled As Boolean = True
|
||||||
Private bLockdown As Boolean = True
|
Private bLockdown As Boolean = True
|
||||||
Private bFirstRun As Boolean = False
|
Private bFirstRun As Boolean = False
|
||||||
@@ -812,15 +813,13 @@ Public Class frmMain
|
|||||||
|
|
||||||
Private Sub ToggleState()
|
Private Sub ToggleState()
|
||||||
'Toggle State with Tray Clicks
|
'Toggle State with Tray Clicks
|
||||||
If Me.WindowState = FormWindowState.Minimized Then
|
If Me.Visible = False Then
|
||||||
Me.Visible = True
|
Me.Visible = True
|
||||||
Me.ShowInTaskbar = True
|
Me.ShowInTaskbar = True
|
||||||
Me.WindowState = FormWindowState.Normal
|
|
||||||
Me.Focus()
|
Me.Focus()
|
||||||
Else
|
Else
|
||||||
Me.Visible = False
|
Me.Visible = False
|
||||||
Me.ShowInTaskbar = False
|
Me.ShowInTaskbar = False
|
||||||
Me.WindowState = FormWindowState.Minimized
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -1173,8 +1172,8 @@ Public Class frmMain
|
|||||||
|
|
||||||
Private Sub VerifyGameDataPath()
|
Private Sub VerifyGameDataPath()
|
||||||
'Important: This function cannot access mgrPath for settings, as that will trigger a database creation and destroy the reason for this function
|
'Important: This function cannot access mgrPath for settings, as that will trigger a database creation and destroy the reason for this function
|
||||||
Dim sSettingsRoot As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\gbm"
|
Dim sSettingsRoot As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "/gbm"
|
||||||
Dim sDBLocation As String = sSettingsRoot & "\gbm.s3db"
|
Dim sDBLocation As String = sSettingsRoot & "/gbm.s3db"
|
||||||
|
|
||||||
If Not IO.Directory.Exists(sSettingsRoot) Then
|
If Not IO.Directory.Exists(sSettingsRoot) Then
|
||||||
Try
|
Try
|
||||||
@@ -1400,7 +1399,6 @@ Public Class frmMain
|
|||||||
Private Sub gMonTray_BalloonTipClicked(sender As System.Object, e As System.EventArgs) Handles gMonTray.BalloonTipClicked
|
Private Sub gMonTray_BalloonTipClicked(sender As System.Object, e As System.EventArgs) Handles gMonTray.BalloonTipClicked
|
||||||
Me.Visible = True
|
Me.Visible = True
|
||||||
Me.ShowInTaskbar = True
|
Me.ShowInTaskbar = True
|
||||||
Me.WindowState = FormWindowState.Normal
|
|
||||||
Me.Focus()
|
Me.Focus()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -1423,7 +1421,6 @@ Public Class frmMain
|
|||||||
e.Cancel = True
|
e.Cancel = True
|
||||||
Me.Visible = False
|
Me.Visible = False
|
||||||
Me.ShowInTaskbar = False
|
Me.ShowInTaskbar = False
|
||||||
Me.WindowState = FormWindowState.Minimized
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -1537,32 +1534,46 @@ Public Class frmMain
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
||||||
SetForm()
|
|
||||||
VerifyGameDataPath()
|
|
||||||
LoadAndVerify()
|
|
||||||
VerifyCustomPathVariables()
|
|
||||||
|
|
||||||
If oSettings.StartToTray Then
|
'Init
|
||||||
Me.Visible = False
|
Try
|
||||||
Me.ShowInTaskbar = False
|
SetForm()
|
||||||
Me.WindowState = FormWindowState.Minimized
|
VerifyGameDataPath()
|
||||||
End If
|
LoadAndVerify()
|
||||||
|
VerifyCustomPathVariables()
|
||||||
|
|
||||||
If oSettings.MonitorOnStartup Then
|
If oSettings.StartToTray Then
|
||||||
eCurrentStatus = eStatus.Stopped
|
Me.Visible = False
|
||||||
Else
|
Me.ShowInTaskbar = False
|
||||||
eCurrentStatus = eStatus.Running
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
HandleScan()
|
If oSettings.MonitorOnStartup Then
|
||||||
CheckForNewBackups()
|
eCurrentStatus = eStatus.Stopped
|
||||||
|
Else
|
||||||
|
eCurrentStatus = eStatus.Running
|
||||||
|
End If
|
||||||
|
|
||||||
|
HandleScan()
|
||||||
|
CheckForNewBackups()
|
||||||
|
Catch niex As NotImplementedException
|
||||||
|
'Ignore for Mono runtime tests
|
||||||
|
Catch ex As Exception
|
||||||
|
mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message, MsgBoxStyle.Critical)
|
||||||
|
bInitFail = True
|
||||||
|
End Try
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
|
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
|
||||||
If bFirstRun Then
|
|
||||||
|
If bFirstRun And Not bInitFail Then
|
||||||
OpenStartupWizard()
|
OpenStartupWizard()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If bInitFail Then
|
||||||
|
bShutdown = True
|
||||||
|
Me.Close()
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub txtGameInfo_Enter(sender As Object, e As EventArgs)
|
Private Sub txtGameInfo_Enter(sender As Object, e As EventArgs)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ Public Class mgrBackup
|
|||||||
'Create manifest item
|
'Create manifest item
|
||||||
oItem.Name = oGameInfo.Name
|
oItem.Name = oGameInfo.Name
|
||||||
'Keep the path relative to the manifest location
|
'Keep the path relative to the manifest location
|
||||||
oItem.FileName = sBackupFile.Replace(Path.GetDirectoryName(mgrPath.RemoteDatabaseLocation) & "\", "")
|
oItem.FileName = sBackupFile.Replace(Path.GetDirectoryName(mgrPath.RemoteDatabaseLocation) & Path.DirectorySeparatorChar, "")
|
||||||
oItem.RestorePath = oGameInfo.TruePath
|
oItem.RestorePath = oGameInfo.TruePath
|
||||||
oItem.AbsolutePath = oGameInfo.AbsolutePath
|
oItem.AbsolutePath = oGameInfo.AbsolutePath
|
||||||
oItem.DateUpdated = dTimeStamp
|
oItem.DateUpdated = dTimeStamp
|
||||||
@@ -75,7 +75,7 @@ Public Class mgrBackup
|
|||||||
Using oStream
|
Using oStream
|
||||||
If sList <> String.Empty Then
|
If sList <> String.Empty Then
|
||||||
For Each sTypeItem As String In sList.Split(":")
|
For Each sTypeItem As String In sList.Split(":")
|
||||||
oStream.WriteLine("""" & sBackupPath & "\" & sTypeItem & """")
|
oStream.WriteLine("""" & sBackupPath & Path.DirectorySeparatorChar & sTypeItem & """")
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
oStream.Flush()
|
oStream.Flush()
|
||||||
@@ -129,9 +129,9 @@ Public Class mgrBackup
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If oGame.AppendTimeStamp Then
|
If oGame.AppendTimeStamp Then
|
||||||
sBackupFile = sBackupFile & "\" & oGame.Name & sTimeStamp & ".7z"
|
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & sTimeStamp & ".7z"
|
||||||
Else
|
Else
|
||||||
sBackupFile = sBackupFile & "\" & oGame.Name & ".7z"
|
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & ".7z"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If oSettings.ShowOverwriteWarning And File.Exists(sBackupFile) Then
|
If oSettings.ShowOverwriteWarning And File.Exists(sBackupFile) Then
|
||||||
@@ -144,7 +144,7 @@ Public Class mgrBackup
|
|||||||
If bDoBackup Then
|
If bDoBackup Then
|
||||||
If oGame.AbsolutePath = False Then
|
If oGame.AbsolutePath = False Then
|
||||||
If oGame.Path <> String.Empty Then
|
If oGame.Path <> String.Empty Then
|
||||||
sSavePath = oGame.ProcessPath & "\" & oGame.Path
|
sSavePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oGame.Path
|
||||||
Else
|
Else
|
||||||
sSavePath = oGame.ProcessPath
|
sSavePath = oGame.ProcessPath
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -160,8 +160,6 @@ Public Class mgrCommon
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'Handles no extra parameters
|
'Handles no extra parameters
|
||||||
Public Shared Function ShowMessage(ByVal sMsg As String, ByVal oType As MsgBoxStyle) As MsgBoxResult
|
Public Shared Function ShowMessage(ByVal sMsg As String, ByVal oType As MsgBoxStyle) As MsgBoxResult
|
||||||
Dim oResult As MsgBoxResult
|
Dim oResult As MsgBoxResult
|
||||||
|
|||||||
+24
-23
@@ -5,11 +5,11 @@ Imports System.Reflection
|
|||||||
|
|
||||||
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
|
||||||
Private Shared sSettingsRoot As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\gbm"
|
Private Shared sSettingsRoot As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "/gbm"
|
||||||
Private Shared sDBLocation As String = sSettingsRoot & "\gbm.s3db"
|
Private Shared sDBLocation As String = sSettingsRoot & "/gbm.s3db"
|
||||||
Private Shared sIncludeFile As String = sSettingsRoot & "\gbm_include.txt"
|
Private Shared sIncludeFile As String = sSettingsRoot & "/gbm_include.txt"
|
||||||
Private Shared sExcludeFile As String = sSettingsRoot & "\gbm_exclude.txt"
|
Private Shared sExcludeFile As String = sSettingsRoot & "/gbm_exclude.txt"
|
||||||
Private Shared sLogFile As String = sSettingsRoot & "\gbm_log_" & Date.Now.ToString("dd-MM-yyyy-HH-mm-ss") & ".txt"
|
Private Shared sLogFile As String = sSettingsRoot & "/gbm_log_" & Date.Now.ToString("dd-MM-yyyy-HH-mm-ss") & ".txt"
|
||||||
Private Shared sRemoteDatabaseLocation As String
|
Private Shared sRemoteDatabaseLocation As String
|
||||||
Private Shared hshCustomVariables As Hashtable
|
Private Shared hshCustomVariables As Hashtable
|
||||||
Private Shared oReleaseType As ProcessorArchitecture = AssemblyName.GetAssemblyName(Application.ExecutablePath()).ProcessorArchitecture
|
Private Shared oReleaseType As ProcessorArchitecture = AssemblyName.GetAssemblyName(Application.ExecutablePath()).ProcessorArchitecture
|
||||||
@@ -41,18 +41,18 @@ Public Class mgrPath
|
|||||||
Get
|
Get
|
||||||
Select Case oReleaseType
|
Select Case oReleaseType
|
||||||
Case ProcessorArchitecture.Amd64
|
Case ProcessorArchitecture.Amd64
|
||||||
Return Application.StartupPath & "\Utilities\x64\7za.exe"
|
Return Application.StartupPath & "/Utilities/x64/7za.exe"
|
||||||
Case ProcessorArchitecture.IA64
|
Case ProcessorArchitecture.IA64
|
||||||
Return Application.StartupPath & "\Utilities\x64\7za.exe"
|
Return Application.StartupPath & "/Utilities/x64/7za.exe"
|
||||||
Case ProcessorArchitecture.MSIL
|
Case ProcessorArchitecture.MSIL
|
||||||
Return Application.StartupPath & "\Utilities\x86\7za.exe"
|
Return Application.StartupPath & "/Utilities/x86/7za.exe"
|
||||||
Case ProcessorArchitecture.X86
|
Case ProcessorArchitecture.X86
|
||||||
Return Application.StartupPath & "\Utilities\x86\7za.exe"
|
Return Application.StartupPath & "/Utilities/x86/7za.exe"
|
||||||
Case ProcessorArchitecture.None
|
Case ProcessorArchitecture.None
|
||||||
Return Application.StartupPath & "\Utilities\x86\7za.exe"
|
Return Application.StartupPath & "/Utilities/x86/7za.exe"
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
Return Application.StartupPath & "\Utilities\x86\7za.exe"
|
Return Application.StartupPath & "/Utilities/x86/7za.exe"
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -119,19 +119,20 @@ Public Class mgrPath
|
|||||||
Dim iRemove As Integer = 0
|
Dim iRemove As Integer = 0
|
||||||
Dim iBackFolders As Integer = 0
|
Dim iBackFolders As Integer = 0
|
||||||
Dim bDeep As Boolean
|
Dim bDeep As Boolean
|
||||||
|
Dim cPathChars As Char() = {"\", "/"}
|
||||||
|
|
||||||
'We are working with a case insenstive file system, ensure a uniform case
|
'We are working with a case insenstive file system, ensure a uniform case
|
||||||
sProcessPath = sProcessPath.ToLower
|
sProcessPath = sProcessPath.ToLower
|
||||||
sSavePath = sSavePath.ToLower
|
sSavePath = sSavePath.ToLower
|
||||||
|
|
||||||
'We need to ensure we have a single trailing slash on the parameters
|
'We need to ensure we have a single trailing slash on the parameters
|
||||||
sProcessPath = sProcessPath.TrimEnd("\")
|
sProcessPath = sProcessPath.TrimEnd(cPathChars)
|
||||||
sSavePath = sSavePath.TrimEnd("\")
|
sSavePath = sSavePath.TrimEnd(cPathChars)
|
||||||
sProcessPath &= "\"
|
sProcessPath &= "/"
|
||||||
sSavePath &= "\"
|
sSavePath &= "/"
|
||||||
|
|
||||||
'Determines the direction we need to go, we always want to be relative to the process location
|
'Determines the direction we need to go, we always want to be relative to the process location
|
||||||
If sSavePath.Split("\").Length > sProcessPath.Split("\").Length Then
|
If sSavePath.Split(cPathChars).Length > sProcessPath.Split(cPathChars).Length Then
|
||||||
sPath1 = sProcessPath
|
sPath1 = sProcessPath
|
||||||
sPath2 = sSavePath
|
sPath2 = sSavePath
|
||||||
bDeep = True
|
bDeep = True
|
||||||
@@ -142,8 +143,8 @@ Public Class mgrPath
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Build an array of folders to work with from each path
|
'Build an array of folders to work with from each path
|
||||||
sPath1Array = sPath1.Split("\")
|
sPath1Array = sPath1.Split(cPathChars)
|
||||||
sPath2Array = sPath2.Split("\")
|
sPath2Array = sPath2.Split(cPathChars)
|
||||||
|
|
||||||
'Take the shortest path and remove the common folders from both
|
'Take the shortest path and remove the common folders from both
|
||||||
For Each s As String In sPath1Array
|
For Each s As String In sPath1Array
|
||||||
@@ -155,25 +156,25 @@ Public Class mgrPath
|
|||||||
Next
|
Next
|
||||||
|
|
||||||
'Remove the trailing slashes
|
'Remove the trailing slashes
|
||||||
sPath1 = sPath1.TrimEnd("\")
|
sPath1 = sPath1.TrimEnd(cPathChars)
|
||||||
sPath2 = sPath2.TrimEnd("\")
|
sPath2 = sPath2.TrimEnd(cPathChars)
|
||||||
|
|
||||||
'Determine which way we go
|
'Determine which way we go
|
||||||
If bDeep Then
|
If bDeep Then
|
||||||
If sPath1.Length > 0 Then
|
If sPath1.Length > 0 Then
|
||||||
iBackFolders = sPath1.Split("\").Length
|
iBackFolders = sPath1.Split(cPathChars).Length
|
||||||
End If
|
End If
|
||||||
sResult = sPath2
|
sResult = sPath2
|
||||||
Else
|
Else
|
||||||
If sPath2.Length > 0 Then
|
If sPath2.Length > 0 Then
|
||||||
iBackFolders = sPath2.Split("\").Length
|
iBackFolders = sPath2.Split(cPathChars).Length
|
||||||
End If
|
End If
|
||||||
sResult = sPath1
|
sResult = sPath1
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Insert direction modifiers based on how many folders are left
|
'Insert direction modifiers based on how many folders are left
|
||||||
For i = 1 To iBackFolders
|
For i = 1 To iBackFolders
|
||||||
sResult = "..\" & sResult
|
sResult = ".." & Path.DirectorySeparatorChar & sResult
|
||||||
Next i
|
Next i
|
||||||
|
|
||||||
'Done
|
'Done
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ Public Class mgrRestore
|
|||||||
|
|
||||||
If Not oRestoreInfo.AbsolutePath Then
|
If Not oRestoreInfo.AbsolutePath Then
|
||||||
If oGame.ProcessPath <> String.Empty Then
|
If oGame.ProcessPath <> String.Empty Then
|
||||||
oRestoreInfo.RelativeRestorePath = oGame.ProcessPath & "\" & oRestoreInfo.RestorePath
|
oRestoreInfo.RelativeRestorePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oRestoreInfo.RestorePath
|
||||||
Else
|
Else
|
||||||
sProcess = oGame.TrueProcess
|
sProcess = oGame.TrueProcess
|
||||||
If mgrCommon.IsProcessNotSearchable(oGame) Then bNoAuto = True
|
If mgrCommon.IsProcessNotSearchable(oGame) Then bNoAuto = True
|
||||||
@@ -73,7 +73,7 @@ Public Class mgrRestore
|
|||||||
bTriggerReload = True
|
bTriggerReload = True
|
||||||
|
|
||||||
'Set path for restore
|
'Set path for restore
|
||||||
oRestoreInfo.RelativeRestorePath = sRestorePath & "\" & oRestoreInfo.RestorePath
|
oRestoreInfo.RelativeRestorePath = sRestorePath & Path.DirectorySeparatorChar & oRestoreInfo.RestorePath
|
||||||
Else
|
Else
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
@@ -183,7 +183,7 @@ Public Class mgrRestore
|
|||||||
For Each oBackupInfo In oRestoreList
|
For Each oBackupInfo In oRestoreList
|
||||||
'Init
|
'Init
|
||||||
prs7z = New Process
|
prs7z = New Process
|
||||||
sBackupFile = oSettings.BackupFolder & "\" & oBackupInfo.FileName
|
sBackupFile = oSettings.BackupFolder & Path.DirectorySeparatorChar & oBackupInfo.FileName
|
||||||
sExtractPath = String.Empty
|
sExtractPath = String.Empty
|
||||||
bDoRestore = True
|
bDoRestore = True
|
||||||
bRestoreCompleted = False
|
bRestoreCompleted = False
|
||||||
|
|||||||
Generated
+9
@@ -2328,6 +2328,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to An unexpected error occured while initializing GBM.[BR][BR][PARAM][BR][BR]The application will now exit..
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmMain_ErrorInitFailure() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmMain_ErrorInitFailure", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to The command [PARAM] requires more parameters..
|
''' Looks up a localized string similar to The command [PARAM] requires more parameters..
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@@ -1558,4 +1558,7 @@
|
|||||||
<data name="frmMain_ErrorMissingParams" xml:space="preserve">
|
<data name="frmMain_ErrorMissingParams" xml:space="preserve">
|
||||||
<value>The command [PARAM] requires more parameters.</value>
|
<value>The command [PARAM] requires more parameters.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="frmMain_ErrorInitFailure" xml:space="preserve">
|
||||||
|
<value>An unexpected error occured while initializing GBM.[BR][BR][PARAM][BR][BR]The application will now exit.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user