JSON backing store, I/O fixes, Networking Security

Introduced Newtonsoft.Json-backed persistence.
Improved backing-store reliability and serialization across the caching stack.
Improved networking security posture.

Key changes:
- Add new GameCult.Caching.NewtonsoftJson project with SingleFile/MultiFile backing stores and polymorphic known-type envelopes.
- Add MessagePack helper serialization (DatabaseEntrySerialization) and update MessagePack backing stores to use the shared options/resolver; add DatabaseLink formatter and generator/analyzer docs.
- Update CultLib.sln to include the new projects and new caching tests project.
- Improve CultCache persistence behavior: track pending store operations, wait for operations on PullAll, and centralize async push handling with error logging.
- Harden file I/O in multi-file/single-file stores: atomic temp-file writes, safe Replace/Move semantics, rename-safe deletes, and improved file-watcher subscription and debounce disposal.
- Add README files and documentation for several subprojects and packaging projects.

These changes add JSON persistence support, improve serialization consistency, and make on-disk operations more robust and observable.
This commit is contained in:
Meta Vens 2026-04-18 13:01:24 +01:00
commit 0bfc85a4f2
50 changed files with 3957 additions and 325 deletions

View file

@ -2,16 +2,21 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace GameCult.Caching
{
/// <summary>
/// Provides cached reflection helpers used by the cache infrastructure.
/// </summary>
public static class ReflectionExtensions
{
private static Dictionary<Type, Type[]> ParentTypes = new Dictionary<Type, Type[]>();
/// <summary>
/// Gets all base types for the supplied type, caching the result.
/// </summary>
/// <param name="type">The type whose parent types should be returned.</param>
/// <returns>An array of base types ordered from immediate parent upward.</returns>
public static Type[] GetParentTypes(this Type type)
{
if (ParentTypes.ContainsKey(type))
@ -37,6 +42,12 @@ namespace GameCult.Caching
}
private static Dictionary<Type, Type[]> ChildClasses = new Dictionary<Type, Type[]>();
/// <summary>
/// Gets all loaded types assignable to the supplied type, caching the result.
/// </summary>
/// <param name="type">The base type or interface to search from.</param>
/// <returns>An array of matching loaded types.</returns>
public static Type[] GetAllChildClasses(this Type type)
{
if (ChildClasses.ContainsKey(type))
@ -44,6 +55,5 @@ namespace GameCult.Caching
return ChildClasses[type] = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(ass => ass.GetTypes()).Where(type.IsAssignableFrom).ToArray();
}
}
}
}