- riportata correzione backup

This commit is contained in:
Emmanuele Sassi
2025-05-22 16:52:08 +02:00
parent a9e463141e
commit 51707cc973
2 changed files with 22 additions and 6 deletions
@@ -1171,9 +1171,16 @@ Public Class ConfigurationPageVM
Dim sDayDir As String = sMonthDir & "\" & nDay
Dim VersionList() As String = Directory.GetFiles(sDayDir)
If VersionList.Length > 0 Then
Dim nMaxVersion As Int64 = VersionList.Max(Function(x) Int64.Parse(Path.GetFileNameWithoutExtension(x)))
sRestorePath = sDayDir & "\" & nMaxVersion & ".bwbck"
Exit For
Dim nMaxVersion As Int64 = 0
For Each item As String In VersionList
Dim nTmp As Int64 = 0
Int64.TryParse(Path.GetFileNameWithoutExtension(item), nTmp)
nMaxVersion = Math.Max(nMaxVersion, nTmp)
Next
If nMaxVersion > 0 Then
sRestorePath = sDayDir & "\" & nMaxVersion & ".bwbck"
Exit For
End If
End If
Next
If Not String.IsNullOrEmpty(sRestorePath) Then Exit For
@@ -1183,6 +1190,8 @@ Public Class ConfigurationPageVM
End If
If String.IsNullOrEmpty(sRestorePath) Then
MessageBox.Show(EgtMsg(62106), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Restore impossible! Last backup not found!
m_bRestoreRunning = False
Return
End If
If MessageBox.Show(String.Format(EgtMsg(62107), nYear, nMonth, nDay), EgtMsg(15002), MessageBoxButton.OKCancel, MessageBoxImage.Warning) <> MessageBoxResult.OK Then 'Are you sure you want to restore the last backup from {0}\{1}\{2}? If you proceed you will lose actual data!
m_bRestoreRunning = False
@@ -218,9 +218,16 @@ Public Class MainWindowVM
Dim sDayDir As String = sMonthDir & "\" & nDay
Dim VersionList() As String = Directory.GetFiles(sDayDir)
If VersionList.Length > 0 Then
Dim nMaxVersion As Int64 = VersionList.Max(Function(x) Int64.Parse(Path.GetFileNameWithoutExtension(x)))
LastBackupDate = New Date(nYear, nMonth, nDay)
Exit For
Dim nMaxVersion As Int64 = 0
For Each item As String In VersionList
Dim nTmp As Int64 = 0
Int64.TryParse(Path.GetFileNameWithoutExtension(item), nTmp)
nMaxVersion = Math.Max(nMaxVersion, nTmp)
Next
If nMaxVersion > 0 Then
LastBackupDate = New Date(nYear, nMonth, nDay)
Exit For
End If
End If
Next
If LastBackupDate <> Date.MinValue Then Exit For