Repository navigation
Delete DLL backups on game update - #588
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds tracking and cleanup of DLL backups when a game update externally changes a DLL, ensuring history events reflect actual state and removing obsolete backup files.
- Introduces new
GameHistoryEventTypevalues (DLLDetected,DLLChangedExternally,DLLBackupRemoved) and corresponding resource entries and converter mappings. - Extends
GameHistorywith anAssetPathcolumn and updates database inserts to record history events and delete outdated backups. - Refactors
ProcessGameto extract repeated asset-processing logic into a local function and updatesLoadCoverImageAsyncto batch-insert history entries.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Translations/en-US/Resources.resw | Added new event labels and updated existing DLL event strings |
| src/Data/GameHistory.cs | Added new enum members and AssetPath property for history tracking |
| src/Data/Game.cs | Refactored ProcessGame, implemented history recording & backup cleanup |
| src/Converters/GameHistoryEventTypeToLabelConverter.cs | Mapped new event types to resource labels |
Comments suppressed due to low confidence (5)
src/Data/GameHistory.cs:28
- After adding AssetPath to GameHistory, ensure you include a corresponding database migration or schema update to add the asset_path column to the GameHistory table. Without this, insert operations may fail at runtime.
[Column("asset_path")]
src/Data/Game.cs:315
- [nitpick] The local function name
ProcessGame_ProcessGameAssetduplicates the containing method's name and is quite verbose. Consider renaming it to something more concise likeHandleGameAssetorProcessAssetUpdatefor clarity.
void ProcessGame_ProcessGameAsset(GameAsset gameAsset)
src/Data/Game.cs:312
- [nitpick] This method has grown significantly with nested local functions and branching. Consider extracting the asset-processing logic into private helper methods on the class to reduce complexity and improve readability.
var dllHistory = new List<GameHistory>();
src/Data/Game.cs:481
- [nitpick] There's a commented-out block for
backupGameAssetlogic that appears obsolete. Remove this commented code to keep the codebase clean.
}
src/Data/Game.cs:329
- Consider adding unit tests for
ProcessGameto verify that the new history events (DLLDetected,DLLChangedExternally,DLLBackupRemoved) are correctly recorded when assets are added, changed, or backups removed.
dllHistory.Add(new GameHistory()
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Changes
When a DLL changes externally we delete the backup file. The intent is that when a game updates the backup is removed because the DLL is technically no longer swapped. This leads the user to believe that resetting will put the game back to where it was, but in reality you are swapping back to what the game had before the update.
Type of Change
Issues Resolved
#514