Skip to content

Commit

Permalink
Added "empty caches" option to help menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
thommcgrath committed May 24, 2024
1 parent 20bb1c1 commit f394807
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Project/App.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Implements NotificationKit.Receiver,Beacon.Application
FileNewPreset.Enabled = True
FileOpen.Enabled = True
FileImport.Enabled = True
HelpEmptyCaches.Enabled = True

Var DefaultGameId As String = Preferences.NewProjectGameId
If DefaultGameId.IsEmpty Then
Expand Down Expand Up @@ -386,6 +387,17 @@ Implements NotificationKit.Receiver,Beacon.Application
End Function
#tag EndMenuHandler

#tag MenuHandler
Function HelpEmptyCaches() As Boolean Handles HelpEmptyCaches.Action
Var Sources() As Beacon.DataSource = Self.DataSources
For Each Source As Beacon.DataSource In Sources
Source.EmptyCaches()
Next
BeaconUI.ShowAlert("Caches have been emptied. It is recommended to reload any open projects.", "Opening a project loads the caches with data that may not be stored in your local database. Reloading your projects after emptying caches will improve reliability.")
Return True
End Function
#tag EndMenuHandler

#tag MenuHandler
Function HelpMigrateAccounts() As Boolean Handles HelpMigrateAccounts.Action
UserMigratorDialog.Present(False)
Expand Down
8 changes: 8 additions & 0 deletions Project/MainMenuBar.xojo_menu
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,14 @@ Begin Menu MainMenuBar
AutoEnable = False
Visible = True
End
Begin DesktopMenuItem HelpEmptyCaches
SpecialMenu = 0
Index = -2147483648
Text = "Empty Caches"
AutoEnabled = False
AutoEnable = False
Visible = True
End
Begin DesktopMenuItem HelpMigrateAccountsSeparator
SpecialMenu = 0
Index = -2147483648
Expand Down
10 changes: 10 additions & 0 deletions Project/Modules/Beacon/DataSource.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ Implements NotificationKit.Receiver
End Function
#tag EndMethod

#tag Method, Flags = &h0
Sub EmptyCaches()
RaiseEvent EmptyCaches
End Sub
#tag EndMethod

#tag Method, Flags = &h0
Shared Function EscapeIdentifier(Identifier As String) As String
Return """" + Identifier.ReplaceAll("""", """""") + """"
Expand Down Expand Up @@ -1218,6 +1224,10 @@ Implements NotificationKit.Receiver
Event DeleteContentPack(ContentPackId As String) As Boolean
#tag EndHook

#tag Hook, Flags = &h0
Event EmptyCaches()
#tag EndHook

#tag Hook, Flags = &h0
Event ExportCloudFiles()
#tag EndHook
Expand Down
12 changes: 12 additions & 0 deletions Project/Modules/Game Support/Ark/DataSource.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ Inherits Beacon.DataSource
End Function
#tag EndEvent

#tag Event
Sub EmptyCaches()
Self.mBlueprintCache = New Dictionary
Self.mConfigOptionCache = New Dictionary
Self.mContainerLabelCacheDict = New Dictionary
Self.mContainerLabelCacheMask = 0
Self.mIconCache = New Dictionary
Self.mSpawnLabelCacheDict = New Dictionary
Self.mSpawnLabelCacheMask = 0
End Sub
#tag EndEvent

#tag Event
Sub ExportCloudFiles()
#if DebugBuild
Expand Down
12 changes: 12 additions & 0 deletions Project/Modules/Game Support/ArkSA/DataSource.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ Inherits Beacon.DataSource
End Function
#tag EndEvent

#tag Event
Sub EmptyCaches()
Self.mBlueprintCache = New Dictionary
Self.mConfigOptionCache = New Dictionary
Self.mContainerLabelCacheDict = New Dictionary
Self.mContainerLabelCacheMask = 0
Self.mIconCache = New Dictionary
Self.mSpawnLabelCacheDict = New Dictionary
Self.mSpawnLabelCacheMask = 0
End Sub
#tag EndEvent

#tag Event
Sub ExportCloudFiles()
Const Filename = "/ArkSA/Blueprints" + Beacon.FileExtensionDelta
Expand Down
6 changes: 6 additions & 0 deletions Project/Modules/Game Support/Palworld/DataSource.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Inherits Beacon.DataSource
End Function
#tag EndEvent

#tag Event
Sub EmptyCaches()
Self.mConfigOptionCache = New Dictionary
End Sub
#tag EndEvent

#tag Event
Function GetSchemaVersion() As Integer
Return 102
Expand Down

0 comments on commit f394807

Please sign in to comment.