1.7 KiB
1.7 KiB
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-safeObservableCollection<T>with batch updates (BeginUpdate()/EndUpdate()),SynchronizationContextcapture for UI thread marshalling (Blazor),PopulateFromJson(),SortAndReplace().ConstHelper.cs— Reflection-cached lookup ofconst intfield names by value. Used for debug/logging to show human-readable constant names.JsonUtilities.cs— Central type metadata and detection utilities:- Pre-cached
Typehandles for primitives, generics, collections FrozenSet<Type>for fast primitive checksIsPrimitiveOrStringFast(),IsGenericCollectionType(),IsDictionaryType(),GetCollectionElementType()DetectSerializerType()— auto-detect JSON vs Binary from bytes/string- UTF8 buffer pool:
RentUtf8Buffer(),ReturnUtf8Buffer() - String escaping:
NeedsEscaping(),WriteEscapedString()
- Pre-cached
PasswordHasher.cs— PBKDF2-HMAC-SHA512 with 10,000 iterations. Critical: do not modifyGenerateDynamicSalt()orGenerateFinallySalt()— login will break. Format:$bcrypt$v=1$salt=...base64...$hash=...base64...PropertyHelper.cs—CopyPublicValueTypeProperties<TSource, TDest>()for DTO/entity mapping via reflection.TaskHelper.cs—WaitTo()/WaitToAsync()(poll predicate with timeout usingPeriodicTimer),Forget()(fire-and-forget),RunOnThreadPool().