From abbc6a4a70c80d6a9ce3aa3aa133c89cb53d0388 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Sat, 6 Feb 2016 09:28:39 -0600 Subject: [PATCH] Update for issue #33 --- GBM/Forms/frmGameManager.vb | 11 ++--------- GBM/Managers/mgrBackup.vb | 2 +- GBM/Managers/mgrCommon.vb | 20 ++++++++++++++++++++ GBM/My Project/Resources.Designer.vb | 2 +- GBM/My Project/Resources.resx | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 040e99c..cff0a5a 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -518,8 +518,7 @@ Public Class frmGameManager Private Sub GetBackupInfo(ByVal oApp As clsGame) Dim oBackupInfo As clsBackup Dim sFileName As String - Dim oFileInfo As FileInfo - Dim dFileSize As Double + If oRemoteBackupData.Contains(oApp.Name) Then CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.Name), clsBackup) @@ -532,13 +531,7 @@ Public Class frmGameManager btnDeleteBackup.Enabled = True If File.Exists(sFileName) Then - oFileInfo = New FileInfo(sFileName) - dFileSize = oFileInfo.Length - If dFileSize > 1048576 Then - txtFileSize.Text = mgrCommon.FormatString(App_MB, Math.Round(dFileSize / 1048576, 2).ToString) - Else - txtFileSize.Text = mgrCommon.FormatString(App_KB, Math.Round(dFileSize / 1024, 2).ToString) - End If + txtFileSize.Text = mgrCommon.GetFileSize(sFileName) Else txtFileSize.Text = frmGameManager_ErrorNoBackupExists End If diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index ac51163..9f36ec8 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -186,7 +186,7 @@ Public Class mgrBackup prs7z.WaitForExit() If Not CancelOperation Then If prs7z.ExitCode = 0 Then - RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_BackupComplete, oGame.Name), False, ToolTipIcon.Info, True) + RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_BackupComplete, New String() {oGame.Name, mgrCommon.GetFileSize(sBackupFile)}), False, ToolTipIcon.Info, True) bBackupCompleted = True Else RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_BackupWarnings, oGame.Name), True, ToolTipIcon.Warning, True) diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index b3a49eb..a1e39fa 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -142,6 +142,26 @@ Public Class mgrCommon End Try End Sub + 'Get a file size + Public Shared Function GetFileSize(ByVal sFile As String) As String + Dim oFileInfo As FileInfo + Dim dFileSize As Double + + Try + oFileInfo = New FileInfo(sFile) + dFileSize = oFileInfo.Length + If dFileSize > 1048576 Then + Return FormatString(App_MB, Math.Round(dFileSize / 1048576, 2).ToString) + Else + Return FormatString(App_KB, Math.Round(dFileSize / 1024, 2).ToString) + End If + Catch ex As Exception + Return String.Empty + End Try + End Function + + + 'Handles no extra parameters Public Shared Function ShowMessage(ByVal sMsg As String, ByVal oType As MsgBoxStyle) As MsgBoxResult Dim oResult As MsgBoxResult diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index bb9ab36..88d4369 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -3737,7 +3737,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to [PARAM] backup completed.. + ''' Looks up a localized string similar to [PARAM] backup ([PARAM]) completed. . ''' Friend ReadOnly Property mgrBackup_BackupComplete() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 066490c..a6f37b1 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1313,7 +1313,7 @@ [PARAM] backup failed - [PARAM] backup completed. + [PARAM] backup ([PARAM]) completed. Backup of [PARAM] in progress...