Skip to content

Commit 80932af

Browse files
committed
A bit stricter.
1 parent 6cf9932 commit 80932af

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public static void Main (string [] args)
1111
if (!type.HasCustomAttributes)
1212
continue;
1313
var hasProtocolAttribute = false;
14+
var hasModelAttribute = false;
1415
CustomAttribute registerAttribute = null;
1516
foreach (var ca in type.CustomAttributes) {
1617
if (ca.AttributeType.Namespace != "Foundation")
@@ -20,15 +21,22 @@ public static void Main (string [] args)
2021
case "ProtocolAttribute":
2122
hasProtocolAttribute = true;
2223
break;
24+
case "ModelAttribute":
25+
hasModelAttribute = true;
26+
break;
2327
case "RegisterAttribute":
2428
registerAttribute = ca;
2529
break;
2630
}
2731
}
28-
if (!hasProtocolAttribute)
32+
if (!hasProtocolAttribute || !hasModelAttribute)
2933
continue;
3034
if (registerAttribute == null)
3135
continue;
36+
if ((bool) registerAttribute.ConstructorArguments [1].Value == false) {
37+
Console.WriteLine ("No need to fix {0}", type.FullName);
38+
continue;
39+
}
3240
Console.WriteLine ("Fixing {0}", type.FullName);
3341
registerAttribute.ConstructorArguments [1] = new CustomAttributeArgument (registerAttribute.ConstructorArguments [1].Type, false);
3442
}

0 commit comments

Comments
 (0)