Static helper that validates a Steam ID string. It ensures the input is non-empty, does not start with '0', contains only decimal digits, and parses as an unsigned long. Returns the original value or throws ArgumentException.
namespace SboxSuperuser.Core.Identity;
internal static class SteamIdentity
{
internal static string Validate( string value, string parameter )
{
if ( string.IsNullOrEmpty( value ) || value[ 0 ] == '0'
|| value.Any( character => character is < '0' or > '9' )
|| !ulong.TryParse( value, out _ ) )
{
throw new ArgumentException( "Use a nonzero canonical decimal Steam ID.", parameter );
}
return value;
}
}