Changes for issues #138 and #140

This commit is contained in:
MikeMaximus
2018-06-26 09:24:22 -06:00
parent c9463c3a36
commit 93bc974cc3
9 changed files with 47 additions and 62 deletions
+20
View File
@@ -6,6 +6,8 @@
Private sPath As String Private sPath As String
Private bAbsolutePath As Boolean Private bAbsolutePath As Boolean
Private bFolderSave As Boolean Private bFolderSave As Boolean
Private bAppendTimeStamp As Boolean
Private iBackupLimit As Integer
Private sFileType As String Private sFileType As String
Private sExcludeList As String Private sExcludeList As String
Private bMonitorOnly As Boolean Private bMonitorOnly As Boolean
@@ -76,6 +78,24 @@
End Get End Get
End Property End Property
Property AppendTimeStamp As Boolean
Set(value As Boolean)
bAppendTimeStamp = value
End Set
Get
Return bAppendTimeStamp
End Get
End Property
Property BackupLimit As Integer
Set(value As Integer)
iBackupLimit = value
End Set
Get
Return iBackupLimit
End Get
End Property
Property FileType As String Property FileType As String
Set(value As String) Set(value As String)
sFileType = value sFileType = value
+8 -10
View File
@@ -9,7 +9,7 @@ Public Class clsGame
Private bFolderSave As Boolean = False Private bFolderSave As Boolean = False
Private sFileType As String = String.Empty Private sFileType As String = String.Empty
Private bAppendTimeStamp As Boolean = False Private bAppendTimeStamp As Boolean = False
Private iBackupLimit As Integer = 2 Private iBackupLimit As Integer = 0
Private bCleanFolder As Boolean = False Private bCleanFolder As Boolean = False
Private sExcludeList As String = String.Empty Private sExcludeList As String = String.Empty
Private sProcessPath As String = String.Empty Private sProcessPath As String = String.Empty
@@ -31,7 +31,7 @@ Public Class clsGame
Company = 2 Company = 2
Version = 4 Version = 4
Icon = 16 Icon = 16
TimeStamp = 32 Unused = 32 'Do not remove to maintain compatability, re-use for a future field.
MonitorGame = 64 MonitorGame = 64
End Enum End Enum
@@ -340,6 +340,12 @@ Public Class clsGame
If FolderSave <> oGame.FolderSave Then If FolderSave <> oGame.FolderSave Then
Return False Return False
End If End If
If AppendTimeStamp <> oGame.AppendTimeStamp Then
Return False
End If
If BackupLimit <> oGame.BackupLimit Then
Return False
End If
If CleanFolder <> oGame.CleanFolder Then If CleanFolder <> oGame.CleanFolder Then
Return False Return False
End If End If
@@ -377,14 +383,6 @@ Public Class clsGame
Return False Return False
End If End If
End If End If
If (eSyncFields And eOptionalSyncFields.TimeStamp) = eOptionalSyncFields.TimeStamp Then
If AppendTimeStamp <> oGame.AppendTimeStamp Then
Return False
End If
If BackupLimit <> oGame.BackupLimit Then
Return False
End If
End If
If (eSyncFields And eOptionalSyncFields.Version) = eOptionalSyncFields.Version Then If (eSyncFields And eOptionalSyncFields.Version) = eOptionalSyncFields.Version Then
If Version <> oGame.Version Then If Version <> oGame.Version Then
Return False Return False
-1
View File
@@ -270,7 +270,6 @@ Partial Class frmGameManager
Me.nudLimit.Name = "nudLimit" Me.nudLimit.Name = "nudLimit"
Me.nudLimit.Size = New System.Drawing.Size(40, 20) Me.nudLimit.Size = New System.Drawing.Size(40, 20)
Me.nudLimit.TabIndex = 17 Me.nudLimit.TabIndex = 17
Me.nudLimit.Value = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Visible = False Me.nudLimit.Visible = False
' '
'btnExclude 'btnExclude
+1 -1
View File
@@ -1139,7 +1139,7 @@ Public Class frmGameManager
If chkTimeStamp.Checked Then If chkTimeStamp.Checked Then
nudLimit.Visible = True nudLimit.Visible = True
lblLimit.Visible = True lblLimit.Visible = True
nudLimit.Value = 5 nudLimit.Value = 0
Else Else
nudLimit.Visible = False nudLimit.Visible = False
nudLimit.Value = nudLimit.Minimum nudLimit.Value = nudLimit.Minimum
+9 -22
View File
@@ -28,7 +28,6 @@ Partial Class frmSyncFields
Me.chkVersion = New System.Windows.Forms.CheckBox() Me.chkVersion = New System.Windows.Forms.CheckBox()
Me.chkCompany = New System.Windows.Forms.CheckBox() Me.chkCompany = New System.Windows.Forms.CheckBox()
Me.chkGamePath = New System.Windows.Forms.CheckBox() Me.chkGamePath = New System.Windows.Forms.CheckBox()
Me.chkTimeStamp = New System.Windows.Forms.CheckBox()
Me.btnCancel = New System.Windows.Forms.Button() Me.btnCancel = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button() Me.btnSave = New System.Windows.Forms.Button()
Me.grpFields.SuspendLayout() Me.grpFields.SuspendLayout()
@@ -41,10 +40,9 @@ Partial Class frmSyncFields
Me.grpFields.Controls.Add(Me.chkVersion) Me.grpFields.Controls.Add(Me.chkVersion)
Me.grpFields.Controls.Add(Me.chkCompany) Me.grpFields.Controls.Add(Me.chkCompany)
Me.grpFields.Controls.Add(Me.chkGamePath) Me.grpFields.Controls.Add(Me.chkGamePath)
Me.grpFields.Controls.Add(Me.chkTimeStamp)
Me.grpFields.Location = New System.Drawing.Point(12, 12) Me.grpFields.Location = New System.Drawing.Point(12, 12)
Me.grpFields.Name = "grpFields" Me.grpFields.Name = "grpFields"
Me.grpFields.Size = New System.Drawing.Size(195, 162) Me.grpFields.Size = New System.Drawing.Size(195, 135)
Me.grpFields.TabIndex = 0 Me.grpFields.TabIndex = 0
Me.grpFields.TabStop = False Me.grpFields.TabStop = False
Me.grpFields.Text = "Available Fields" Me.grpFields.Text = "Available Fields"
@@ -52,7 +50,7 @@ Partial Class frmSyncFields
'chkMonitorGame 'chkMonitorGame
' '
Me.chkMonitorGame.AutoSize = True Me.chkMonitorGame.AutoSize = True
Me.chkMonitorGame.Location = New System.Drawing.Point(6, 134) Me.chkMonitorGame.Location = New System.Drawing.Point(6, 111)
Me.chkMonitorGame.Name = "chkMonitorGame" Me.chkMonitorGame.Name = "chkMonitorGame"
Me.chkMonitorGame.Size = New System.Drawing.Size(109, 17) Me.chkMonitorGame.Size = New System.Drawing.Size(109, 17)
Me.chkMonitorGame.TabIndex = 5 Me.chkMonitorGame.TabIndex = 5
@@ -62,7 +60,7 @@ Partial Class frmSyncFields
'chkIcon 'chkIcon
' '
Me.chkIcon.AutoSize = True Me.chkIcon.AutoSize = True
Me.chkIcon.Location = New System.Drawing.Point(6, 111) Me.chkIcon.Location = New System.Drawing.Point(6, 88)
Me.chkIcon.Name = "chkIcon" Me.chkIcon.Name = "chkIcon"
Me.chkIcon.Size = New System.Drawing.Size(148, 17) Me.chkIcon.Size = New System.Drawing.Size(148, 17)
Me.chkIcon.TabIndex = 4 Me.chkIcon.TabIndex = 4
@@ -72,7 +70,7 @@ Partial Class frmSyncFields
'chkVersion 'chkVersion
' '
Me.chkVersion.AutoSize = True Me.chkVersion.AutoSize = True
Me.chkVersion.Location = New System.Drawing.Point(6, 88) Me.chkVersion.Location = New System.Drawing.Point(6, 65)
Me.chkVersion.Name = "chkVersion" Me.chkVersion.Name = "chkVersion"
Me.chkVersion.Size = New System.Drawing.Size(61, 17) Me.chkVersion.Size = New System.Drawing.Size(61, 17)
Me.chkVersion.TabIndex = 3 Me.chkVersion.TabIndex = 3
@@ -82,7 +80,7 @@ Partial Class frmSyncFields
'chkCompany 'chkCompany
' '
Me.chkCompany.AutoSize = True Me.chkCompany.AutoSize = True
Me.chkCompany.Location = New System.Drawing.Point(6, 65) Me.chkCompany.Location = New System.Drawing.Point(6, 42)
Me.chkCompany.Name = "chkCompany" Me.chkCompany.Name = "chkCompany"
Me.chkCompany.Size = New System.Drawing.Size(70, 17) Me.chkCompany.Size = New System.Drawing.Size(70, 17)
Me.chkCompany.TabIndex = 2 Me.chkCompany.TabIndex = 2
@@ -92,27 +90,17 @@ Partial Class frmSyncFields
'chkGamePath 'chkGamePath
' '
Me.chkGamePath.AutoSize = True Me.chkGamePath.AutoSize = True
Me.chkGamePath.Location = New System.Drawing.Point(6, 42) Me.chkGamePath.Location = New System.Drawing.Point(6, 19)
Me.chkGamePath.Name = "chkGamePath" Me.chkGamePath.Name = "chkGamePath"
Me.chkGamePath.Size = New System.Drawing.Size(180, 17) Me.chkGamePath.Size = New System.Drawing.Size(180, 17)
Me.chkGamePath.TabIndex = 1 Me.chkGamePath.TabIndex = 1
Me.chkGamePath.Text = "Game Path (Not Recommended)" Me.chkGamePath.Text = "Game Path (Not Recommended)"
Me.chkGamePath.UseVisualStyleBackColor = True Me.chkGamePath.UseVisualStyleBackColor = True
' '
'chkTimeStamp
'
Me.chkTimeStamp.AutoSize = True
Me.chkTimeStamp.Location = New System.Drawing.Point(6, 19)
Me.chkTimeStamp.Name = "chkTimeStamp"
Me.chkTimeStamp.Size = New System.Drawing.Size(133, 17)
Me.chkTimeStamp.TabIndex = 0
Me.chkTimeStamp.Text = "Save multiple backups"
Me.chkTimeStamp.UseVisualStyleBackColor = True
'
'btnCancel 'btnCancel
' '
Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnCancel.Location = New System.Drawing.Point(132, 180) Me.btnCancel.Location = New System.Drawing.Point(132, 153)
Me.btnCancel.Name = "btnCancel" Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 2 Me.btnCancel.TabIndex = 2
@@ -122,7 +110,7 @@ Partial Class frmSyncFields
'btnSave 'btnSave
' '
Me.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK Me.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnSave.Location = New System.Drawing.Point(52, 180) Me.btnSave.Location = New System.Drawing.Point(52, 153)
Me.btnSave.Name = "btnSave" Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23) Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 1 Me.btnSave.TabIndex = 1
@@ -133,7 +121,7 @@ Partial Class frmSyncFields
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(219, 211) Me.ClientSize = New System.Drawing.Size(219, 186)
Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave) Me.Controls.Add(Me.btnSave)
Me.Controls.Add(Me.grpFields) Me.Controls.Add(Me.grpFields)
@@ -157,7 +145,6 @@ Partial Class frmSyncFields
Friend WithEvents chkVersion As CheckBox Friend WithEvents chkVersion As CheckBox
Friend WithEvents chkCompany As CheckBox Friend WithEvents chkCompany As CheckBox
Friend WithEvents chkGamePath As CheckBox Friend WithEvents chkGamePath As CheckBox
Friend WithEvents chkTimeStamp As CheckBox
Friend WithEvents btnCancel As Button Friend WithEvents btnCancel As Button
Friend WithEvents btnSave As Button Friend WithEvents btnSave As Button
End Class End Class
-12
View File
@@ -26,9 +26,6 @@ Public Class frmSyncFields
If (eSyncFields And clsGame.eOptionalSyncFields.MonitorGame) = clsGame.eOptionalSyncFields.MonitorGame Then If (eSyncFields And clsGame.eOptionalSyncFields.MonitorGame) = clsGame.eOptionalSyncFields.MonitorGame Then
chkMonitorGame.Checked = True chkMonitorGame.Checked = True
End If End If
If (eSyncFields And clsGame.eOptionalSyncFields.TimeStamp) = clsGame.eOptionalSyncFields.TimeStamp Then
chkTimeStamp.Checked = True
End If
If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then
chkVersion.Checked = True chkVersion.Checked = True
End If End If
@@ -47,7 +44,6 @@ Public Class frmSyncFields
chkVersion.Text = frmSyncFields_chkVersion chkVersion.Text = frmSyncFields_chkVersion
chkCompany.Text = frmSyncFields_chkCompany chkCompany.Text = frmSyncFields_chkCompany
chkGamePath.Text = frmSyncFields_chkGamePath chkGamePath.Text = frmSyncFields_chkGamePath
chkTimeStamp.Text = frmSyncFields_chkTimeStamp
End Sub End Sub
Private Sub frmSyncFields_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub frmSyncFields_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@@ -65,14 +61,6 @@ Public Class frmSyncFields
Me.Close() Me.Close()
End Sub End Sub
Private Sub chkTimeStamp_CheckedChanged(sender As Object, e As EventArgs) Handles chkTimeStamp.CheckedChanged
If chkTimeStamp.Checked Then
SyncFields = clsGame.SetSyncField(SyncFields, clsGame.eOptionalSyncFields.TimeStamp)
Else
SyncFields = clsGame.RemoveSyncField(SyncFields, clsGame.eOptionalSyncFields.TimeStamp)
End If
End Sub
Private Sub chkGamePath_CheckedChanged(sender As Object, e As EventArgs) Handles chkGamePath.CheckedChanged Private Sub chkGamePath_CheckedChanged(sender As Object, e As EventArgs) Handles chkGamePath.CheckedChanged
If chkGamePath.Checked Then If chkGamePath.Checked Then
SyncFields = clsGame.SetSyncField(SyncFields, clsGame.eOptionalSyncFields.GamePath) SyncFields = clsGame.SetSyncField(SyncFields, clsGame.eOptionalSyncFields.GamePath)
+6 -15
View File
@@ -373,8 +373,6 @@ Public Class mgrMonitorList
Dim sVersion As String Dim sVersion As String
Dim sCompany As String Dim sCompany As String
Dim sMonitorGame As String Dim sMonitorGame As String
Dim sTimeStamp As String
Dim sBackupLimit As String
'Setup SQL for optional fields 'Setup SQL for optional fields
If (eSyncFields And clsGame.eOptionalSyncFields.Company) = clsGame.eOptionalSyncFields.Company Then If (eSyncFields And clsGame.eOptionalSyncFields.Company) = clsGame.eOptionalSyncFields.Company Then
@@ -397,13 +395,6 @@ Public Class mgrMonitorList
Else Else
sMonitorGame = "COALESCE((SELECT Enabled FROM monitorlist WHERE MonitorID=@ID),1)" sMonitorGame = "COALESCE((SELECT Enabled FROM monitorlist WHERE MonitorID=@ID),1)"
End If End If
If (eSyncFields And clsGame.eOptionalSyncFields.TimeStamp) = clsGame.eOptionalSyncFields.TimeStamp Then
sTimeStamp = "@TimeStamp"
sBackupLimit = "@BackupLimit"
Else
sTimeStamp = "COALESCE((SELECT TimeStamp FROM monitorlist WHERE MonitorID=@ID),0)"
sBackupLimit = "COALESCE((SELECT BackupLimit FROM monitorlist WHERE MonitorID=@ID),2)"
End If
If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then
sVersion = "@Version" sVersion = "@Version"
Else Else
@@ -412,9 +403,9 @@ Public Class mgrMonitorList
sSQL = "INSERT OR REPLACE INTO monitorlist (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx) " sSQL = "INSERT OR REPLACE INTO monitorlist (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx) "
sSQL &= "VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, " sSQL &= "VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, "
sSQL &= sTimeStamp & ", @ExcludeList, " & sGamePath & ", " sSQL &= "@TimeStamp, @ExcludeList, " & sGamePath & ", "
sSQL &= sIcon & ", @Hours, " & sVersion & ", " sSQL &= sIcon & ", @Hours, " & sVersion & ", "
sSQL &= sCompany & ", " & sMonitorGame & ", @MonitorOnly, " & sBackupLimit & ", @CleanFolder, @Parameter, @Comments, @IsRegEx);" sSQL &= sCompany & ", " & sMonitorGame & ", @MonitorOnly, @BackupLimit, @CleanFolder, @Parameter, @Comments, @IsRegEx);"
For Each oGame As clsGame In hshGames.Values For Each oGame As clsGame In hshGames.Values
hshParams = New Hashtable hshParams = New Hashtable
@@ -426,6 +417,8 @@ Public Class mgrMonitorList
hshParams.Add("Path", oGame.TruePath) hshParams.Add("Path", oGame.TruePath)
hshParams.Add("AbsolutePath", oGame.AbsolutePath) hshParams.Add("AbsolutePath", oGame.AbsolutePath)
hshParams.Add("FolderSave", oGame.FolderSave) hshParams.Add("FolderSave", oGame.FolderSave)
hshParams.Add("TimeStamp", oGame.AppendTimeStamp)
hshParams.Add("BackupLimit", oGame.BackupLimit)
hshParams.Add("FileType", oGame.FileType) hshParams.Add("FileType", oGame.FileType)
hshParams.Add("ExcludeList", oGame.ExcludeList) hshParams.Add("ExcludeList", oGame.ExcludeList)
hshParams.Add("Hours", oGame.Hours) hshParams.Add("Hours", oGame.Hours)
@@ -448,10 +441,6 @@ Public Class mgrMonitorList
If (eSyncFields And clsGame.eOptionalSyncFields.MonitorGame) = clsGame.eOptionalSyncFields.MonitorGame Then If (eSyncFields And clsGame.eOptionalSyncFields.MonitorGame) = clsGame.eOptionalSyncFields.MonitorGame Then
hshParams.Add("Enabled", oGame.Enabled) hshParams.Add("Enabled", oGame.Enabled)
End If End If
If (eSyncFields And clsGame.eOptionalSyncFields.TimeStamp) = clsGame.eOptionalSyncFields.TimeStamp Then
hshParams.Add("TimeStamp", oGame.AppendTimeStamp)
hshParams.Add("BackupLimit", oGame.BackupLimit)
End If
If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then
hshParams.Add("Version", oGame.Version) hshParams.Add("Version", oGame.Version)
End If End If
@@ -778,6 +767,8 @@ Public Class mgrMonitorList
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path")) If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
oGame.AbsolutePath = CBool(dr("AbsolutePath")) oGame.AbsolutePath = CBool(dr("AbsolutePath"))
oGame.FolderSave = CBool(dr("FolderSave")) oGame.FolderSave = CBool(dr("FolderSave"))
oGame.AppendTimeStamp = CBool(dr("TimeStamp"))
oGame.BackupLimit = CInt(dr("BackupLimit"))
If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType")) If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType"))
If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList")) If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList"))
oGame.MonitorOnly = CBool(dr("MonitorOnly")) oGame.MonitorOnly = CBool(dr("MonitorOnly"))
+1 -1
View File
@@ -19,7 +19,7 @@ Public Class mgrSettings
Private s7zArguments As String = String.Empty Private s7zArguments As String = String.Empty
Private s7zLocation As String = String.Empty Private s7zLocation As String = String.Empty
Private sBackupFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).TrimEnd(New Char() {"\", "/"}) Private sBackupFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).TrimEnd(New Char() {"\", "/"})
Private eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None Or clsGame.eOptionalSyncFields.TimeStamp Private eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None
Private eMessages As eSuppressMessages = eSuppressMessages.None Private eMessages As eSuppressMessages = eSuppressMessages.None
Private bAutoSaveLog As Boolean = False Private bAutoSaveLog As Boolean = False
Private bBackupOnLaunch As Boolean = True Private bBackupOnLaunch As Boolean = True
+2
View File
@@ -33,6 +33,8 @@ Public Class mgrXML
oGame.AbsolutePath = g.AbsolutePath oGame.AbsolutePath = g.AbsolutePath
oGame.Path = g.Path oGame.Path = g.Path
oGame.FolderSave = g.FolderSave oGame.FolderSave = g.FolderSave
oGame.AppendTimeStamp = g.AppendTimeStamp
oGame.BackupLimit = g.BackupLimit
oGame.FileType = g.FileType oGame.FileType = g.FileType
oGame.ExcludeList = g.ExcludeList oGame.ExcludeList = g.ExcludeList
oGame.MonitorOnly = g.MonitorOnly oGame.MonitorOnly = g.MonitorOnly