AyCode.Core/AyCode.Core/Consts/README.md

1.0 KiB

Consts

Project-wide constants, error codes, environment configuration, regex patterns, and input validation.

Key Files

  • AcConst.cs — Central constants: ProjectId/ProjectSalt (loaded from appsettings), user/password length limits, TCP/messaging defaults, well-known Guids, AvailableDomainSuffixes (300+ TLDs). Critical: GenerateProjectSalt() must not be modified — it is tied to authentication.
  • AcEnv.cs — Environment access: AppConfiguration (lazy-loaded from appsettings.json + env vars), NL (newline), MaxLogItemsPerSession, GetEnum<T>() config helper.
  • AcErrorCode.cs — Byte enum with 60+ error codes (0=UnknownError ... 255=Unset). Used across the entire API layer.
  • AcRegExpression.cs — Compile-time generated regex via [GeneratedRegex]: EmailRegex() (RFC-compliant), PhoneNumberRegex() (E.164 format).
  • AcValidate.cs — Input validation methods returning bool + out AcErrorCode: email, password, username, player name, phone, domain, user token format checks.