Namespace Serenity.Shared.Utils
Classes
AsyncMutex
Serializes an asynchronous critical section. Callers await LockAsync(CancellationToken) and
release by disposing the returned handle, so a whole check-then-act sequence that spans
await points runs to completion before the next caller observes the state.
CsvEscaping
Turns raw values into RFC 4180 CSV fields, so a value carrying a comma, a quote, a line break or significant whitespace survives the trip into a spreadsheet or a storefront's bulk importer intact.
DisplayValue
FileUtils
Utility class for file operations
LocalePreviewMatcher
Pure decision logic for picking which translation candidate best previews a selected locale.
NamingSanitizer
Single source of truth for the file-name and C#-identifier sanitization rules the editor asset creators (GameSettingCreator, FeedbackCreator, CutsceneCreator, ModalCreator, ThemeCreator, AudioChannelCreator, and the audio/music batch importers) each duplicated near-identically. Engine-agnostic (pure string logic over GetInvalidFileNameChars()), so it lives in Shared rather than any one Business or Unity module.
NumberUtils
Utility class for number operations
ObjectUtils
Utility class for object operations
OnceGuard
Lets a piece of work happen exactly once, with no key to distinguish call sites — the single-latch form of OnceGuard<TKey>.
OnceGuard<TKey>
Lets a piece of work happen exactly once per key. The canonical use is a warn-once latch: a misconfiguration that would otherwise log on every dispatch, every frame or every call gets reported the first time and stays quiet afterwards, while a DIFFERENT key still reports.
ParseUtils
Utility class for parsing operations
ParseUtils.Bool
Utility class for parsing boolean values
ParseUtils.Bool.BoolStrings
Utility class for converting boolean values to various string representations
ParseUtils.Bool.BoolStrings.Active
Utility class for converting boolean values to various string representations
ParseUtils.Bool.BoolStrings.Bool
Utility class for converting boolean values to various string representations
ParseUtils.Bool.BoolStrings.Interaction
Utility class for converting boolean values to various string representations
ParseUtils.Bool.BoolStrings.Response
Utility class for converting boolean values to various string representations
ParseUtils.Bool.BoolStrings.Switch
Utility class for converting boolean values to various string representations
ParseUtils.Float
Utility class for parsing float values
ParseUtils.Int
Utility class for parsing integer values
ParseUtils.Type
ReentrancyGate
Lets a piece of work refuse to run again WHILE it is still running, then allows it once more after it finishes. The canonical use is a handler that can be re-entered by something it itself triggers: a submit whose signals switch input maps and re-fire the still-held button, a save that reacts to its own change notification.
The sibling of OnceGuard, and deliberately not the same thing: OnceGuard latches
forever (the work happens once for the lifetime of the guard), while this one releases on
Exit() (the work happens as often as it is asked, just never nested inside itself).
Not thread-safe on purpose: re-entrancy here means "on the same call stack", which is what the callers guard against; a lock would hang the very re-entrant call it is meant to reject.
ReflectionActivationUtils
Reflection helpers for resolving a Type by name and converting a raw string into an
argument of an arbitrary target type. Mirrors the private matching semantics of
Serenity.Tasking.Application.Tasks.ReflectionCallTask (the source of truth: an exact
FullName match, then a short-name match only when it uniquely identifies a single
loaded type) so every reflection-based activation site in Serenity behaves identically for a given
type name. Kept as a standalone copy rather than having ReflectionCallTask delegate here, to
avoid changing the behavior of that existing boot-pipeline task outside dedicated test coverage.
SafeCollectionUtils
Utility class for safe array and collection operations
SerenityTextEliding
Pure string truncation for display labels too long for their control. Elides from the LEFT — keeps the tail of the string and prefixes an ellipsis — because the distinguishing part of Serenity's generated names (a specific profile, module, or variant) usually lives at the end rather than the start, so keeping the prefix instead would throw away the information the reader actually needs.
SignalCategoryFiltering
Pure predicates behind the Signal Flow Browser's search box and category chip row: no engine or scan-data types, only the booleans/strings the caller has already derived per signal.
SingletonSettingsSelection
The ownership rule every singleton settings lookup applies, both at runtime
(UnitySingletonSettingsLoader) and in editor validation
(SerenitySystemConfigurationResolver): a project-owned settings asset beats a
shipped one with the same Id. Engine-agnostic and Unity-free — the caller decides what
"project-owned" and "Id" mean for its own candidate type.
Not the rule a COLLECTION lookup applies. This one asks "which candidate is authoritative for one
slot" and answers by OWNERSHIP; CollectionSettingsSelection asks "is this asset the one
another was cloned from" and answers by ID PAIRING, without consulting ownership at all. Two
questions, two rules — do not merge them.
StringUtils
Utility class for common string operations and formatting
UniqueNameGenerator
Single source of truth for "make this name unique among the ones already taken" — the suffix loop that menu option ids, HUD element ids, leaderboard button ids, and audio mixer group names each hand-rolled with a slightly different separator, starting number, and bare-base-name policy. UniqueNameSuffixStyle captures exactly those three differences; comparisons are always ordinal, matching every site this replaces.
ValueDisplayFormatter
Renders a raw numeric value as invariant-culture display text according to a ValueDisplaySpec. Pure formatting with no engine dependencies, so it can be unit tested outside an editor/player context and shared by every module that puts a number on screen (HUD elements, leaderboard rows, results screens).
Structs
SignalCategoryCounts
Per-category signal counts across a scan, as tallied by ComputeCategoryCounts(IReadOnlyList<SignalCategoryUsage>).
SignalCategoryUsage
Which kinds of dispatch a single signal has, independent of how many of each.
StopwatchDisplayOptions
How a duration is written out: which units appear, how they are padded, and what separates them.
UniqueNameSuffixStyle
Describes how UniqueNameGenerator turns a taken base name into a fresh candidate: what text separates the base from the numeric suffix, which number the suffix counting starts from, and whether the bare base name itself is an acceptable first candidate.
ValueDisplaySpec
A complete description of how to render one numeric value as text: the format family plus the knobs that only apply to the numeric families (decimal precision, zero padding, thousands grouping). Time formats ignore every knob — their shape is fixed by the format itself.
Enums
ParseUtils.Bool.BoolStringsTypes
Enumeration of the different types of boolean string representations
SignalCategoryFilter
Mutually exclusive signal category filter for the Signal Flow Browser's chip row
(Serenity.EventDispatcher.Infrastructure.Editor.SerenitySignalFlowBrowserWindow), combined
with the text search via AND semantics.
SingletonSelectionOutcome
How Pick<T>(IReadOnlyList<T>, Func<T, bool>, Func<T, string>, out SingletonSelectionOutcome) resolved a set of candidates for a singleton settings type.
TimeUnitVisibility
Whether a time unit is shown.
ValueDisplayFormat
How a numeric value should be rendered as display text.