-
Notifications
You must be signed in to change notification settings - Fork 28
Create TitleUpdateEnabler
#54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FromDarkHell
wants to merge
2
commits into
XboxUnity:master
Choose a base branch
from
FromDarkHell:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| scriptTitle = "Title Update Enabler" | ||
| scriptAuthor = "FDH" | ||
| scriptVersion = 1.0 | ||
| scriptDescription = "Automatically enables all cached title updates" | ||
| scriptIcon = "icon.png" | ||
| scriptPermissions = { "sql" } | ||
|
|
||
| MainMenu = { | ||
| "Enable All", | ||
| "Disable All" | ||
| } | ||
|
|
||
| MainMenuOption_EnableAll = 1 | ||
| MainMenuOption_DisableAll = 2 | ||
|
|
||
| -- Main entry point to script | ||
| function main() | ||
| ResetToMainMenu() | ||
| end | ||
|
|
||
| -- Return to start of the application | ||
| function ResetToMainMenu() | ||
| -- Show Main Menu | ||
| local selectedMenuOption = ShowMainMenu() | ||
|
|
||
| if selectedMenuOption == MainMenuOption_EnableAll then | ||
| EnableAllTitleUpdates() | ||
| elseif selectedMenuOption == MainMenuOption_DisableAll then | ||
| DisableAllTitleUpdates() | ||
| end | ||
| end | ||
|
|
||
| -- Display Main Menu and return selected option's index, or -1 if cancelled | ||
| function ShowMainMenu() | ||
| local dialogBox = Script.ShowPopupList(scriptTitle, "Select an option", MainMenu) | ||
| if not dialogBox.Canceled then | ||
| return dialogBox.Selected.Key | ||
| end | ||
|
|
||
| return -1 | ||
| end | ||
|
|
||
| -- Enable all title updates | ||
| function EnableAllTitleUpdates() | ||
| -- First, clear any existing active title updates | ||
| Sql.Execute("DELETE FROM ActiveTitleUpdates") | ||
|
|
||
| -- Get all title updates from ContentItems.db | ||
| local titleUpdates = Sql.ExecuteFetchRows("SELECT Id FROM TitleUpdates") | ||
|
|
||
| if #titleUpdates == 0 then | ||
| Script.ShowMessageBox("No Title Updates", "No title updates found in database.", "OK") | ||
| ResetToMainMenu() | ||
| return | ||
| end | ||
|
|
||
| -- Add each title update to ActiveTitleUpdates | ||
| local successCount = 0 | ||
| for i, titleUpdate in ipairs(titleUpdates) do | ||
| local titleUpdateId = titleUpdate.Id | ||
|
|
||
| -- Insert into ActiveTitleUpdates table | ||
| local success = Sql.Execute("INSERT INTO ActiveTitleUpdates (TitleUpdateId) VALUES (" .. titleUpdateId .. ")") | ||
|
|
||
| if success then | ||
| successCount = successCount + 1 | ||
| end | ||
| end | ||
|
|
||
| if successCount >= 1 then | ||
| local ret = Script.ShowMessageBox("Title Updates Enabled", "Successfully enabled " .. successCount .. " of " .. #titleUpdates .. " title updates.\nIn order for the changes to take effect you need to reload Aurora\nDo you want to reload Aurora now?", "No", "Yes") | ||
|
|
||
| if ret.Button == 2 then | ||
| Aurora.Restart(); | ||
| end | ||
| else | ||
| Script.ShowMessageBox( | ||
| "Title Updates Enabled", | ||
| "Enabled " .. successCount .. " of " .. #titleUpdates .. " title updates.", | ||
| "OK" | ||
| ) | ||
| end | ||
|
|
||
| ResetToMainMenu() | ||
| end | ||
|
|
||
| -- Disable all title updates | ||
| function DisableAllTitleUpdates() | ||
| -- Clear all entries from ActiveTitleUpdates | ||
| local success = Sql.Execute("DELETE FROM ActiveTitleUpdates") | ||
|
|
||
| if success then | ||
| local ret = Script.ShowMessageBox("Title Updates Disabled", "All title updates have been disabled.\nIn order for the changes to take effect you need to reload Aurora\nDo you want to reload Aurora now?", "No", "Yes") | ||
|
|
||
| if ret.Button == 2 then | ||
| Aurora.Restart(); | ||
| end | ||
|
|
||
| else | ||
| Script.ShowMessageBox("Error", "Failed to disable title updates.", "OK") | ||
| end | ||
|
|
||
| ResetToMainMenu() | ||
| end | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.