Added initial version 0.1.0

This commit is contained in:
Anders Ejlersen 2026-05-17 22:12:04 +02:00
parent 6aa4cb8596
commit 416759c213
64 changed files with 2181 additions and 0 deletions

8
Runtime/Attributes.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b550bfeed6d6bb840972d41daa80bbd3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,29 @@
using System;
namespace Module.ProjectValidator
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class RequiredAttribute : Attribute
{
private readonly EValidatorSeverity _severity;
public RequiredAttribute()
{
_severity = EValidatorSeverity.Error;
}
public RequiredAttribute(EValidatorSeverity severity)
{
_severity = severity;
}
public sealed class Validator : IAttributeValidator<RequiredAttribute>
{
public ValidatorResult Validate(RequiredAttribute attribute, object value)
{
var isValid = value is UnityEngine.Object obj ? obj != null : value != null;
return isValid ? ValidatorResult.Valid : ValidatorResult.Create(attribute._severity, "Value is Null");
}
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 752bd3df42129e14cadaf285192455f4

3
Runtime/Enums.meta Normal file
View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 685f49487d6444309a65fbcd4ac1d9ea
timeCreated: 1778923761

View file

@ -0,0 +1,11 @@
namespace Module.ProjectValidator
{
public enum EValidatorSeverity
{
Valid,
Warning,
Error,
MaxSeverityLevel = Error
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cd13ba3b13bf430d991895f3f53092b5
timeCreated: 1778923771

3
Runtime/Interfaces.meta Normal file
View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: efe01ae1b17d4d859c2a5b16037b83ba
timeCreated: 1778923730

View file

@ -0,0 +1,9 @@
using System;
namespace Module.ProjectValidator
{
public interface IAttributeValidator<in T> where T : Attribute
{
ValidatorResult Validate(T attribute, object value);
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 745c26fe699143d795d498fe0621a619
timeCreated: 1778923739

View file

@ -0,0 +1,14 @@
{
"name": "Module.ProjectValidator",
"rootNamespace": "Module.ProjectValidator",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4e594c19fac9b29429cbe6a99f0aa22a
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
namespace Module.ProjectValidator
{
public struct ValidatorResult
{
public EValidatorSeverity Severity;
public string Message;
public static ValidatorResult Valid => new();
public static ValidatorResult Create(EValidatorSeverity severity, string message) => new() { Severity = severity, Message = message };
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 60b975f740d64cb0ad90ded13fc75c4d
timeCreated: 1778925534