first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Nitrox.Launcher.Models.Validators;
/// <summary>
/// Tests that the value doesn't end with the specified text.
/// </summary>
public sealed class NotEndsWithAttribute(string text, StringComparison comparison = StringComparison.OrdinalIgnoreCase) : TypedValidationAttribute<string>
{
protected override ValidationResult IsValid(string value, ValidationContext context)
{
if (value == null)
{
return ValidationResult.Success;
}
return value.EndsWith(text, comparison) ? new ValidationResult($"{context.DisplayName} must not contain the text '{text}' at the end.") : ValidationResult.Success;
}
}