Initial Version

This commit is contained in:
X4Lo committed 2026-10-30 13:36:27 +00:00
commit 72e35002f7
55 files changed
+4365

No files matched your search

+94
View File
@@ -0,0 +1,94 @@
# Architecture and development
## Repository layout
```
GameCollections/
├─ source/
│ ├─ GameCollections.sln
│ └─ GameCollections/ the extension project
│ ├─ GameCollectionsPlugin.cs entry point (GenericPlugin)
│ ├─ extension.yaml Playnite extension manifest
│ ├─ icon.png extension, menu and sidebar icon
│ ├─ Localization/en_US.xaml all user-visible strings (LOCGameCollections_*)
│ ├─ Models/ persisted data types
│ ├─ Services/ storage, business logic, dialogs, image loading
│ ├─ Settings/ ISettings implementation and settings view
│ ├─ ViewModels/ MVVM view models
│ └─ Views/ XAML views, shared styles, converters
├─ manifests/
│ ├─ installer_manifest.yaml release list Playnite reads for installs and updates
│ └─ X4Lo_GameCollections.yaml entry for the Playnite add-on database
├─ docs/ this documentation
├─ screenshots/ images for the README and add-on database
├─ .github/ CI build/release workflow, issue template
└─ dist/ build output: the .pext package (git-ignored)
```
## Building
Requirements: the .NET SDK (any version that supports SDK-style projects; 6.0 or later recommended).
The .NET Framework 4.6.2 reference assemblies are restored from NuGet automatically, so no targeting pack is needed.
```
dotnet build source/GameCollections.sln -c Release
```
This produces `source/GameCollections/bin/Release/` and the installable package
`dist/GameCollections_3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54_<version>.pext`.
To try a build in Playnite, open the `.pext` file (Playnite installs it after a restart), or add
`source/GameCollections/bin/Debug` under *Settings → For developers → Custom extension folders*.
## Playnite conventions followed
- `Playnite.SDK` is referenced with `ExcludeAssets="runtime"`, so the SDK DLL is never shipped – Playnite provides it.
- All strings live in `Localization/en_US.xaml` and are read with `ResourceProvider.GetString`; Playnite loads the
file matching the user's language, falling back to `en_US`.
- Views only use Playnite theme resources (`TextBrush`, `NormalBrush`, `FontIcoFont`, …) so every theme,
light or dark, styles them.
- Dialogs are created with `PlayniteApi.Dialogs.CreateWindow` so they get the theme's window style.
- Logging goes through `LogManager.GetLogger()` into Playnite's `extensions.log`.
- Data lives in `GetPluginUserDataPath()`; settings use `LoadPluginSettings` / `SavePluginSettings`.
- Database events are unsubscribed in `OnApplicationStopped`, and UI updates are marshalled to the UI dispatcher.
## Main components
| Component | Responsibility |
|-----------|----------------|
| `GameCollectionsPlugin` | Wires everything together; game menu item, sidebar item, settings; reacts to library changes. |
| `CollectionRepository` | Reads/writes `collections.json`. Atomic save (temp file + `File.Replace` with a `.bak`), recovery from the backup, data sanitising. |
| `PosterStorage` | Copies custom posters into `Posters\`, deletes them, cleans up orphans. |
| `CollectionManager` | All collection rules: validation, unique titles, create/update/delete, membership changes in one save, poster resolution, pruning deleted games. Raises `CollectionsChanged`. |
| `ImageLoader` | Asynchronous, downscaled (`DecodePixelWidth`), frozen, cached image decoding with limited concurrency. |
| `DialogService` | Hosts the Add to Collection and create/edit dialogs in Playnite windows. |
| `CollectionsRootViewModel` | Sidebar page navigation (home ↔ collection) and shared open/edit/delete actions. Lives for the whole session so view state is kept. |
| `CollectionsHomeViewModel` / `CollectionDetailsViewModel` | The Collections page and a collection's page. |
| `AddToCollectionViewModel` / `EditCollectionViewModel` | The two dialogs. |
### Data model
```json
{
"SchemaVersion": 1,
"Collections": [
{
"Id": "guid",
"Title": "Couch co-op",
"Description": "",
"Rating": 8.5,
"PosterFileName": "guid_ticks.png",
"GameIds": ["game guid", "..."],
"CreatedAt": "2026-10-30T12:00:00Z",
"ModifiedAt": "2026-10-30T12:00:00Z"
}
]
}
```
Only game IDs are stored. Missing games are removed on startup and whenever Playnite deletes a game.
### Performance
Covers and posters are decoded at display size, off the UI thread, and cached. On a collection's page,
covers are only requested for tiles that are scrolled into view.
+71
View File
@@ -0,0 +1,71 @@
# User guide
## Adding games to collections
1. Select one or more games in the library, right-click, and choose **Add to Collection…**.
2. Type in the search box to filter your collections, then tick or untick them.
- With several games selected, a collection that contains only some of them shows a mixed (■) check.
Clicking it cycles through *remove from all → add to all → leave as is*.
3. If no collection matches what you typed, press **Enter** or click **Create "…"** to create one with that name.
It is ticked automatically. Names are unique, ignoring capitals and extra spaces.
4. Click **Save** (or press **Enter**) to apply. **Cancel** or **Esc** discards every change, including new collections.
Keyboard: **↓/↑** move between the search box and the list, **Space** toggles the highlighted collection.
## The Collections page
Click **Collections** in the sidebar. The page keeps its state (open collection, search, sort) while Playnite is running.
- **Search** filters by title.
- **Grid / List** toggle (top right) switches views; your choice is remembered between sessions.
- **New collection** opens the create dialog.
- Open a collection with a click (grid) or a double-click (list).
- Edit or delete from the right-click menu, the buttons on list rows, or the keyboard:
**Enter** opens, **F2** edits, **Delete** deletes (after confirmation).
Deleting a collection never deletes or changes any games.
## Creating and editing a collection
| Field | Notes |
|-------------|-------|
| Title | Required, up to 100 characters, unique (case-insensitive). |
| Description | Optional, up to 2000 characters. |
| Rating | 0–10 in steps of 0.5, shown as `8.5/10`. |
| Poster | Optional PNG, JPG, BMP, GIF or TIFF. The image is copied into the extension's data, so moving the original later is fine. **Remove** goes back to the automatic poster. |
When there's no custom poster, the cover of the first game in the collection is used; with no cover either,
a placeholder is shown.
## A collection's page
- Header with poster, title, rating, game count and description, plus **Edit**, **Select in library** and **Delete**.
- **Search** the collection's games by name.
- **Sort** by collection order (the order games were added), name, release date, last played, time played
or date added, ascending or descending.
- **Installed only** hides games that aren't installed (uninstalled games are dimmed otherwise).
- For each game (right-click, or keyboard):
- **Play** / **Install** – double-click or **Enter**.
- **Show in library** – selects the game in Playnite's library view.
- **Remove from collection** – **Delete**. Works on several selected games at once (Ctrl/Shift-click).
## Where data is stored
In Playnite's `ExtensionsData\3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54` folder:
- `collections.json` – your collections. `collections.json.bak` holds the previous save.
- `Posters\` – copies of custom posters.
- `config.json` – extension settings.
Back up this folder to back up your collections. If `collections.json` ever becomes unreadable, it is renamed to
`collections.unreadable-<date>.json`, the backup is loaded instead, and Playnite shows a notification.
## Known limitations
These come from Playnite's extension API:
- Extensions can't open a game's details page directly. **Show in library** selects the game and switches to
the library view, where its details appear. If a library filter hides the game, Playnite can't select it –
clear the filter and try again.
- Extensions can't embed Playnite's own library grid, so a collection's page uses its own game grid.
- The extension targets Desktop mode. Fullscreen mode doesn't show sidebar views or game context menus from extensions.