@@ -49,15 +49,17 @@ private async void Compile_SPScripts(bool compileAll = true)
4949 NonUploadedFiles . Clear ( ) ;
5050
5151 // Grabs current config
52- var c = Program . Configs [ Program . SelectedConfig ] ;
52+ var currentConfig = Program . Configs [ Program . SelectedConfig ] ;
5353
5454 // Creates flags
5555 FileInfo spCompInfo = null ;
5656 var SpCompFound = false ;
5757 var PressedEscape = false ;
58+ var hadError = false ;
59+ var warnings = 0 ;
5860
5961 // Searches for the spcomp.exe compiler
60- foreach ( var dir in c . SMDirectories )
62+ foreach ( var dir in currentConfig . SMDirectories )
6163 {
6264 spCompInfo = new FileInfo ( Path . Combine ( dir , "spcomp.exe" ) ) ;
6365 if ( spCompInfo . Exists )
@@ -169,7 +171,7 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("Error"),
169171 }
170172
171173 var includeDirectories = new StringBuilder ( ) ;
172- foreach ( var dir in c . SMDirectories )
174+ foreach ( var dir in currentConfig . SMDirectories )
173175 {
174176 includeDirectories . Append ( " -i=\" " + dir + "\" " ) ;
175177 }
@@ -178,9 +180,9 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("Error"),
178180
179181 process . StartInfo . Arguments =
180182 "\" " + fileInfo . FullName + "\" -o=\" " + outFile + "\" -e=\" " + errorFile + "\" " +
181- includeStr + " -O=" + c . OptimizeLevel + " -v=" + c . VerboseLevel ;
183+ includeStr + " -O=" + currentConfig . OptimizeLevel + " -v=" + currentConfig . VerboseLevel ;
182184 progressTask . SetProgress ( ( i + 1 - 0.5d ) / compileCount ) ;
183- var execResult = ExecuteCommandLine ( c . PreCmd , fileInfo . DirectoryName , c . CopyDirectory ,
185+ var execResult = ExecuteCommandLine ( currentConfig . PreCmd , fileInfo . DirectoryName , currentConfig . CopyDirectory ,
184186 fileInfo . FullName , fileInfo . Name , outFile , destinationFileName ) ;
185187 if ( ! string . IsNullOrWhiteSpace ( execResult ) )
186188 {
@@ -205,6 +207,8 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("SPCompNotStarted")
205207
206208 if ( File . Exists ( errorFile ) )
207209 {
210+ warnings = 0 ;
211+ hadError = false ;
208212 var errorStr = File . ReadAllText ( errorFile ) ;
209213 stringOutput . AppendLine ( errorStr . Trim ( '\n ' , '\r ' ) ) ;
210214 var mc = errorFilterRegex . Matches ( errorStr ) ;
@@ -217,14 +221,25 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("SPCompNotStarted")
217221 Type = mc [ j ] . Groups [ "Type" ] . Value . Trim ( ) ,
218222 Details = mc [ j ] . Groups [ "Details" ] . Value . Trim ( )
219223 } ) ;
224+ if ( mc [ j ] . Groups [ "Type" ] . Value . Contains ( "error" ) )
225+ {
226+ hadError = true ;
227+ }
228+ if ( mc [ j ] . Groups [ "Type" ] . Value . Contains ( "warning" ) )
229+ {
230+ warnings ++ ;
231+ }
220232 }
233+ File . Delete ( errorFile ) ;
234+ }
221235
236+ if ( hadError )
237+ {
222238 LoggingControl . LogAction ( fileInfo . Name + " (error)" ) ;
223- File . Delete ( errorFile ) ;
224239 }
225240 else
226241 {
227- LoggingControl . LogAction ( fileInfo . Name ) ;
242+ LoggingControl . LogAction ( $ " { fileInfo . Name } { ( warnings > 0 ? $ " ( { warnings } warnings)" : "" ) } " ) ;
228243 compiledSuccess ++ ;
229244 }
230245
@@ -235,8 +250,8 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("SPCompNotStarted")
235250 CompiledFileNames . Add ( destinationFileName ) ;
236251 }
237252
238- var execResult_Post = ExecuteCommandLine ( c . PostCmd , fileInfo . DirectoryName ,
239- c . CopyDirectory , fileInfo . FullName , fileInfo . Name , outFile , destinationFileName ) ;
253+ var execResult_Post = ExecuteCommandLine ( currentConfig . PostCmd , fileInfo . DirectoryName ,
254+ currentConfig . CopyDirectory , fileInfo . FullName , fileInfo . Name , outFile , destinationFileName ) ;
240255 if ( ! string . IsNullOrWhiteSpace ( execResult_Post ) )
241256 {
242257
@@ -249,29 +264,29 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("SPCompNotStarted")
249264
250265 if ( compiledSuccess > 0 )
251266 {
252- LoggingControl . LogAction ( $ "Compiled { compiledSuccess } { ( compileAll ? "plugins" : "plugin" ) } .", 2 ) ;
267+ LoggingControl . LogAction ( $ "Compiled { compiledSuccess } { ( compiledSuccess > 1 ? "plugins" : "plugin" ) } .", 2 ) ;
253268 }
254269
255270 if ( ! PressedEscape )
256271 {
257272 progressTask . SetProgress ( 1.0 ) ;
258- if ( c . AutoCopy )
273+ if ( currentConfig . AutoCopy )
259274 {
260275 progressTask . SetTitle ( Program . Translations . GetLanguage ( "CopyingFiles" ) ) ;
261276 progressTask . SetIndeterminate ( ) ;
262277 await Task . Run ( ( ) => Copy_Plugins ( ) ) ;
263278 progressTask . SetProgress ( 1.0 ) ;
264279 }
265280
266- if ( c . AutoUpload )
281+ if ( currentConfig . AutoUpload )
267282 {
268283 progressTask . SetTitle ( Program . Translations . GetLanguage ( "FTPUploading" ) ) ;
269284 progressTask . SetIndeterminate ( ) ;
270285 await Task . Run ( FTPUpload_Plugins ) ;
271286 progressTask . SetProgress ( 1.0 ) ;
272287 }
273288
274- if ( c . AutoRCON )
289+ if ( currentConfig . AutoRCON )
275290 {
276291 progressTask . SetTitle ( Program . Translations . GetLanguage ( "RCONCommand" ) ) ;
277292 progressTask . SetIndeterminate ( ) ;
0 commit comments