Core changes for games and backup manifest

This commit is contained in:
MikeMaximus
2018-03-01 10:11:32 -06:00
parent dff3432c27
commit d07fc57dad
13 changed files with 206 additions and 236 deletions
+11 -7
View File
@@ -1,5 +1,6 @@
Public Class clsBackup
Private sBackupID As String = Guid.NewGuid.ToString
Private sMonitorID As String = String.Empty
Private sName As String = String.Empty
Private sFileName As String = String.Empty
Private sRestorePath As String = String.Empty
@@ -9,7 +10,7 @@
Private sUpdatedBy As String = String.Empty
Private sCheckSum As String = String.Empty
Property ID As String
Property ManifestID As String
Get
Return sBackupID
End Get
@@ -18,6 +19,15 @@
End Set
End Property
Property MonitorID As String
Get
Return sMonitorID
End Get
Set(value As String)
sMonitorID = value
End Set
End Property
Property Name As String
Get
Return sName
@@ -27,12 +37,6 @@
End Set
End Property
ReadOnly Property SafeName As String
Get
Return mgrPath.ValidateForFileSystem(sName)
End Get
End Property
ReadOnly Property CroppedName As String
Get
If Name.Length > 40 Then
+3 -25
View File
@@ -22,7 +22,6 @@ Public Class clsGame
Private sComments As String = String.Empty
Private bIsRegEx As Boolean = False
Private bDuplicate As Boolean = False
Private bTempGame As Boolean = False
Private oImportTags As New List(Of Tag)
<Flags()> Public Enum eOptionalSyncFields
@@ -37,7 +36,7 @@ Public Class clsGame
Property ID As String
Set(value As String)
sGameID = value
sGameID = mgrPath.ValidateForFileSystem(value)
End Set
Get
Return sGameID
@@ -46,7 +45,7 @@ Public Class clsGame
ReadOnly Property CompoundKey As String
Get
Return ProcessName & ":" & KeySafeName
Return ProcessName & ":" & ID
End Get
End Property
@@ -69,18 +68,6 @@ Public Class clsGame
End Get
End Property
ReadOnly Property FileSafeName As String
Get
Return mgrPath.ValidateForFileSystem(sGameName)
End Get
End Property
ReadOnly Property KeySafeName As String
Get
Return sGameName.Replace(":", "_")
End Get
End Property
Property ProcessName As String
Set(value As String)
sProcessName = value
@@ -273,15 +260,6 @@ Public Class clsGame
End Get
End Property
Property Temporary As Boolean
Get
Return bTempGame
End Get
Set(value As Boolean)
bTempGame = value
End Set
End Property
Property ImportTags As List(Of Tag)
Get
Return oImportTags
@@ -406,7 +384,7 @@ Public Class clsGame
If oGame Is Nothing Then
Return False
Else
If Name <> oGame.Name Then
If ID <> oGame.ID Then
Return False
End If
If ProcessName <> oGame.ProcessName Then
+1 -1
View File
@@ -265,7 +265,7 @@ Public Class frmAddWizard
Private Sub DoSave()
Dim hshDupeCheck As New Hashtable
Dim sNewGame As String = oGameToSave.ProcessName & ":" & oGameToSave.KeySafeName
Dim sNewGame As String = oGameToSave.CompoundKey
For Each o As clsGame In GameData.Values
hshDupeCheck.Add(o.CompoundKey, String.Empty)
+38 -71
View File
@@ -173,45 +173,45 @@ Public Class frmGameManager
Dim sNewFileName As String
'If there is a name change, check and update the manifest
If oNewApp.Name <> oOriginalApp.Name Then
If oNewApp.ID <> oOriginalApp.ID Then
'Local
If mgrManifest.DoManifestNameCheck(oOriginalApp.Name, mgrSQLite.Database.Local) Then
oBackupItems = mgrManifest.DoManifestGetByName(oOriginalApp.Name, mgrSQLite.Database.Local)
If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then
oBackupItems = mgrManifest.DoManifestGetByMonitorID(oOriginalApp.ID, mgrSQLite.Database.Local)
'The local manifest will only have one entry per game, therefore this runs only once
For Each oBackupItem As clsBackup In oBackupItems
'Rename Current Backup File & Folder
sFileName = BackupFolder & oBackupItem.FileName
'Rename Backup File
sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName)
sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(oOriginalApp.ID, oNewApp.ID)
If File.Exists(sFileName) And Not sFileName = sNewFileName Then
FileSystem.Rename(sFileName, sNewFileName)
End If
'Rename Directory
sDirectory = Path.GetDirectoryName(sFileName)
sNewDirectory = sDirectory.Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName)
sNewDirectory = sDirectory.Replace(oOriginalApp.ID, oNewApp.ID)
If sDirectory <> sNewDirectory Then
If Directory.Exists(sDirectory) And Not sDirectory = sNewDirectory Then
FileSystem.Rename(sDirectory, sNewDirectory)
End If
End If
oBackupItem.Name = oNewApp.Name
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName)
mgrManifest.DoManifestUpdateByID(oBackupItem, mgrSQLite.Database.Local)
oBackupItem.MonitorID = oNewApp.ID
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID)
mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Local)
Next
oLocalBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local)
End If
'Remote
If mgrManifest.DoManifestNameCheck(oOriginalApp.Name, mgrSQLite.Database.Remote) Then
oBackupItems = mgrManifest.DoManifestGetByName(oOriginalApp.Name, mgrSQLite.Database.Remote)
If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Remote) Then
oBackupItems = mgrManifest.DoManifestGetByMonitorID(oOriginalApp.ID, mgrSQLite.Database.Remote)
For Each oBackupItem As clsBackup In oBackupItems
oBackupItem.Name = oNewApp.Name
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName)
mgrManifest.DoManifestUpdateByID(oBackupItem, mgrSQLite.Database.Remote)
oBackupItem.MonitorID = oNewApp.ID
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID)
mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Remote)
Next
oRemoteBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote)
End If
@@ -221,7 +221,6 @@ Public Class frmGameManager
Private Sub LoadData(Optional ByVal bRetainFilter As Boolean = True)
Dim oRestoreData As New SortedList
Dim oGame As clsGame
Dim oBackup As clsBackup
Dim frm As frmFilter
If optCustom.Checked Then
@@ -264,10 +263,10 @@ Public Class frmGameManager
Dim oTemporaryList As OrderedDictionary = mgrCommon.GenericClone(GameData)
For Each de As DictionaryEntry In oTemporaryList
oGame = DirectCast(de.Value, clsGame)
If Not oRestoreData.ContainsKey(oGame.Name) Then
If Not oRestoreData.ContainsKey(oGame.ID) Then
GameData.Remove(de.Key)
Else
oRestoreData.Remove(oGame.Name)
oRestoreData.Remove(oGame.ID)
End If
Next
ElseIf optBackupData.Checked Then
@@ -277,24 +276,14 @@ Public Class frmGameManager
For Each de As DictionaryEntry In oTemporaryList
oGame = DirectCast(de.Value, clsGame)
If Not oRemoteBackupData.ContainsKey(oGame.Name) Then
If Not oRemoteBackupData.ContainsKey(oGame.ID) Then
GameData.Remove(de.Key)
Else
oRestoreData.Remove(oGame.Name)
oRestoreData.Remove(oGame.ID)
End If
Next
End If
'Handle any orphaned backup files and add them to list
If oRestoreData.Count <> 0 Then
For Each oBackup In oRestoreData.Values
oGame = New clsGame
oGame.Name = oBackup.Name
oGame.Temporary = True
GameData.Add(oGame.ID, oGame)
Next
End If
lstGames.DataSource = Nothing
FormatAndFillList()
End Sub
@@ -598,7 +587,7 @@ Public Class frmGameManager
Dim sFileName As String
If sManifestID <> String.Empty Then
CurrentBackupItem = mgrManifest.DoManifestGetByID(sManifestID, mgrSQLite.Database.Remote)
CurrentBackupItem = mgrManifest.DoManifestGetByManifestID(sManifestID, mgrSQLite.Database.Remote)
sFileName = BackupFolder & CurrentBackupItem.FileName
@@ -608,7 +597,6 @@ Public Class frmGameManager
lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists
End If
mgrRestore.DoPathOverride(CurrentBackupItem, CurrentGame)
lblRestorePathData.Text = CurrentBackupItem.RestorePath
End If
@@ -627,15 +615,15 @@ Public Class frmGameManager
cboRemoteBackup.ValueMember = "Key"
cboRemoteBackup.DisplayMember = "Value"
If oRemoteBackupData.Contains(oApp.Name) Then
If oRemoteBackupData.Contains(oApp.ID) Then
bRemoteData = True
oCurrentBackups = mgrManifest.DoManifestGetByName(oApp.Name, mgrSQLite.Database.Remote)
oCurrentBackups = mgrManifest.DoManifestGetByMonitorID(oApp.ID, mgrSQLite.Database.Remote)
For Each oCurrentBackup In oCurrentBackups
oComboItems.Add(New KeyValuePair(Of String, String)(oCurrentBackup.ID, mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oCurrentBackup.DateUpdated, oCurrentBackup.UpdatedBy})))
oComboItems.Add(New KeyValuePair(Of String, String)(oCurrentBackup.ManifestID, mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oCurrentBackup.DateUpdated, oCurrentBackup.UpdatedBy})))
Next
CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.Name), clsBackup)
CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup)
sFileName = BackupFolder & CurrentBackupItem.FileName
@@ -650,7 +638,6 @@ Public Class frmGameManager
lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists
End If
mgrRestore.DoPathOverride(CurrentBackupItem, oApp)
lblRestorePathData.Text = CurrentBackupItem.RestorePath
Else
oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None))
@@ -664,9 +651,9 @@ Public Class frmGameManager
cboRemoteBackup.DataSource = oComboItems
If oLocalBackupData.Contains(oApp.Name) Then
If oLocalBackupData.Contains(oApp.ID) Then
bLocalData = True
oBackupInfo = DirectCast(oLocalBackupData(oApp.Name), clsBackup)
oBackupInfo = DirectCast(oLocalBackupData(oApp.ID), clsBackup)
lblLocalBackupData.Text = mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oBackupInfo.DateUpdated, oBackupInfo.UpdatedBy})
Else
lblLocalBackupData.Text = frmGameManager_Unknown
@@ -693,11 +680,11 @@ Public Class frmGameManager
Dim oBackup As clsBackup
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupDeleteAll, CurrentGame.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
oBackupData = mgrManifest.DoManifestGetByName(CurrentGame.Name, mgrSQLite.Database.Remote)
oBackupData = mgrManifest.DoManifestGetByMonitorID(CurrentGame.ID, mgrSQLite.Database.Remote)
For Each oBackup In oBackupData
'Delete the specific remote manifest entry
mgrManifest.DoManifestDeletebyID(oBackup, mgrSQLite.Database.Remote)
mgrManifest.DoManifestDeletebyManifestID(oBackup, mgrSQLite.Database.Remote)
'Delete referenced backup file from the backup folder
mgrCommon.DeleteFile(BackupFolder & oBackup.FileName)
'Check for sub-directory and delete if empty (we need to do this every pass just in case the user had a mix of settings at one point)
@@ -705,28 +692,21 @@ Public Class frmGameManager
Next
'Delete local manifest entry
mgrManifest.DoManifestDeletebyName(CurrentBackupItem, mgrSQLite.Database.Local)
mgrManifest.DoManifestDeletebyMonitorID(CurrentBackupItem, mgrSQLite.Database.Local)
LoadBackupData()
If oCurrentGame.Temporary Then
LoadData()
eCurrentMode = eModes.Disabled
ModeChange()
Else
FillData()
End If
FillData()
End If
End Sub
Private Sub DeleteBackup()
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupDelete, Path.GetFileName(CurrentBackupItem.FileName), MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
'Delete the specific remote manifest entry
mgrManifest.DoManifestDeletebyID(CurrentBackupItem, mgrSQLite.Database.Remote)
mgrManifest.DoManifestDeleteByManifestID(CurrentBackupItem, mgrSQLite.Database.Remote)
'If a remote manifest entry no longer exists for this game, delete the local entry
If Not mgrManifest.DoGlobalManifestCheck(CurrentBackupItem.Name, mgrSQLite.Database.Remote) Then
mgrManifest.DoManifestDeletebyName(CurrentBackupItem, mgrSQLite.Database.Local)
If Not mgrManifest.DoManifestCheck(CurrentBackupItem.MonitorID, mgrSQLite.Database.Remote) Then
mgrManifest.DoManifestDeleteByMonitorID(CurrentBackupItem, mgrSQLite.Database.Local)
End If
'Delete referenced backup file from the backup folder
@@ -736,14 +716,7 @@ Public Class frmGameManager
mgrCommon.DeleteDirectoryByBackup(BackupFolder, CurrentBackupItem)
LoadBackupData()
If oCurrentGame.Temporary Then
LoadData()
eCurrentMode = eModes.Disabled
ModeChange()
Else
FillData()
End If
FillData()
End If
End Sub
@@ -796,12 +769,6 @@ Public Class frmGameManager
'Set Current
CurrentGame = oApp
'Change view to temporary if we only have backup data for the game
If CurrentGame.Temporary Then
eCurrentMode = eModes.ViewTemp
ModeChange()
End If
IsLoading = False
End Sub
@@ -1340,8 +1307,8 @@ Public Class frmGameManager
If oMarkList.Count = 1 Then
If mgrCommon.ShowMessage(frmGameManager_ConfirmMark, oMarkList(0).Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
bWasUpdated = True
If mgrManifest.DoGlobalManifestCheck(oMarkList(0).Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oMarkList(0), mgrSQLite.Database.Local)
If mgrManifest.DoManifestCheck(oMarkList(0).MonitorID, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByMonitorID(oMarkList(0), mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oMarkList(0), mgrSQLite.Database.Local)
End If
@@ -1350,8 +1317,8 @@ Public Class frmGameManager
If mgrCommon.ShowMessage(frmGameManager_ConfirmMultiMark, oMarkList.Count, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
bWasUpdated = True
For Each oGameBackup In oMarkList
If mgrManifest.DoGlobalManifestCheck(oGameBackup.Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oGameBackup, mgrSQLite.Database.Local)
If mgrManifest.DoManifestCheck(oGameBackup.MonitorID, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByMonitorID(oGameBackup, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oGameBackup, mgrSQLite.Database.Local)
End If
@@ -1428,9 +1395,9 @@ Public Class frmGameManager
For Each oData In lstGames.SelectedItems
If oRemoteBackupData.Contains(oData.Value) Then
If oRemoteBackupData.Contains(oData.Key) Then
oGame = DirectCast(GameData(oData.Key), clsGame)
oBackup = DirectCast(oRemoteBackupData(oData.Value), clsBackup)
oBackup = DirectCast(oRemoteBackupData(oData.Key), clsBackup)
If Not oGame.MonitorOnly Then RestoreList.Add(oGame, oBackup)
End If
Next
+2 -3
View File
@@ -406,7 +406,6 @@ Public Class frmMain
hshGames = mgrMonitorList.DoListGetbyName(de.Key)
If hshGames.Count = 1 Then
oGame = DirectCast(hshGames(0), clsGame)
mgrRestore.DoPathOverride(oBackup, oGame)
If oGame.ProcessPath <> String.Empty Then
oBackup.RelativeRestorePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oBackup.RestorePath
End If
@@ -420,8 +419,8 @@ Public Class frmMain
If Not Directory.Exists(sExtractPath) Then
If oSettings.AutoMark Then
If mgrManifest.DoGlobalManifestCheck(de.Key, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(de.Value, mgrSQLite.Database.Local)
If mgrManifest.DoManifestCheck(de.Key, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByMonitorID(de.Value, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(de.Value, mgrSQLite.Database.Local)
End If
+13 -15
View File
@@ -40,25 +40,23 @@ Public Class mgrBackup
Dim oItem As New clsBackup
'Create manifest item
oItem.Name = oGameInfo.Name
oItem.MonitorID = oGameInfo.ID
'Keep the path relative to the manifest location
oItem.FileName = sBackupFile.Replace(Path.GetDirectoryName(mgrPath.RemoteDatabaseLocation) & Path.DirectorySeparatorChar, "")
oItem.RestorePath = oGameInfo.TruePath
oItem.AbsolutePath = oGameInfo.AbsolutePath
oItem.DateUpdated = dTimeStamp
oItem.UpdatedBy = My.Computer.Name
oItem.CheckSum = sCheckSum
'Save Remote Manifest
If mgrManifest.DoSpecificManifestCheck(oItem, mgrSQLite.Database.Remote) Then
mgrManifest.DoManifestUpdateByID(oItem, mgrSQLite.Database.Remote)
mgrManifest.DoManifestUpdateByManifestID(oItem, mgrSQLite.Database.Remote)
Else
mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Remote)
End If
'Save Local Manifest
If mgrManifest.DoGlobalManifestCheck(oItem.Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oItem, mgrSQLite.Database.Local)
If mgrManifest.DoManifestCheck(oItem.MonitorID, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByMonitorID(oItem, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Local)
End If
@@ -107,8 +105,8 @@ Public Class mgrBackup
Dim lAvailableSpace As Long
Dim lFolderSize As Long
If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName & ".7z"
If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & ".7z"
'Verify saved game path
sSavePath = VerifySavePath(oGame)
@@ -130,7 +128,7 @@ Public Class mgrBackup
End If
End If
If mgrRestore.CheckManifest(oGame.Name) Then
If mgrRestore.CheckManifest(oGame.ID) Then
If mgrCommon.ShowMessage(mgrBackup_ConfirmManifestConflict, oGame.Name, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
RaiseEvent UpdateLog(mgrBackup_ErrorManifestConflict, False, ToolTipIcon.Error, True)
Return False
@@ -148,7 +146,7 @@ Public Class mgrBackup
End Function
Private Sub CheckOldBackups(ByVal oGame As clsGame)
Dim oGameBackups As List(Of clsBackup) = mgrManifest.DoManifestGetByName(oGame.Name, mgrSQLite.Database.Remote)
Dim oGameBackups As List(Of clsBackup) = mgrManifest.DoManifestGetByMonitorID(oGame.ID, mgrSQLite.Database.Remote)
Dim oGameBackup As clsBackup
Dim sOldBackup As String
Dim iBackupCount As Integer = oGameBackups.Count
@@ -164,8 +162,8 @@ Public Class mgrBackup
oGameBackup = oGameBackups(oGameBackups.Count - i)
sOldBackup = Settings.BackupFolder & Path.DirectorySeparatorChar & oGameBackup.FileName
mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Remote)
mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Local)
mgrManifest.DoManifestDeleteByManifestID(oGameBackup, mgrSQLite.Database.Remote)
mgrManifest.DoManifestDeleteByManifestID(oGameBackup, mgrSQLite.Database.Local)
mgrCommon.DeleteFile(sOldBackup)
mgrCommon.DeleteDirectoryByBackup(Settings.BackupFolder & Path.DirectorySeparatorChar, oGameBackup)
@@ -199,7 +197,7 @@ Public Class mgrBackup
RaiseEvent UpdateBackupInfo(oGame)
If oSettings.CreateSubFolder Then
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID
Try
If Not Directory.Exists(sBackupFile) Then
Directory.CreateDirectory(sBackupFile)
@@ -212,9 +210,9 @@ Public Class mgrBackup
If oGame.AppendTimeStamp Then
CheckOldBackups(oGame)
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName & sTimeStamp & ".7z"
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & sTimeStamp & ".7z"
Else
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName & ".7z"
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & ".7z"
End If
If bDoBackup Then
+2 -7
View File
@@ -202,11 +202,6 @@ Public Class mgrCommon
Dim sExemptList As String() = {"dosbox", "scummvm"}
Dim bFound As Boolean = False
'We can't search if we don't have a configuration
If oGame.Temporary Then
Return True
End If
For Each s As String In sExemptList
If oGame.ProcessName.ToLower.Contains(s) Then bFound = True
Next
@@ -430,10 +425,10 @@ Public Class mgrCommon
'Delete a sub-folder based on the provided backup information
Public Shared Sub DeleteDirectoryByBackup(ByVal sBackupFolder As String, ByVal oBackup As clsBackup)
Dim oDir As DirectoryInfo
Dim sDir As String = sBackupFolder & oBackup.SafeName
Dim sDir As String = sBackupFolder & oBackup.MonitorID
'Delete sub directory if it's empty
If oBackup.FileName.StartsWith(oBackup.SafeName & Path.DirectorySeparatorChar) Then
If oBackup.FileName.StartsWith(oBackup.MonitorID & Path.DirectorySeparatorChar) Then
If Directory.Exists(sDir) Then
'Check if there's any sub-directories or files remaining
oDir = New DirectoryInfo(sDir)
+40 -63
View File
@@ -4,10 +4,11 @@
Dim oBackupItem As clsBackup
oBackupItem = New clsBackup
oBackupItem.ID = CStr(dr("ManifestID"))
oBackupItem.ManifestID = CStr(dr("ManifestID"))
oBackupItem.MonitorID = CStr(dr("MonitorID"))
oBackupItem.Name = CStr(dr("Name"))
oBackupItem.FileName = CStr(dr("FileName"))
oBackupItem.RestorePath = CStr(dr("RestorePath"))
oBackupItem.RestorePath = CStr(dr("Path"))
oBackupItem.AbsolutePath = CBool(dr("AbsolutePath"))
oBackupItem.DateUpdated = mgrCommon.UnixToDate(dr("DateUpdated"))
oBackupItem.UpdatedBy = CStr(dr("UpdatedBy"))
@@ -19,11 +20,9 @@
Private Shared Function SetCoreParameters(ByVal oBackupItem As clsBackup) As Hashtable
Dim hshParams As New Hashtable
hshParams.Add("ID", oBackupItem.ID)
hshParams.Add("Name", oBackupItem.Name)
hshParams.Add("ManifestID", oBackupItem.ManifestID)
hshParams.Add("MonitorID", oBackupItem.MonitorID)
hshParams.Add("FileName", oBackupItem.FileName)
hshParams.Add("Path", oBackupItem.TruePath)
hshParams.Add("AbsolutePath", oBackupItem.AbsolutePath)
hshParams.Add("DateUpdated", oBackupItem.DateUpdatedUnix)
hshParams.Add("UpdatedBy", oBackupItem.UpdatedBy)
hshParams.Add("CheckSum", oBackupItem.CheckSum)
@@ -38,12 +37,12 @@
Dim oBackupItem As clsBackup
Dim slList As New SortedList
sSQL = "SELECT * from manifest ORDER BY Name Asc"
sSQL = "SELECT * from manifest NATURAL JOIN monitorlist ORDER BY Name Asc"
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows
oBackupItem = MapToObject(dr)
slList.Add(oBackupItem.ID, oBackupItem)
slList.Add(oBackupItem.ManifestID, oBackupItem)
Next
Return slList
@@ -57,19 +56,19 @@
Dim oBackupItem As clsBackup
Dim slList As New SortedList
sSQL = "SELECT ManifestID, Name, FileName, RestorePath, AbsolutePath, Max(DateUpdated) As DateUpdated, UpdatedBy, CheckSum FROM manifest GROUP BY Name ORDER By Name ASC"
sSQL = "SELECT ManifestID, MonitorID, Name, FileName, Path, AbsolutePath, Max(DateUpdated) As DateUpdated, UpdatedBy, CheckSum FROM manifest NATURAL JOIN monitorlist GROUP BY Name ORDER By Name ASC"
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows
oBackupItem = MapToObject(dr)
slList.Add(oBackupItem.Name, oBackupItem)
slList.Add(oBackupItem.MonitorID, oBackupItem)
Next
Return slList
End Function
Public Shared Function DoManifestGetByName(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As List(Of clsBackup)
Public Shared Function DoManifestGetByMonitorID(ByVal sMonitorID As String, ByVal iSelectDB As mgrSQLite.Database) As List(Of clsBackup)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
@@ -78,10 +77,10 @@
Dim oList As New List(Of clsBackup)
sSQL = "SELECT * from manifest "
sSQL &= "WHERE Name = @Name ORDER BY DateUpdated Desc"
sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID ORDER BY DateUpdated Desc"
hshParams.Add("Name", sName)
hshParams.Add("MonitorID", sMonitorID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
@@ -93,7 +92,7 @@
Return oList
End Function
Public Shared Function DoManifestGetByID(ByVal sID As String, ByVal iSelectDB As mgrSQLite.Database) As clsBackup
Public Shared Function DoManifestGetByManifestID(ByVal sManifestID As String, ByVal iSelectDB As mgrSQLite.Database) As clsBackup
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
@@ -101,10 +100,10 @@
Dim oBackupItem As New clsBackup
Dim oList As New List(Of clsBackup)
sSQL = "SELECT * from manifest "
sSQL &= "WHERE ManifestID = @ID ORDER BY DateUpdated Desc"
sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist "
sSQL &= "WHERE ManifestID = @ManifestID ORDER BY DateUpdated Desc"
hshParams.Add("ID", sID)
hshParams.Add("ManifestID", sManifestID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
@@ -122,17 +121,17 @@
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "SELECT * from manifest "
sSQL &= "WHERE Name = @Name AND FileName = @FileName"
sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID AND FileName = @FileName"
hshParams.Add("Name", oItem.Name)
hshParams.Add("MonitorID", oItem.MonitorID)
hshParams.Add("FileName", oItem.FileName)
oData = oDatabase.ReadParamData(sSQL, hshParams)
If oData.Tables(0).Rows.Count > 0 Then
For Each dr As DataRow In oData.Tables(0).Rows
oItem.ID = CStr(dr("ManifestID"))
oItem.ManifestID = CStr(dr("ManifestID"))
Next
Return True
Else
@@ -141,38 +140,16 @@
End Function
'This should only be used to update entries in the local manifest
Public Shared Function DoGlobalManifestCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Public Shared Function DoManifestCheck(ByVal sMonitorID As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "SELECT * from manifest "
sSQL &= "WHERE Name = @Name"
sSQL = "SELECT * FROM manifest "
sSQL &= "WHERE MonitorID = @MonitorID"
hshParams.Add("Name", sName)
oData = oDatabase.ReadParamData(sSQL, hshParams)
If oData.Tables(0).Rows.Count > 0 Then
Return True
Else
Return False
End If
End Function
Public Shared Function DoManifestNameCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "SELECT * from manifest "
sSQL &= "WHERE Name = @Name"
hshParams.Add("Name", sName)
hshParams.Add("MonitorID", sMonitorID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
@@ -189,63 +166,63 @@
Dim sSQL As String
Dim hshParams As Hashtable
sSQL = "INSERT INTO manifest VALUES (@ID, @Name, @FileName, @Path, @AbsolutePath, @DateUpdated, @UpdatedBy, @CheckSum)"
sSQL = "INSERT INTO manifest VALUES (@ManifestID, @MonitorID, @FileName, @DateUpdated, @UpdatedBy, @CheckSum)"
hshParams = SetCoreParameters(oBackupItem)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoManifestUpdateByName(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Public Shared Sub DoManifestUpdateByMonitorID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As Hashtable
sSQL = "UPDATE manifest SET Name = @Name, FileName = @FileName, RestorePath = @Path, AbsolutePath = @AbsolutePath, "
sSQL &= "DateUpdated = @DateUpdated, UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE Name = @QueryName"
sSQL = "UPDATE manifest SET MonitorID = @MonitorID, FileName = @FileName, DateUpdated = @DateUpdated, "
sSQL &= "UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE MonitorID = @QueryID"
hshParams = SetCoreParameters(oBackupItem)
hshParams.Add("QueryName", oBackupItem.Name)
hshParams.Add("QueryID", oBackupItem.MonitorID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoManifestUpdateByID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Public Shared Sub DoManifestUpdateByManifestID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As Hashtable
sSQL = "UPDATE manifest SET Name = @Name, FileName = @FileName, RestorePath = @Path, AbsolutePath = @AbsolutePath, "
sSQL &= "DateUpdated = @DateUpdated, UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE ManifestID = @QueryID"
sSQL = "UPDATE manifest SET MonitorID = @MonitorID, FileName = @FileName, DateUpdated = @DateUpdated, "
sSQL &= "UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE ManifestID = @QueryID"
hshParams = SetCoreParameters(oBackupItem)
hshParams.Add("QueryID", oBackupItem.ID)
hshParams.Add("QueryID", oBackupItem.ManifestID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoManifestDeletebyName(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Public Shared Sub DoManifestDeleteByMonitorID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM manifest "
sSQL &= "WHERE Name = @Name"
sSQL &= "WHERE MonitorID = @MonitorID"
hshParams.Add("Name", oBackupItem.Name)
hshParams.Add("MonitorID", oBackupItem.MonitorID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoManifestDeletebyID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Public Shared Sub DoManifestDeleteByManifestID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM manifest "
sSQL &= "WHERE ManifestID = @ID"
sSQL &= "WHERE ManifestID = @ManifestID"
hshParams.Add("ID", oBackupItem.ID)
hshParams.Add("ManifestID", oBackupItem.ManifestID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
+18 -4
View File
@@ -86,7 +86,7 @@ Public Class mgrMonitorList
Select Case eListType
Case eListTypes.FullList
'Don't wrap this, if it fails there's a problem with the database
hshList.Add(oGame.ProcessName & ":" & oGame.KeySafeName, oGame)
hshList.Add(oGame.CompoundKey, oGame)
Case eListTypes.ScanList
For Each de As DictionaryEntry In hshList
bIsDupe = False
@@ -116,7 +116,7 @@ Public Class mgrMonitorList
If bIsDupe Then
DirectCast(hshList.Item(oCompareGame.ProcessName), clsGame).Duplicate = True
oGame.ProcessName = oGame.ProcessName & ":" & oGame.KeySafeName
oGame.ProcessName = oGame.CompoundKey
oGame.Duplicate = True
End If
Next
@@ -190,7 +190,9 @@ Public Class mgrMonitorList
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM gametags "
sSQL = "DELETE FROM manifest "
sSQL &= "WHERE MonitorID = @MonitorID;"
sSQL &= "DELETE FROM gametags "
sSQL &= "WHERE MonitorID = @MonitorID;"
If iSelectDB = mgrSQLite.Database.Local Then
sSQL &= "DELETE FROM sessions "
@@ -211,7 +213,19 @@ Public Class mgrMonitorList
Dim hshParams As New Hashtable
Dim iCounter As Integer
sSQL = "DELETE FROM gametags "
sSQL = "DELETE FROM manifest "
sSQL &= "WHERE MonitorID IN ("
For Each s As String In sMonitorIDs
sSQL &= "@MonitorID" & iCounter & ","
hshParams.Add("MonitorID" & iCounter, s)
iCounter += 1
Next
sSQL = sSQL.TrimEnd(",")
sSQL &= ");"
sSQL &= "DELETE FROM gametags "
sSQL &= "WHERE MonitorID IN ("
For Each s As String In sMonitorIDs
+14 -28
View File
@@ -28,25 +28,11 @@ Public Class mgrRestore
Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup)
Public Event SetLastAction(sMessage As String)
Public Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame)
'Always override the manifest restore path with the current configuration path if possible
If Not oCheckGame.Temporary Then
If Path.IsPathRooted(oCheckGame.Path) Then
oCheckBackup.AbsolutePath = True
Else
oCheckBackup.AbsolutePath = False
End If
oCheckBackup.RestorePath = oCheckGame.Path
End If
End Sub
Public Shared Function CheckPath(ByRef oRestoreInfo As clsBackup, ByVal oGame As clsGame, ByRef bTriggerReload As Boolean) As Boolean
Dim sProcess As String
Dim sRestorePath As String
Dim bNoAuto As Boolean
DoPathOverride(oRestoreInfo, oGame)
If Not oRestoreInfo.AbsolutePath Then
If oGame.ProcessPath <> String.Empty Then
oRestoreInfo.RelativeRestorePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oRestoreInfo.RestorePath
@@ -72,7 +58,7 @@ Public Class mgrRestore
Return True
End Function
Public Shared Function CheckManifest(ByVal sAppName As String) As Boolean
Public Shared Function CheckManifest(ByVal sMonitorID As String) As Boolean
Dim slLocalManifest As SortedList
Dim slRemoteManifest As SortedList
Dim oLocalItem As New clsBackup
@@ -83,13 +69,13 @@ Public Class mgrRestore
slLocalManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local)
slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote)
If slLocalManifest.Contains(sAppName) Then
oLocalItem = DirectCast(slLocalManifest(sAppName), clsBackup)
If slLocalManifest.Contains(sMonitorID) Then
oLocalItem = DirectCast(slLocalManifest(sMonitorID), clsBackup)
bLocal = True
End If
If slRemoteManifest.Contains(sAppName) Then
oRemoteItem = DirectCast(slRemoteManifest(sAppName), clsBackup)
If slRemoteManifest.Contains(sMonitorID) Then
oRemoteItem = DirectCast(slRemoteManifest(sMonitorID), clsBackup)
bRemote = True
End If
@@ -119,14 +105,14 @@ Public Class mgrRestore
slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote)
For Each oItem As clsBackup In slRemoteManifest.Values
If slLocalManifest.Contains(oItem.Name) Then
oLocalItem = DirectCast(slLocalManifest(oItem.Name), clsBackup)
If slLocalManifest.Contains(oItem.MonitorID) Then
oLocalItem = DirectCast(slLocalManifest(oItem.MonitorID), clsBackup)
If oItem.DateUpdated > oLocalItem.DateUpdated Then
slRestoreItems.Add(oItem.Name, oItem)
slRestoreItems.Add(oItem.MonitorID, oItem)
End If
Else
slRestoreItems.Add(oItem.Name, oItem)
slRestoreItems.Add(oItem.MonitorID, oItem)
End If
Next
@@ -142,9 +128,9 @@ Public Class mgrRestore
slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote)
For Each oItem As clsBackup In slLocalManifest.Values
If Not slRemoteManifest.Contains(oItem.Name) Then
slRemovedItems.Add(oItem.Name, oItem)
mgrManifest.DoManifestDeletebyName(oItem, mgrSQLite.Database.Local)
If Not slRemoteManifest.Contains(oItem.MonitorID) Then
slRemovedItems.Add(oItem.MonitorID, oItem)
mgrManifest.DoManifestDeleteByMonitorID(oItem, mgrSQLite.Database.Local)
End If
Next
@@ -262,8 +248,8 @@ Public Class mgrRestore
If bRestoreCompleted Then
'Save Local Manifest
If mgrManifest.DoGlobalManifestCheck(oBackupInfo.Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oBackupInfo, mgrSQLite.Database.Local)
If mgrManifest.DoManifestCheck(oBackupInfo.MonitorID, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByMonitorID(oBackupInfo, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oBackupInfo, mgrSQLite.Database.Local)
End If
+61 -9
View File
@@ -80,10 +80,10 @@ Public Class mgrSQLite
sSql &= "CREATE TABLE savedpath (PathName TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);"
'Add Tables (Monitor List)
sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
"AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " &
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " &
"BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL, PRIMARY KEY(Name, Process));"
"BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);"
'Add Tables (Tags)
sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
@@ -95,8 +95,8 @@ Public Class mgrSQLite
sSql &= "CREATE TABLE variables (VariableID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);"
'Add Tables (Local Manifest)
sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " &
"AbsolutePath BOOLEAN NOT NULL, DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " &
"DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
'Add Tables (Sessions)
sSql &= "CREATE TABLE sessions (MonitorID TEXT NOT NULL, Start INTEGER NOT NULL, End INTEGER NOT NULL, PRIMARY KEY(MonitorID, Start));"
@@ -120,14 +120,14 @@ Public Class mgrSQLite
SqliteConnection.CreateFile(sDatabaseLocation)
'Add Tables (Remote Monitor List)
sSql = "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
sSql = "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
"AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " &
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " &
"BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL, PRIMARY KEY(Name, Process));"
"BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);"
'Add Tables (Remote Manifest)
sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " &
"AbsolutePath BOOLEAN NOT NULL, DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " &
"DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
'Add Tables (Remote Tags)
sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
@@ -267,7 +267,7 @@ Public Class mgrSQLite
Dim oResult As New Object
Connect()
Command = New SqliteCommand(sSQL, db)
command = New SqliteCommand(sSQL, db)
BuildParams(command, hshParams)
Try
@@ -759,6 +759,58 @@ Public Class mgrSQLite
RunParamQuery(sSQL, New Hashtable)
End If
End If
'1.10 Upgrade
If GetDatabaseVersion() < 110 Then
If eDatabase = Database.Local Then
'Backup DB before starting
BackupDB("v108")
'Overhaul Tables
sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
"AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " &
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " &
"BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);"
sSQL &= "INSERT INTO monitorlist_new (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " &
"ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx)" &
"SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " &
"ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx FROM monitorlist;" &
"DROP TABLE monitorlist; ALTER TABLE monitorlist_new RENAME TO monitorlist;"
sSQL &= "CREATE TABLE manifest_new (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " &
"DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
sSQL &= "INSERT INTO manifest_new (ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum) " &
"SELECT ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum FROM manifest NATURAL JOIN monitorlist;" &
"DROP TABLE manifest; ALTER TABLE manifest_new RENAME TO manifest;"
sSQL &= "PRAGMA user_version=110"
RunParamQuery(sSQL, New Hashtable)
End If
If eDatabase = Database.Remote Then
'Backup DB before starting
BackupDB("v108")
'Overhaul Tables
sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
"AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " &
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " &
"BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);"
sSQL &= "INSERT INTO monitorlist_new (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " &
"ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx)" &
"SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " &
"ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx FROM monitorlist;" &
"DROP TABLE monitorlist; ALTER TABLE monitorlist_new RENAME TO monitorlist;"
sSQL &= "CREATE TABLE manifest_new (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " &
"DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
sSQL &= "INSERT INTO manifest_new (ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum) " &
"SELECT ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum FROM manifest NATURAL JOIN monitorlist;" &
"DROP TABLE manifest; ALTER TABLE manifest_new RENAME TO manifest;"
sSQL &= "PRAGMA user_version=110"
RunParamQuery(sSQL, New Hashtable)
End If
End If
End Sub
Public Function GetDBSize() As Long
+1 -1
View File
@@ -42,7 +42,7 @@ Public Class mgrXML
'This should be wrapped just in case we get some bad data
Try
hshList.Add(oGame.ProcessName & ":" & oGame.KeySafeName, oGame)
hshList.Add(oGame.CompoundKey, oGame)
Catch e As Exception
'Do Nothing
End Try
+2 -2
View File
@@ -33,7 +33,7 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.8.*")>
<Assembly: AssemblyFileVersion("1.0.8.0")>
<Assembly: AssemblyVersion("1.1.0.*")>
<Assembly: AssemblyFileVersion("1.1.0.0")>
<Assembly: NeutralResourcesLanguageAttribute("en")>