PolyhydraGames.Core.Models
1.0.2.7
dotnet add package PolyhydraGames.Core.Models --version 1.0.2.7
NuGet\Install-Package PolyhydraGames.Core.Models -Version 1.0.2.7
<PackageReference Include="PolyhydraGames.Core.Models" Version="1.0.2.7" />
<PackageVersion Include="PolyhydraGames.Core.Models" Version="1.0.2.7" />
<PackageReference Include="PolyhydraGames.Core.Models" />
paket add PolyhydraGames.Core.Models --version 1.0.2.7
#r "nuget: PolyhydraGames.Core.Models, 1.0.2.7"
#:package PolyhydraGames.Core.Models@1.0.2.7
#addin nuget:?package=PolyhydraGames.Core.Models&version=1.0.2.7
#tool nuget:?package=PolyhydraGames.Core.Models&version=1.0.2.7
Core.Models
A .NET utility library providing common models, helpers, and reactive extensions for the PolyhydraGames ecosystem.
What This Library Provides
PolyhydraGames.Core.Models is a shared utility library containing common DTOs, caching, serialization helpers, and reactive extensions used across multiple projects. It eliminates duplication by centralizing frequently-needed model types and helpers.
Key Types
| Category | Type | Purpose |
|---|---|---|
| Caching | Cache<T> |
Simple in-memory cache with automatic expiration |
CacheHelper |
Utility methods for cache management | |
| Data | CSVExtensions |
CSV parsing and generation extension methods |
JsonHelper |
JSON serialization/deserialization helpers | |
| Identifiers | IStronglyTypedId<TValue> |
Marker contract for primitive-backed identifier value objects |
IGuidId |
Common contract for GUID-backed identifiers | |
IStringId |
Common contract for string-backed identifiers | |
IOptionalStringId |
Common contract for string-backed identifiers where empty means missing | |
StringIdHelpers |
Shared normalization helpers for optional string identifiers | |
StronglyTypedId |
Factory and parse helpers for primitive-backed identifier value objects | |
StronglyTypedGuidConverter<TId> |
JSON converter for GUID-backed identifier structs | |
StronglyTypedStringConverter<TId> |
JSON converter for string-backed identifier structs | |
StronglyTypedOptionalStringConverter<TId> |
JSON converter for optional string-backed identifier structs | |
StronglyTypedInt32Converter<TId> |
JSON converter for int-backed identifier structs | |
StronglyTypedInt64Converter<TId> |
JSON converter for long-backed identifier structs | |
StronglyTypedIdJsonConverterFactory |
JSON converter factory for supported strongly typed ID backing types | |
| Media | LocalMediaFile |
Shared model for local/NAS-backed media files |
MediaScanRoot |
Shared model for filesystem or NAS scan roots | |
MediaTechnicalMetadata |
Shared technical metadata container for video/audio/image/ROM details | |
MediaPlaylist |
Shared playlist/playout manifest for media, clipping, and broadcast consumers | |
MediaPathHelpers |
Pure path, extension, and media-kind normalization helpers | |
| Reactive | ObservableExtensions |
Custom reactive extensions for System.Reactive |
ObservableFileMonitor |
File system watcher wrapper using observables | |
SubjectObservable<T> |
Subject-based observable implementation | |
| Enums | EnumDescription |
Enum metadata and display name resolution |
EnumDescriptionExtensions |
Extension methods for enum description lookup | |
| State | OneTimeUseBool |
Boolean that flips from true to false after first read |
ToggleBoolean |
State toggle helper | |
InjectableSave |
Save mechanism for dependency-injectable services | |
| Network | PortReply |
Network port reply model |
PortReplyExtensions |
Extension methods for port reply handling | |
| Utilities | TimeStamp |
Timestamp wrapper with formatting helpers |
DelayTimer |
Timer utility for delayed operations | |
IPortListener |
Interface for port listening services |
Common Use Cases
1. Caching Data
var cache = new Cache<MyData>(myData, TimeSpan.FromMinutes(5));
var result = cache.Value; // null/default if expired
2. Watching Files Reactively
var monitor = new ObservableFileMonitor("path/to", "file.txt");
monitor.Observable.Subscribe(path => Console.WriteLine($"File changed: {path}"));
monitor.Initialize();
3. Enum Descriptions
var description = new EnumDescription<MyEnum>(
MyEnum.SomeValue,
"Some Value",
"Display description");
4. CSV Parsing
var records = csvContent.FromCSV<MyRecord>();
var output = records.ToCSV();
5. JSON Helpers
var json = myObject.ToJson();
var obj = json.FromJson<MyType>();
Integration Instructions
Install via NuGet
<PackageReference Include="PolyhydraGames.Core.Models" Version="1.0.1.20" />
The package is published publicly on nuget.org. New main builds publish 1.0.2.<run_number> when the repository has a valid NUGET_API_KEY secret.
Target Frameworks
- Main package:
net8.0andnet9.0(multi-target) - Test project:
net10.0
Prerequisites
- .NET 10.0 SDK or later for the current test project
- .NET 8.0 and .NET 9.0 targeting packs for the library targets
- The following NuGet packages are automatically resolved:
PolyhydraGames.Core.Interfaces(v2.0.0.45)PolyhydraGames.Extensions(v2.1.1.73)System.Reactive(v6.1.0)
Building
# Build the solution
dotnet build PolyhydraGames.Core.Models.sln
# Run tests
dotnet test Tests/PolyhydraGames.Core.Models.Test.csproj
Typical Usage
using PolyhydraGames.Core.Models;
using PolyhydraGames.Core.Models.Identifiers;
using PolyhydraGames.Core.Models.Media;
// Now use any of the types listed above
Projects That Use This Library
- OAuth.Core
- All API projects
- Spotabot
- Channel Cheevos
📖 Documentation
Detailed documentation can be found in the following sections:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- PolyhydraGames.Core.Interfaces (>= 2.0.0.45)
- PolyhydraGames.Extensions (>= 2.1.1.73)
- System.Reactive (>= 6.1.0)
-
net9.0
- PolyhydraGames.Core.Interfaces (>= 2.0.0.45)
- PolyhydraGames.Extensions (>= 2.1.1.73)
- System.Reactive (>= 6.1.0)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on PolyhydraGames.Core.Models:
| Package | Downloads |
|---|---|
|
PolyhydraGames.OAuth.Core
Package Description |
|
|
PolyhydraGames.Api.Fitbit
Package Description |
|
|
PolyhydraGames.GamePlayer.Core
Package Description |
|
|
PolyhydraGames.Twitch
Package Description |
|
|
PolyhydraGames.Godot.Core
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2.7 | 54 | 5/12/2026 |
| 1.0.2.6 | 49 | 5/12/2026 |
| 1.0.1.20 | 142 | 5/8/2026 |
| 1.0.1.19 | 178 | 5/6/2026 |
| 1.0.1.18 | 251 | 5/4/2026 |
| 1.0.1.17 | 86 | 5/4/2026 |
| 1.0.1.16 | 89 | 5/4/2026 |
| 1.0.1.15 | 518 | 4/4/2026 |
| 1.0.1.14 | 627 | 3/7/2026 |
| 1.0.1.13 | 3,209 | 9/29/2025 |
| 1.0.1.12 | 1,364 | 7/3/2025 |
| 1.0.1.11 | 251 | 7/3/2025 |
| 1.0.1.10 | 730 | 5/7/2025 |
| 1.0.1.9 | 822 | 2/11/2025 |
| 1.0.1.8 | 206 | 2/11/2025 |
| 1.0.1.6 | 981 | 11/2/2024 |
| 1.0.1.5 | 176 | 11/2/2024 |
| 1.0.1.4 | 186 | 11/2/2024 |
| 1.0.1.3 | 188 | 11/2/2024 |
| 1.0.1.2 | 174 | 11/2/2024 |