Added ability to edit game ID and updated validation

This commit is contained in:
MikeMaximus
2018-03-02 12:00:00 -06:00
parent c2a752573a
commit 609ee09cfa
6 changed files with 143 additions and 55 deletions
+4 -15
View File
@@ -264,22 +264,11 @@ Public Class frmAddWizard
End Function
Private Sub DoSave()
Dim hshDupeCheck As New Hashtable
Dim sNewGame As String = oGameToSave.CompoundKey
For Each o As clsGame In GameData.Values
hshDupeCheck.Add(o.CompoundKey, String.Empty)
Next
If hshDupeCheck.Contains(sNewGame) Then
mgrCommon.ShowMessage(frmAddWizard_ErrorGameDupe, MsgBoxStyle.Exclamation)
Else
mgrMonitorList.DoListAdd(oGameToSave)
If mgrCommon.ShowMessage(frmAddWizard_ConfirmSaveTags, New String() {oGameToSave.Name, oGameToSave.Name}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
OpenTags(oGameToSave)
End If
Me.Close()
mgrMonitorList.DoListAdd(oGameToSave)
If mgrCommon.ShowMessage(frmAddWizard_ConfirmSaveTags, New String() {oGameToSave.Name, oGameToSave.Name}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
OpenTags(oGameToSave)
End If
Me.Close()
End Sub
Private Sub ValidateBack()
+30 -18
View File
@@ -101,6 +101,7 @@ Partial Class frmGameManager
Me.cmsDeleteBackup = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.cmsDeleteOne = New System.Windows.Forms.ToolStripMenuItem()
Me.cmsDeleteAll = New System.Windows.Forms.ToolStripMenuItem()
Me.btnGameID = New System.Windows.Forms.Button()
Me.grpConfig.SuspendLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.grpExtra.SuspendLayout()
@@ -157,6 +158,7 @@ Partial Class frmGameManager
'grpConfig
'
Me.grpConfig.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.grpConfig.Controls.Add(Me.btnGameID)
Me.grpConfig.Controls.Add(Me.chkRegEx)
Me.grpConfig.Controls.Add(Me.lblComments)
Me.grpConfig.Controls.Add(Me.txtComments)
@@ -194,7 +196,7 @@ Partial Class frmGameManager
Me.chkRegEx.Location = New System.Drawing.Point(402, 46)
Me.chkRegEx.Name = "chkRegEx"
Me.chkRegEx.Size = New System.Drawing.Size(117, 17)
Me.chkRegEx.TabIndex = 5
Me.chkRegEx.TabIndex = 6
Me.chkRegEx.Text = "Regular Expression"
Me.chkRegEx.UseVisualStyleBackColor = True
'
@@ -204,7 +206,7 @@ Partial Class frmGameManager
Me.lblComments.Location = New System.Drawing.Point(7, 181)
Me.lblComments.Name = "lblComments"
Me.lblComments.Size = New System.Drawing.Size(59, 13)
Me.lblComments.TabIndex = 18
Me.lblComments.TabIndex = 19
Me.lblComments.Text = "Comments:"
'
'txtComments
@@ -214,14 +216,14 @@ Partial Class frmGameManager
Me.txtComments.Name = "txtComments"
Me.txtComments.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtComments.Size = New System.Drawing.Size(413, 71)
Me.txtComments.TabIndex = 19
Me.txtComments.TabIndex = 20
'
'txtParameter
'
Me.txtParameter.Location = New System.Drawing.Point(70, 71)
Me.txtParameter.Name = "txtParameter"
Me.txtParameter.Size = New System.Drawing.Size(414, 20)
Me.txtParameter.TabIndex = 7
Me.txtParameter.TabIndex = 8
'
'lblParameter
'
@@ -229,7 +231,7 @@ Partial Class frmGameManager
Me.lblParameter.Location = New System.Drawing.Point(7, 74)
Me.lblParameter.Name = "lblParameter"
Me.lblParameter.Size = New System.Drawing.Size(58, 13)
Me.lblParameter.TabIndex = 6
Me.lblParameter.TabIndex = 7
Me.lblParameter.Text = "Parameter:"
'
'chkCleanFolder
@@ -248,7 +250,7 @@ Partial Class frmGameManager
Me.lblLimit.Location = New System.Drawing.Point(376, 157)
Me.lblLimit.Name = "lblLimit"
Me.lblLimit.Size = New System.Drawing.Size(68, 13)
Me.lblLimit.TabIndex = 17
Me.lblLimit.TabIndex = 18
Me.lblLimit.Text = "Backup Limit"
Me.lblLimit.Visible = False
'
@@ -258,7 +260,7 @@ Partial Class frmGameManager
Me.nudLimit.Minimum = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Name = "nudLimit"
Me.nudLimit.Size = New System.Drawing.Size(40, 20)
Me.nudLimit.TabIndex = 16
Me.nudLimit.TabIndex = 17
Me.nudLimit.Value = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Visible = False
'
@@ -267,7 +269,7 @@ Partial Class frmGameManager
Me.btnExclude.Location = New System.Drawing.Point(10, 152)
Me.btnExclude.Name = "btnExclude"
Me.btnExclude.Size = New System.Drawing.Size(175, 23)
Me.btnExclude.TabIndex = 12
Me.btnExclude.TabIndex = 15
Me.btnExclude.Text = "E&xclude Items..."
Me.btnExclude.UseVisualStyleBackColor = True
'
@@ -276,14 +278,14 @@ Partial Class frmGameManager
Me.btnInclude.Location = New System.Drawing.Point(10, 123)
Me.btnInclude.Name = "btnInclude"
Me.btnInclude.Size = New System.Drawing.Size(175, 23)
Me.btnInclude.TabIndex = 11
Me.btnInclude.TabIndex = 12
Me.btnInclude.Text = "In&clude Items..."
Me.btnInclude.UseVisualStyleBackColor = True
'
'txtID
'
Me.txtID.Enabled = False
Me.txtID.Location = New System.Drawing.Point(489, 19)
Me.txtID.Location = New System.Drawing.Point(489, 180)
Me.txtID.Name = "txtID"
Me.txtID.Size = New System.Drawing.Size(30, 20)
Me.txtID.TabIndex = 0
@@ -295,7 +297,7 @@ Partial Class frmGameManager
Me.btnSavePathBrowse.Location = New System.Drawing.Point(490, 97)
Me.btnSavePathBrowse.Name = "btnSavePathBrowse"
Me.btnSavePathBrowse.Size = New System.Drawing.Size(30, 20)
Me.btnSavePathBrowse.TabIndex = 10
Me.btnSavePathBrowse.TabIndex = 11
Me.btnSavePathBrowse.Text = "..."
Me.btnSavePathBrowse.UseVisualStyleBackColor = True
'
@@ -304,7 +306,7 @@ Partial Class frmGameManager
Me.btnProcessBrowse.Location = New System.Drawing.Point(366, 44)
Me.btnProcessBrowse.Name = "btnProcessBrowse"
Me.btnProcessBrowse.Size = New System.Drawing.Size(30, 20)
Me.btnProcessBrowse.TabIndex = 4
Me.btnProcessBrowse.TabIndex = 5
Me.btnProcessBrowse.Text = "..."
Me.btnProcessBrowse.UseVisualStyleBackColor = True
'
@@ -314,7 +316,7 @@ Partial Class frmGameManager
Me.lblSavePath.Location = New System.Drawing.Point(7, 101)
Me.lblSavePath.Name = "lblSavePath"
Me.lblSavePath.Size = New System.Drawing.Size(60, 13)
Me.lblSavePath.TabIndex = 8
Me.lblSavePath.TabIndex = 9
Me.lblSavePath.Text = "Save Path:"
'
'lblProcess
@@ -323,7 +325,7 @@ Partial Class frmGameManager
Me.lblProcess.Location = New System.Drawing.Point(7, 47)
Me.lblProcess.Name = "lblProcess"
Me.lblProcess.Size = New System.Drawing.Size(48, 13)
Me.lblProcess.TabIndex = 2
Me.lblProcess.TabIndex = 3
Me.lblProcess.Text = "Process:"
'
'lblName
@@ -359,7 +361,7 @@ Partial Class frmGameManager
Me.chkTimeStamp.Location = New System.Drawing.Point(191, 156)
Me.chkTimeStamp.Name = "chkTimeStamp"
Me.chkTimeStamp.Size = New System.Drawing.Size(133, 17)
Me.chkTimeStamp.TabIndex = 15
Me.chkTimeStamp.TabIndex = 16
Me.chkTimeStamp.Text = "Save multiple backups"
Me.chkTimeStamp.UseVisualStyleBackColor = True
'
@@ -378,20 +380,20 @@ Partial Class frmGameManager
Me.txtSavePath.Location = New System.Drawing.Point(70, 97)
Me.txtSavePath.Name = "txtSavePath"
Me.txtSavePath.Size = New System.Drawing.Size(414, 20)
Me.txtSavePath.TabIndex = 9
Me.txtSavePath.TabIndex = 10
'
'txtProcess
'
Me.txtProcess.Location = New System.Drawing.Point(70, 44)
Me.txtProcess.Name = "txtProcess"
Me.txtProcess.Size = New System.Drawing.Size(290, 20)
Me.txtProcess.TabIndex = 3
Me.txtProcess.TabIndex = 4
'
'txtName
'
Me.txtName.Location = New System.Drawing.Point(70, 19)
Me.txtName.Name = "txtName"
Me.txtName.Size = New System.Drawing.Size(414, 20)
Me.txtName.Size = New System.Drawing.Size(326, 20)
Me.txtName.TabIndex = 1
'
'chkMonitorOnly
@@ -873,6 +875,15 @@ Partial Class frmGameManager
Me.cmsDeleteAll.Size = New System.Drawing.Size(114, 22)
Me.cmsDeleteAll.Text = "&All Files"
'
'btnGameID
'
Me.btnGameID.Location = New System.Drawing.Point(402, 17)
Me.btnGameID.Name = "btnGameID"
Me.btnGameID.Size = New System.Drawing.Size(117, 23)
Me.btnGameID.TabIndex = 2
Me.btnGameID.Text = "&Game ID..."
Me.btnGameID.UseVisualStyleBackColor = True
'
'frmGameManager
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -1000,4 +1011,5 @@ Partial Class frmGameManager
Friend WithEvents lblComments As Label
Friend WithEvents txtComments As TextBox
Friend WithEvents chkRegEx As CheckBox
Friend WithEvents btnGameID As Button
End Class
+56 -7
View File
@@ -430,6 +430,28 @@ Public Class frmGameManager
IsLoading = False
End Sub
Private Sub OpenGameIDEdit()
Dim sCurrentID As String
Dim sNewID As String
If txtID.Text = String.Empty Then
txtID.Text = Guid.NewGuid.ToString
End If
sCurrentID = txtID.Text
sNewID = InputBox(frmGameManager_GameIDEditInfo, frmGameManager_GameIDEditTitle, sCurrentID)
If sNewID <> String.Empty Then
txtID.Text = sNewID
If sCurrentID <> sNewID Then
UpdateGenericButtonLabel(frmGameManager_btnGameID, btnGameID, True)
End If
End If
End Sub
Private Sub OpenBackupFile()
Dim sFileName As String
Dim oProcessStartInfo As ProcessStartInfo
@@ -463,6 +485,16 @@ Public Class frmGameManager
End If
End Sub
Private Sub UpdateGenericButtonLabel(ByVal sLabel As String, ByVal btn As Button, ByVal bDirty As Boolean)
btn.Text = sLabel
If bDirty Then
btn.Font = New Font(FontFamily.GenericSansSerif, 8.25, FontStyle.Bold)
Else
btn.Font = New Font(FontFamily.GenericSansSerif, 8.25, FontStyle.Regular)
End If
End Sub
Private Function GetBuilderRoot() As String
Dim sRoot As String = String.Empty
@@ -750,6 +782,7 @@ Public Class frmGameManager
'Update Buttons
UpdateBuilderButtonLabel(oApp.FileType, frmGameManager_IncludeShortcut, btnInclude, False)
UpdateBuilderButtonLabel(oApp.ExcludeList, frmGameManager_ExcludeShortcut, btnExclude, False)
UpdateGenericButtonLabel(frmGameManager_btnGameID, btnGameID, False)
'Extra
txtAppPath.Text = oApp.ProcessPath
@@ -975,6 +1008,9 @@ Public Class frmGameManager
btnExclude.Text = frmGameManager_btnExclude
btnImport.Enabled = True
btnExport.Enabled = True
UpdateGenericButtonLabel(frmGameManager_IncludeShortcut, btnInclude, False)
UpdateGenericButtonLabel(frmGameManager_ExcludeShortcut, btnExclude, False)
UpdateGenericButtonLabel(frmGameManager_btnGameID, btnGameID, False)
Case eModes.MultiSelect
lstGames.Enabled = True
lblQuickFilter.Enabled = False
@@ -1163,17 +1199,17 @@ Public Class frmGameManager
Select Case eCurrentMode
Case eModes.Add
If CoreValidatation(oApp) Then
If CoreValidatation(oApp, True) Then
bSuccess = True
mgrMonitorList.DoListAdd(oApp)
SaveTags(oApp.ID)
eCurrentMode = eModes.View
End If
Case eModes.Edit
If CoreValidatation(oApp) Then
If CoreValidatation(oApp, False) Then
bSuccess = True
mgrMonitorList.DoListUpdate(oApp)
CheckManifestandUpdate(oCurrentGame, oApp)
mgrMonitorList.DoListUpdate(oApp, CurrentGame.ID)
eCurrentMode = eModes.View
End If
Case eModes.MultiSelect
@@ -1250,7 +1286,15 @@ Public Class frmGameManager
End If
End Sub
Private Function CoreValidatation(ByVal oApp As clsGame) As Boolean
Private Function CoreValidatation(ByVal oApp As clsGame, ByVal bNewGame As Boolean) As Boolean
Dim sCurrentID As String
If bNewGame Then
sCurrentID = String.Empty
Else
sCurrentID = CurrentGame.ID
End If
If txtName.Text.Trim = String.Empty Then
mgrCommon.ShowMessage(frmGameManager_ErrorValidName, MsgBoxStyle.Exclamation)
txtName.Focus()
@@ -1269,14 +1313,14 @@ Public Class frmGameManager
Return False
End If
If mgrMonitorList.DoDuplicateListCheck(oApp.Name, oApp.ProcessName, , oApp.ID) Then
mgrCommon.ShowMessage(frmGameManager_ErrorGameDupe, MsgBoxStyle.Exclamation)
If mgrMonitorList.DoDuplicateListCheck(oApp.ID, , sCurrentID) Then
mgrCommon.ShowMessage(frmGameManager_ErrorGameDupe, oApp.ID, MsgBoxStyle.Exclamation)
txtName.Focus()
Return False
End If
If oApp.Parameter <> String.Empty Then
If mgrMonitorList.DoDuplicateParameterCheck(oApp.ProcessName, oApp.Parameter, , oApp.ID) Then
If mgrMonitorList.DoDuplicateParameterCheck(oApp.ProcessName, oApp.Parameter, , sCurrentID) Then
mgrCommon.ShowMessage(frmGameManager_ErrorProcessParameterDupe, MsgBoxStyle.Exclamation)
Return False
End If
@@ -1537,6 +1581,7 @@ Public Class frmGameManager
cmsDeleteAll.Text = frmGameManager_cmsDeleteAll
lblComments.Text = frmGameManager_lblComments
chkRegEx.Text = frmGameManager_chkRegEx
btnGameID.Text = frmGameManager_btnGameID
'Init Filter Timer
tmFilterTimer = New Timer()
@@ -1716,6 +1761,10 @@ Public Class frmGameManager
ExportGameList()
End Sub
Private Sub btnGameID_Click(sender As Object, e As EventArgs) Handles btnGameID.Click
OpenGameIDEdit()
End Sub
Private Sub txtQuickFilter_TextChanged(sender As Object, e As EventArgs) Handles txtQuickFilter.TextChanged
If Not tmFilterTimer.Enabled Then
tmFilterTimer.Enabled = True