Skip to content

Commit

Permalink
Merge pull request #302 from MikeMaximus/v137
Browse files Browse the repository at this point in the history
V137
  • Loading branch information
MikeMaximus authored Nov 7, 2023
2 parents a77f02f + 94cb243 commit 4e0a423
Show file tree
Hide file tree
Showing 15 changed files with 312 additions and 90 deletions.
22 changes: 20 additions & 2 deletions GBM/Classes/clsGame.vb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ Public Class clsGame
Public Property UseWindowTitle As Boolean
Public Property Differential As Boolean
Public Property DiffInterval As Integer
Public Property TimedBackup As Boolean
Public Property TimedInterval As Integer
Public ReadOnly Property TruePath As String
Get
Return sPath
Expand Down Expand Up @@ -239,6 +241,12 @@ Public Class clsGame
If DiffInterval <> oGame.DiffInterval Then
Return False
End If
If TimedBackup <> oGame.TimedBackup Then
Return False
End If
If TimedInterval <> oGame.TimedInterval Then
Return False
End If

'Optional Sync Fields
If (eSyncFields And eOptionalSyncFields.Company) = eOptionalSyncFields.Company Then
Expand Down Expand Up @@ -327,6 +335,12 @@ Public Class clsGame
If DiffInterval <> oGame.DiffInterval Then
Return False
End If
If TimedBackup <> oGame.TimedBackup Then
Return False
End If
If TimedInterval <> oGame.TimedInterval Then
Return False
End If
Return True
End If
End Function
Expand Down Expand Up @@ -381,14 +395,16 @@ Public Class clsGame
UseWindowTitle = False
Differential = False
DiffInterval = 0
TimedBackup = False
TimedInterval = 1
ImportTags = New List(Of Tag)
ImportConfigLinks = New List(Of ConfigLink)
End Sub

Sub New(sID As String, sName As String, sProcessName As String, sParameter As String, sPath As String, bFolderSave As Boolean, sFileType As String, bAppendTimeStamp As Boolean, iBackupLimit As Integer,
bCleanFolder As Boolean, sExcludeList As String, sProcessPath As String, sIcon As String, dHours As Double, sVersion As String, sCompany As String, bEnabled As Boolean, bMonitorOnly As Boolean,
sComments As String, bIsRegEx As Boolean, bRecurseSubFolders As Boolean, eOS As eOS, bUseWindowTitle As Boolean, bDifferential As Boolean, iDiffInterval As Integer, oImportTags As List(Of Tag),
oImportConfigLinks As List(Of ConfigLink))
sComments As String, bIsRegEx As Boolean, bRecurseSubFolders As Boolean, eOS As eOS, bUseWindowTitle As Boolean, bDifferential As Boolean, iDiffInterval As Integer, bTimedBackup As Boolean,
iTimedInterval As Integer, oImportTags As List(Of Tag), oImportConfigLinks As List(Of ConfigLink))
ID = sID
Name = sName
ProcessName = sProcessName
Expand All @@ -414,6 +430,8 @@ Public Class clsGame
UseWindowTitle = bUseWindowTitle
Differential = bDifferential
DiffInterval = iDiffInterval
TimedBackup = bTimedBackup
TimedInterval = iTimedInterval
ImportTags = oImportTags
ImportConfigLinks = oImportConfigLinks
End Sub
Expand Down
16 changes: 16 additions & 0 deletions GBM/Forms/frmFilter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,22 @@ Public Class frmFilter
oField.Status = clsGameFilterField.eFieldStatus.ValidFilter
oValidFields.Add(oField)

'Timed interval backup
oField = New clsGameFilterField
oField.FieldName = "TimedBackup"
oField.FriendlyFieldName = frmFilter_FieldTimedBackup
oField.Type = clsGameFilterField.eDataType.fBool
oField.Status = clsGameFilterField.eFieldStatus.ValidFilter
oValidFields.Add(oField)

'Timed interval backup (minutes)
oField = New clsGameFilterField
oField.FieldName = "TimedInterval"
oField.FriendlyFieldName = frmFilter_FieldTimedInterval
oField.Type = clsGameFilterField.eDataType.fNumeric
oField.Status = clsGameFilterField.eFieldStatus.ValidFilter
oValidFields.Add(oField)

'Comments
oField = New clsGameFilterField
oField.FieldName = "Comments"
Expand Down
47 changes: 43 additions & 4 deletions GBM/Forms/frmGameManager.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 33 additions & 13 deletions GBM/Forms/frmGameManager.vb
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ Public Class frmGameManager
nudLimit.Value = oApp.BackupLimit
chkDifferentialBackup.Checked = oApp.Differential
nudInterval.Value = oApp.DiffInterval
chkTimedBackup.Checked = oApp.TimedBackup
nudTimedInterval.Value = oApp.TimedInterval
txtComments.Text = oApp.Comments
cmsEnabled.Checked = oApp.Enabled
cmsMonitorOnly.Checked = oApp.MonitorOnly
Expand Down Expand Up @@ -1130,6 +1132,9 @@ Public Class frmGameManager
chkDifferentialBackup.Enabled = False
lblInterval.Enabled = False
nudInterval.Enabled = False
chkTimedBackup.Enabled = False
nudTimedInterval.Enabled = False
lblTimeIntervalMinutes.Enabled = False
lblSavePath.Enabled = False
txtSavePath.Enabled = False
btnSavePathBrowse.Enabled = False
Expand All @@ -1141,6 +1146,7 @@ Public Class frmGameManager
'Enable any controls that are not handled by other mode updates
chkTimeStamp.Enabled = True
chkDifferentialBackup.Enabled = True
chkTimedBackup.Enabled = True
lblSavePath.Enabled = True
txtSavePath.Enabled = True
btnSavePathBrowse.Enabled = True
Expand Down Expand Up @@ -1197,6 +1203,24 @@ Public Class frmGameManager
chkCleanFolder.Checked = False
chkCleanFolder.Enabled = False
End If

'Handle "Time Interval Backups" mode change
If mgrSettings.EnableLiveBackup Then
chkTimedBackup.Visible = True
nudTimedInterval.Visible = True
lblTimeIntervalMinutes.Visible = True
If chkTimedBackup.Checked Then
nudTimedInterval.Enabled = True
lblTimeIntervalMinutes.Enabled = True
Else
nudTimedInterval.Enabled = False
lblTimeIntervalMinutes.Enabled = False
End If
Else
chkTimedBackup.Visible = False
nudTimedInterval.Visible = False
lblTimeIntervalMinutes.Visible = False
End If
End If
End Sub

Expand Down Expand Up @@ -1340,6 +1364,12 @@ Public Class frmGameManager
Else
oApp.DiffInterval = 0
End If
oApp.TimedBackup = chkTimedBackup.Checked
If oApp.TimedBackup Then
oApp.TimedInterval = nudTimedInterval.Value
Else
oApp.TimedInterval = 1
End If
oApp.Comments = txtComments.Text
oApp.Enabled = cmsEnabled.Checked
oApp.MonitorOnly = cmsMonitorOnly.Checked
Expand Down Expand Up @@ -1830,6 +1860,8 @@ Public Class frmGameManager
lblLimit.Text = frmGameManager_lblLimit
lblInterval.Text = frmGameManager_lblInterval
chkDifferentialBackup.Text = frmGameManager_chkDifferentialBackup
chkTimedBackup.Text = frmGameManager_chkTimedBackup
lblTimeIntervalMinutes.Text = frmGameManager_lblTimeIntervalMinutes
cmsDeleteOne.Text = frmGameManager_cmsDeleteOne
cmsDeleteAll.Text = frmGameManager_cmsDeleteAll
btnLinks.Image = frmGameManager_Link
Expand Down Expand Up @@ -2094,19 +2126,7 @@ Public Class frmGameManager
UpdateBuilderButtonLabel(txtExclude.Text, frmGameManager_ExcludeShortcut, btnExclude, (sExclude <> txtExclude.Text))
End Sub

Private Sub chkFolderSave_CheckedChanged(sender As Object, e As EventArgs) Handles chkFolderSave.CheckedChanged
If Not IsLoading Then ModeChangeHandler()
End Sub

Private Sub chkTimeStamp_CheckedChanged(sender As Object, e As EventArgs) Handles chkTimeStamp.CheckedChanged
If Not IsLoading Then ModeChangeHandler()
End Sub

Private Sub chkDifferentialBackup_CheckedChanged(sender As Object, e As EventArgs) Handles chkDifferentialBackup.CheckedChanged
If Not IsLoading Then ModeChangeHandler()
End Sub

Private Sub chkMonitorOnly_CheckedChanged(sender As Object, e As EventArgs) Handles cmsMonitorOnly.CheckedChanged
Private Sub ModeChangeEventHandler(sender As Object, e As EventArgs) Handles chkFolderSave.CheckedChanged, chkTimeStamp.CheckedChanged, chkDifferentialBackup.CheckedChanged, chkTimedBackup.CheckedChanged, cmsMonitorOnly.CheckedChanged
If Not IsLoading Then ModeChangeHandler()
End Sub

Expand Down
15 changes: 15 additions & 0 deletions GBM/Forms/frmMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Public Class frmMain
WithEvents tmSessionTimeUpdater As New System.Timers.Timer
WithEvents tmFilterTimer As New System.Timers.Timer
WithEvents tmPlayTimer As New System.Timers.Timer
WithEvents tmTimedBackup As New System.Timers.Timer

Public WithEvents oProcess As New mgrProcessDetection
Public WithEvents oBackup As New mgrBackup
Expand Down Expand Up @@ -3149,6 +3150,10 @@ Public Class frmMain
tmFilterTimer.Enabled = False
End Sub

Private Sub TimedBackupEventProcessor(sender As Object, ByVal e As EventArgs) Handles tmTimedBackup.Elapsed
RunManualBackup(New List(Of clsGame)({oProcess.GameInfo}), True)
End Sub

Private Sub AutoRestoreEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmRestoreCheck.Elapsed
AutoRestoreCheck()
End Sub
Expand Down Expand Up @@ -3245,6 +3250,14 @@ Public Class frmMain

If mgrSettings.TimeTracking And Not oProcess.Duplicate Then tmSessionTimeUpdater.Start()

If mgrSettings.EnableLiveBackup And Not oProcess.Duplicate Then
If oProcess.GameInfo.TimedBackup And oProcess.GameInfo.TimedInterval >= 1 Then
tmTimedBackup.Interval = oProcess.GameInfo.TimedInterval * 60000
tmTimedBackup.Enabled = True
tmTimedBackup.Start()
End If
End If

Try
Do While Not (oProcess.FoundProcess.HasExited Or bwMonitor.CancellationPending)
If Not oProcess.Duplicate And oProcess.GameInfo.UseWindowTitle Then
Expand Down Expand Up @@ -3286,6 +3299,8 @@ Public Class frmMain
End Try

tmSessionTimeUpdater.Stop()
tmTimedBackup.Stop()
tmTimedBackup.Enabled = False
End Sub

Private Sub bwMain_RunWorkerCompleted(sender As System.Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwMonitor.RunWorkerCompleted
Expand Down
4 changes: 2 additions & 2 deletions GBM/Forms/frmSettings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4e0a423

Please sign in to comment.