Consolidate repeated App-layer patterns and reduce duplication - #29
Merged
Conversation
- SimpleConfig: share try/catch fallback via ReadOrDefault<T> - TarkovDev/JsonApiModels: extract Identifiable/Entity/NamedEntity base classes - TarkovDevAPI: reuse MaterializeCachedArray for offline cache loading; share craft/barter fetch through FetchJObjectListAsync<T> - ItemExtensions: combine duplicate mark/buildWeapon handling - MapDataLoader: add ResetCache helper for repeated cache clears - TarkovTrackerDB: add IsCurrentConfiguration helper for token/endpoint/mode checks - ActiveHotkey: collapse four constructor overloads into two plus Initialize - Logger: share backlog flush between ProcessBacklog and Flush - UserActivityHelper: add ThrowLastWin32Error helper for hook failures
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request consolidates repeated helper logic across configuration, logging, cache handling, API parsing, input hooks, and JSON models. It also combines mark/build-weapon objective handling and centralizes current-configuration checks. ChangesApplication refactors
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Summary
This is a focused cleanup pass that removes obvious, low-risk duplication across
src/Appwithout changing product behavior.SimpleConfig: replaced six nearly-identicaltry { parse(...) } catch { return defaultValue; }read methods with oneReadOrDefault<T>helper.TarkovDev/JsonApiModels: extractedIdentifiable/Entity/NamedEntitybase classes so theid,name, andnormalizedNameJSON properties are declared once.TarkovDevAPI: offline cache loading now reuses the existingMaterializeCachedArraymethod (removing six duplicatedJsonConvert.DeserializeObjectlambdas), and the craft/barter fetch methods now share a genericFetchJObjectListAsync<T>pipeline.ItemExtensions: merged the identicalmarkandbuildWeaponobjective branches into a single pattern check.MapDataLoader: replaced four repeated cache-reset assignments with aResetCachehelper.TarkovTrackerDB: extracted the token/endpoint/mode equality check intoIsCurrentConfigurationand called it from bothConfigureand token validation.ActiveHotkey: collapsed four constructor overloads into two constructors plus a sharedInitializemethod, removing duplicated listener wiring.Logger:ProcessBacklogandFlushnow share a singleFlushBacklogLockedimplementation.UserActivityHelper: addedThrowLastWin32Errorand used it for the three identicalMarshal.GetLastWin32Error()/new Win32Exception(...)blocks.All changes were validated with:
(
dotnetwas not initially onPATH; the .NET 10 SDK was installed via Chocolatey andRatEyesubmodules were initialized before building.)Link to Devin session: https://app.devin.ai/sessions/dd0b650ddf6e4ff69c9a1061d1667e5f
Requested by: @DysektAI
Summary by cubic
Consolidates repeated App-layer patterns to reduce duplication and centralize logic. No behavior changes; improves readability and maintenance.
Written for commit 3d5623e. Summary will update on new commits.