AyCode.Core/AyCode.Core/Helpers
Loretta 8ff75de55c Add segment streaming to SignalR binary protocol
Implements segment-level streaming for SignalR binary protocol via new AsyncPipeWriterOutput and PipeReaderBinaryInput types, enabling chunked serialization/deserialization directly over PipeWriter/PipeReader. Adds BinaryProtocolMode enum to select between standard and streaming modes. Updates protocol classes and documentation. Lays groundwork for future async streaming support.
2026-04-10 09:27:40 +02:00
..
AcCharsGenerator.cs AcCharsGenerator.NewPassword improvements 2024-07-06 07:22:26 +02:00
AcObservableCollection.cs Refactor serialization infra, add perf benchmarks 2025-12-30 19:29:39 +01:00
ConstHelper.cs .net packages update to 8.0.8; fixes, etc... 2024-08-14 16:05:32 +02:00
JsonUtilities.cs Optimize serialization: precompute type metadata, remove caches 2026-02-08 08:13:34 +01:00
PasswordHasher.cs refactoring, improvements, fixes... 2024-05-03 15:37:41 +02:00
PropertyHelper.cs Refactor: Add high-perf JSON serializer & merge support 2025-12-14 19:34:49 +01:00
README.md Document AcBinary wire format, sync docs, update conventions 2026-03-29 09:11:57 +02:00
TaskHelper.cs Add segment streaming to SignalR binary protocol 2026-04-10 09:27:40 +02:00

README.md

Helpers

Utility classes for token generation, observable collections, type metadata, password security, and async patterns.

Key Files

  • AcCharsGenerator.cs — Random token/password generation from predefined char pools (Letters, Numbers, LettersAndNumbers). NewToken() (8-12 chars), NewPassword() (configurable length).
  • AcObservableCollection.cs — Thread-safe ObservableCollection<T> with batch updates (BeginUpdate()/EndUpdate()), SynchronizationContext capture for UI thread marshalling (Blazor), PopulateFromJson(), SortAndReplace().
  • ConstHelper.cs — Reflection-cached lookup of const int field names by value. Used for debug/logging to show human-readable constant names.
  • JsonUtilities.cs — Central type metadata and detection utilities:
    • Pre-cached Type handles for primitives, generics, collections
    • FrozenSet<Type> for fast primitive checks
    • IsPrimitiveOrStringFast(), IsGenericCollectionType(), IsDictionaryType(), GetCollectionElementType()
    • DetectSerializerType() — auto-detect JSON vs Binary from bytes/string
    • UTF8 buffer pool: RentUtf8Buffer(), ReturnUtf8Buffer()
    • String escaping: NeedsEscaping(), WriteEscapedString()
  • PasswordHasher.cs — PBKDF2-HMAC-SHA512 with 10,000 iterations. Critical: do not modify GenerateDynamicSalt() or GenerateFinallySalt() — login will break. Format: $bcrypt$v=1$salt=...base64...$hash=...base64...
  • PropertyHelper.csCopyPublicValueTypeProperties<TSource, TDest>() for DTO/entity mapping via reflection.
  • TaskHelper.csWaitTo()/WaitToAsync() (poll predicate with timeout using PeriodicTimer), Forget() (fire-and-forget), RunOnThreadPool().