mirror of
https://github.com/maxartz15/Validator.git
synced 2024-11-24 21:05:47 +01:00
Compare commits
2 Commits
b13cf47fbf
...
8399d043f5
Author | SHA1 | Date | |
---|---|---|---|
8399d043f5 | |||
b4dd8744df |
@ -1,4 +1,10 @@
|
||||
# Change Log:
|
||||
## 0.1.4
|
||||
- Fix attribute validator..?
|
||||
## 0.1.3
|
||||
- Fix attribute validator..?
|
||||
## 0.1.2
|
||||
- ...
|
||||
## 0.1.1
|
||||
- First prototype of Attribute validator.
|
||||
## 0.1.1
|
||||
|
@ -10,6 +10,8 @@ namespace Validator.Editor
|
||||
{
|
||||
public string MenuName => "Attributes/RequiredAttributeAssetValidator";
|
||||
|
||||
private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
|
||||
public Report Validate()
|
||||
{
|
||||
Report report = new Report(nameof(RequiredAttributeAssetValidator));
|
||||
@ -19,7 +21,8 @@ namespace Validator.Editor
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar("RequiredAttributeAssetValidator", "RequiredAttribute...", (float)i / objects.Count);
|
||||
IEnumerable<(FieldInfo FieldInfo, RequiredAttribute Attribute)> fieldsWithRequiredAttribute = from fi in objects[i].GetType().GetFields()
|
||||
|
||||
IEnumerable<(FieldInfo FieldInfo, RequiredAttribute Attribute)> fieldsWithRequiredAttribute = from fi in objects[i].GetType().GetFields(flags)
|
||||
let attr = fi.GetCustomAttributes(typeof(RequiredAttribute), true)
|
||||
where attr.Length == 1
|
||||
select (FieldInfo: fi, Attribute: attr.First() as RequiredAttribute);
|
||||
@ -43,6 +46,8 @@ namespace Validator.Editor
|
||||
{
|
||||
public string MenuName => "Attributes/RequiredAttributeSceneValidator";
|
||||
|
||||
private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
|
||||
public Report Validate()
|
||||
{
|
||||
Report report = new Report(nameof(RequiredAttributeSceneValidator));
|
||||
@ -52,7 +57,7 @@ namespace Validator.Editor
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar("RequiredAttributeSceneValidator", "RequiredAttribute...", (float)i / objects.Count);
|
||||
IEnumerable<(FieldInfo FieldInfo, RequiredAttribute Attribute)> fieldsWithRequiredAttribute = from fi in objects[i].GetType().GetFields()
|
||||
IEnumerable<(FieldInfo FieldInfo, RequiredAttribute Attribute)> fieldsWithRequiredAttribute = from fi in objects[i].GetType().GetFields(flags)
|
||||
let attr = fi.GetCustomAttributes(typeof(RequiredAttribute), true)
|
||||
where attr.Length == 1
|
||||
select (FieldInfo: fi, Attribute: attr.First() as RequiredAttribute);
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.vertexcolor.validator",
|
||||
"displayName": "Validator",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.4",
|
||||
"unity": "2019.3",
|
||||
"description": "Unity project validator framework.",
|
||||
"category": "Tool",
|
||||
|
Loading…
Reference in New Issue
Block a user