@@ -21,61 +21,23 @@ public ChangelogVersionEntry GetLastVersion() {
21
21
public string GetChangelogString ( ) {
22
22
StringBuilder sb = new StringBuilder ( ) ;
23
23
24
- ChangelogEntryType lastType ;
25
- ChangelogEntryScope lastScope ;
26
-
27
24
sb . Append ( "Note: 📢 indicates a change inspired by community feedback!\n " ) ;
28
- sb . Append ( "---------- \n " ) ;
29
25
30
26
for ( int i = versions . Count - 1 ; i >= 0 ; -- i ) {
31
- lastType = ( ChangelogEntryType ) 255 ;
32
- lastScope = ( ChangelogEntryScope ) 255 ;
33
- ChangelogVersionEntry version = versions [ i ] ;
34
-
35
- if ( i != versions . Count - 1 ) {
36
- sb . Append ( "---------- \n " ) ;
37
-
38
- }
39
- sb . Append ( "# " ) ;
40
- sb . Append ( version . GetVersionHeader ( ) ) ;
41
- sb . Append ( "\n " ) ;
42
-
43
- sb . Append ( version . descriptionText ) ;
44
- sb . Append ( "\n \n " ) ;
45
-
46
- for ( int j = 0 ; j < version . notes . Count ; ++ j ) {
47
- ChangelogNoteEntry note = version . notes [ j ] ;
48
-
49
- if ( lastType != note . type ) {
50
- if ( lastType != ( ChangelogEntryType ) 255 )
51
- sb . Append ( "\n " ) ;
52
- lastType = note . type ;
53
- lastScope = ( ChangelogEntryScope ) 255 ;
54
- sb . Append ( "## " ) ;
55
- sb . Append ( note . type ) ;
56
- sb . Append ( ": \n " ) ;
57
- }
58
-
59
- if ( lastScope != note . scope ) {
60
- lastScope = note . scope ;
61
- sb . Append ( "### " ) ;
62
- sb . Append ( note . scope ) ;
63
- sb . Append ( ": \n " ) ;
64
- }
65
-
66
- sb . Append ( " * " ) ;
67
- if ( note . isCommunityFeedback )
68
- sb . Append ( "📢 " ) ;
69
- sb . Append ( note . text ) ;
70
- sb . Append ( "\n " ) ;
71
- }
72
-
73
- sb . Append ( "\n " ) ;
27
+ versions [ i ] . GetChangelog ( ref sb ) ;
74
28
}
75
29
76
30
return sb . ToString ( ) ;
77
31
}
78
32
33
+ public string GetLastChangelogString ( ) {
34
+ StringBuilder sb = new StringBuilder ( ) ;
35
+ sb . Append ( "Note: 📢 indicates a change inspired by community feedback!\n " ) ;
36
+ versions [ versions . Count - 1 ] . GetChangelog ( ref sb ) ;
37
+ return sb . ToString ( ) ;
38
+ }
39
+
40
+
79
41
#region Serialization
80
42
const string SAVE_FILE_NOREZ = "ChangelogSettings" ;
81
43
const string SAVE_FILE = "ChangelogSettings.json" ;
@@ -150,6 +112,40 @@ public string GetVersionHeader() {
150
112
151
113
return header ;
152
114
}
115
+
116
+ public void GetChangelog ( ref StringBuilder sb ) {
117
+ ChangelogEntryType lastType = ( ChangelogEntryType ) 255 ;
118
+ ChangelogEntryScope lastScope = ( ChangelogEntryScope ) 255 ;
119
+
120
+ sb . Append ( "\n \n ---------- \n " ) ;
121
+ sb . Append ( "# " ) ;
122
+ sb . Append ( GetVersionHeader ( ) ) ;
123
+ sb . Append ( "\n " ) ;
124
+
125
+ sb . Append ( descriptionText ) ;
126
+ sb . Append ( "\n " ) ;
127
+
128
+ for ( int j = 0 ; j < notes . Count ; ++ j ) {
129
+ if ( lastType != notes [ j ] . type ) {
130
+ if ( lastType != ( ChangelogEntryType ) 255 )
131
+ sb . Append ( "\n " ) ;
132
+ lastType = notes [ j ] . type ;
133
+ lastScope = ( ChangelogEntryScope ) 255 ;
134
+ sb . Append ( "### " ) ;
135
+ sb . Append ( notes [ j ] . type ) ;
136
+ sb . Append ( ": \n " ) ;
137
+ }
138
+
139
+ if ( lastScope != notes [ j ] . scope ) {
140
+ lastScope = notes [ j ] . scope ;
141
+ sb . Append ( "#### " ) ;
142
+ sb . Append ( notes [ j ] . scope ) ;
143
+ sb . Append ( ": \n " ) ;
144
+ }
145
+
146
+ notes [ j ] . GetChangelog ( ref sb ) ;
147
+ }
148
+ }
153
149
}
154
150
155
151
[ Serializable ]
@@ -158,6 +154,14 @@ public class ChangelogNoteEntry {
158
154
public ChangelogEntryType type ;
159
155
public ChangelogEntryScope scope ;
160
156
public string text ;
157
+
158
+ public void GetChangelog ( ref StringBuilder sb ) {
159
+ sb . Append ( " * " ) ;
160
+ if ( isCommunityFeedback )
161
+ sb . Append ( "📢 " ) ;
162
+ sb . Append ( text ) ;
163
+ sb . Append ( "\n " ) ;
164
+ }
161
165
}
162
166
163
167
public enum ChangelogEntryType : byte {
0 commit comments