@@ -89,20 +89,22 @@ public VersionVariables(string major,
89
89
public string CommitsSinceVersionSource { get ; private set ; }
90
90
public string CommitsSinceVersionSourcePadded { get ; private set ; }
91
91
92
+ [ ReflectionIgnore ]
92
93
public static IEnumerable < string > AvailableVariables
93
94
{
94
95
get
95
96
{
96
97
return typeof ( VersionVariables )
97
- . GetProperties ( BindingFlags . Public | BindingFlags . DeclaredOnly | BindingFlags . Instance )
98
+ . GetProperties ( )
99
+ . Where ( p => ! p . GetCustomAttributes ( typeof ( ReflectionIgnoreAttribute ) , false ) . Any ( ) )
98
100
. Select ( p => p . Name )
99
- . Where ( p => p != "AvailableVariables" && p != "Item" )
100
101
. OrderBy ( a => a ) ;
101
102
}
102
103
}
103
104
104
105
public string CommitDate { get ; set ; }
105
106
107
+ [ ReflectionIgnore ]
106
108
public string this [ string variable ]
107
109
{
108
110
get { return ( string ) typeof ( VersionVariables ) . GetProperty ( variable ) . GetValue ( this , null ) ; }
@@ -114,7 +116,7 @@ public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
114
116
var type = typeof ( string ) ;
115
117
return typeof ( VersionVariables )
116
118
. GetProperties ( )
117
- . Where ( p => p . PropertyType == type && ! p . GetIndexParameters ( ) . Any ( ) )
119
+ . Where ( p => p . PropertyType == type && ! p . GetIndexParameters ( ) . Any ( ) && ! p . GetCustomAttributes ( typeof ( ReflectionIgnoreAttribute ) , false ) . Any ( ) )
118
120
. Select ( p => new KeyValuePair < string , string > ( p . Name , ( string ) p . GetValue ( this , null ) ) )
119
121
. GetEnumerator ( ) ;
120
122
}
@@ -155,5 +157,10 @@ public bool ContainsKey(string variable)
155
157
{
156
158
return typeof ( VersionVariables ) . GetProperty ( variable ) != null ;
157
159
}
160
+
161
+
162
+ sealed class ReflectionIgnoreAttribute : Attribute
163
+ {
164
+ }
158
165
}
159
166
}
0 commit comments