6
6
7
7
public class VersionVariables : IEnumerable < KeyValuePair < string , string > >
8
8
{
9
- public VersionVariables ( string major , string minor , string patch , string buildMetaData , string buildMetaDataPadded , string fullBuildMetaData , string branchName , string sha , string majorMinorPatch , string semVer , string legacySemVer , string legacySemVerPadded , string fullSemVer , string assemblySemVer , string preReleaseTag , string preReleaseTagWithDash , string informationalVersion ,
10
- string commitDate , string nugetVersion , string nugetVersionV2 , string commitsSinceVersionSource , string commitsSinceVersionSourcePadded )
9
+ public VersionVariables ( string major ,
10
+ string minor ,
11
+ string patch ,
12
+ string buildMetaData ,
13
+ string buildMetaDataPadded ,
14
+ string fullBuildMetaData ,
15
+ string branchName ,
16
+ string sha ,
17
+ string majorMinorPatch ,
18
+ string semVer ,
19
+ string legacySemVer ,
20
+ string legacySemVerPadded ,
21
+ string fullSemVer ,
22
+ string assemblySemVer ,
23
+ string preReleaseTag ,
24
+ string preReleaseTagWithDash ,
25
+ string informationalVersion ,
26
+ string commitDate ,
27
+ string nugetVersion ,
28
+ string nugetVersionV2 ,
29
+ string commitsSinceVersionSource ,
30
+ string commitsSinceVersionSourcePadded )
11
31
{
12
32
Major = major ;
13
33
Minor = minor ;
@@ -33,6 +53,7 @@ public VersionVariables(string major, string minor, string patch, string buildMe
33
53
CommitsSinceVersionSourcePadded = commitsSinceVersionSourcePadded ;
34
54
}
35
55
56
+
36
57
public string Major { get ; private set ; }
37
58
public string Minor { get ; private set ; }
38
59
public string Patch { get ; private set ; }
@@ -57,30 +78,39 @@ public VersionVariables(string major, string minor, string patch, string buildMe
57
78
58
79
public static IEnumerable < string > AvailableVariables
59
80
{
60
- get { return typeof ( VersionVariables ) . GetProperties ( ) . Select ( p => p . Name ) . OrderBy ( a => a ) ; }
81
+ get
82
+ {
83
+ return typeof ( VersionVariables )
84
+ . GetProperties ( )
85
+ . Select ( p => p . Name )
86
+ . OrderBy ( a => a ) ;
87
+ }
61
88
}
62
89
63
90
public string CommitDate { get ; set ; }
64
91
92
+ public string this [ string variable ]
93
+ {
94
+ get { return ( string ) typeof ( VersionVariables ) . GetProperty ( variable ) . GetValue ( this , null ) ; }
95
+ }
96
+
97
+
65
98
public IEnumerator < KeyValuePair < string , string > > GetEnumerator ( )
66
99
{
67
100
var type = typeof ( string ) ;
68
101
return typeof ( VersionVariables )
69
102
. GetProperties ( )
70
103
. Where ( p => p . PropertyType == type && ! p . GetIndexParameters ( ) . Any ( ) )
71
- . Select ( p => new KeyValuePair < string , string > ( p . Name , ( string ) p . GetValue ( this , null ) ) )
104
+ . Select ( p => new KeyValuePair < string , string > ( p . Name , ( string ) p . GetValue ( this , null ) ) )
72
105
. GetEnumerator ( ) ;
73
106
}
74
107
108
+
75
109
IEnumerator IEnumerable . GetEnumerator ( )
76
110
{
77
111
return GetEnumerator ( ) ;
78
112
}
79
113
80
- public string this [ string variable ]
81
- {
82
- get { return ( string ) typeof ( VersionVariables ) . GetProperty ( variable ) . GetValue ( this , null ) ; }
83
- }
84
114
85
115
public bool TryGetValue ( string variable , out string variableValue )
86
116
{
@@ -94,6 +124,7 @@ public bool TryGetValue(string variable, out string variableValue)
94
124
return false ;
95
125
}
96
126
127
+
97
128
public bool ContainsKey ( string variable )
98
129
{
99
130
return typeof ( VersionVariables ) . GetProperty ( variable ) != null ;
0 commit comments