@@ -24,7 +24,7 @@ public static bool BuildIterative(Project project, ConfigUser configUser, ILogge
2424 {
2525 bool result = DoBuild ( project . IterativeDirectory , project , configUser , log , tracker ) ;
2626 CopyToArchivesToIterativeOriginal ( Path . Combine ( project . IterativeDirectory , "rom" , "data" ) ,
27- Path . Combine ( project . IterativeDirectory , "original" , "archives" ) , log , tracker ) ;
27+ Path . Combine ( project . IterativeDirectory , "original" , "archives" ) , project , log , tracker ) ;
2828 ReplicateProjectSettingsAndBanner ( Path . Combine ( project . IterativeDirectory , "rom" ) ,
2929 Path . Combine ( project . BaseDirectory , "rom" ) , project . Name , log , tracker ) ;
3030 if ( result )
@@ -38,7 +38,7 @@ public static bool BuildBase(Project project, ConfigUser configUser, ILogger log
3838 {
3939 bool result = DoBuild ( project . BaseDirectory , project , configUser , log , tracker ) ;
4040 CopyToArchivesToIterativeOriginal ( Path . Combine ( project . BaseDirectory , "rom" , "data" ) ,
41- Path . Combine ( project . IterativeDirectory , "original" , "archives" ) , log , tracker ) ;
41+ Path . Combine ( project . IterativeDirectory , "original" , "archives" ) , project , log , tracker ) ;
4242 ReplicateProjectSettingsAndBanner ( Path . Combine ( project . BaseDirectory , "rom" ) ,
4343 Path . Combine ( project . IterativeDirectory , "rom" ) , project . Name , log , tracker ) ;
4444 if ( result )
@@ -52,7 +52,7 @@ private static void CleanIterative(Project project, ILogger log, IProgressTracke
5252 {
5353 string [ ] preservedFiles = [ ] ;
5454 string [ ] cleanableFiles = Directory . GetFiles ( Path . Combine ( project . IterativeDirectory , "assets" ) , "*" , SearchOption . AllDirectories ) ;
55- tracker . Focus ( "Cleaning Iterative Directory " , cleanableFiles . Length ) ;
55+ tracker . Focus ( "BuildCleaningIterativeDirectory " , cleanableFiles . Length ) ;
5656 foreach ( string file in cleanableFiles )
5757 {
5858 if ( ! preservedFiles . Contains ( Path . GetFileName ( file ) ) )
@@ -79,22 +79,22 @@ private static bool DoBuild(string directory, Project project, ConfigUser config
7979 commandsIncSb . AppendLine ( command . GetMacro ( ) ) ;
8080 }
8181
82- tracker . Focus ( "Loading Archives (dat.bin)" , 3 ) ;
82+ tracker . Focus ( project . Localize ( "ProjectLoadLoadingDatBin" ) , 3 ) ;
8383 var dat = ArchiveFile < DataFile > . FromFile ( Path . Combine ( directory , "original" , "archives" , "dat.bin" ) , log ) ;
8484 tracker . Finished ++ ;
85- tracker . CurrentlyLoading = "Loading Archives (evt.bin)" ;
85+ tracker . CurrentlyLoading = project . Localize ( "ProjectLoadLoadingEvtBin" ) ;
8686 var evt = ArchiveFile < EventFile > . FromFile ( Path . Combine ( directory , "original" , "archives" , "evt.bin" ) , log ) ;
8787 tracker . Finished ++ ;
88- tracker . CurrentlyLoading = "Loading Archives (grp.bin)" ;
88+ tracker . CurrentlyLoading = project . Localize ( "ProjectLoadLoadingGrpBin" ) ;
8989 var grp = ArchiveFile < GraphicsFile > . FromFile ( Path . Combine ( directory , "original" , "archives" , "grp.bin" ) , log ) ;
9090
9191 if ( dat is null || evt is null || grp is null )
9292 {
93- log . LogError ( "One or more archives is null." ) ;
93+ log . LogError ( project . Localize ( "ErrorArchivesNull" ) ) ;
9494 return false ;
9595 }
9696
97- tracker . Focus ( "Writing Includes" , 4 ) ;
97+ tracker . Focus ( project . Localize ( "BuildWritingIncludesProgressMessage" ) , 4 ) ;
9898 try
9999 {
100100 File . WriteAllText ( Path . Combine ( directory , "COMMANDS.INC" ) , commandsIncSb . ToString ( ) ) ;
@@ -104,14 +104,14 @@ private static bool DoBuild(string directory, Project project, ConfigUser config
104104 }
105105 catch ( IOException exc )
106106 {
107- log . LogException ( "Failed to write include files to disk." , exc ) ;
107+ log . LogException ( project . Localize ( "ErrorFailedWritingIncludeFiles" ) , exc ) ;
108108 return false ;
109109 }
110110 tracker . Finished += 4 ;
111111
112112 // Replace files
113113 string [ ] files = Directory . GetFiles ( Path . Combine ( directory , "assets" ) , "*.*" , SearchOption . AllDirectories ) ;
114- tracker . Focus ( "Replacing Files" , files . Length ) ;
114+ tracker . Focus ( project . Localize ( "BuildReplacingFilesProgressMessage" ) , files . Length ) ;
115115 foreach ( string file in files )
116116 {
117117 if ( int . TryParse ( Path . GetFileNameWithoutExtension ( file ) . Split ( '_' ) [ 0 ] , NumberStyles . HexNumber , new CultureInfo ( "en-US" ) , out int index ) || Path . GetFileName ( file ) . StartsWith ( "new" , StringComparison . OrdinalIgnoreCase ) )
@@ -160,7 +160,7 @@ private static bool DoBuild(string directory, Project project, ConfigUser config
160160 }
161161 else
162162 {
163- log . LogError ( string . Format ( project . Localize ( "Unsure what to do with file '{0}' " ) , Path . GetFileName ( file ) ) ) ;
163+ log . LogError ( string . Format ( project . Localize ( "BuildUnsureWhatToDoWithFileMessage " ) , Path . GetFileName ( file ) ) ) ;
164164 return false ;
165165 }
166166 }
@@ -173,7 +173,7 @@ private static bool DoBuild(string directory, Project project, ConfigUser config
173173 }
174174
175175 // Save files to disk
176- tracker . Focus ( "Writing Replaced Archives " , 3 ) ;
176+ tracker . Focus ( "BuildWritingReplacedArchivesProgressMessage " , 3 ) ;
177177 if ( ! IO . WriteBinaryFile ( Path . Combine ( directory , "rom" , "data" , "dat.bin" ) , dat ? . GetBytes ( ) , log ) )
178178 {
179179 return false ;
@@ -190,36 +190,36 @@ private static bool DoBuild(string directory, Project project, ConfigUser config
190190
191191 // Save project file to disk
192192 string ndsProjectFile = Path . Combine ( directory , "rom" , $ "{ project . Name } .json") ;
193- tracker . Focus ( "Writing NitroPacker Project File" , 1 ) ;
193+ tracker . Focus ( project . Localize ( "BuildWritingNPProjectFile" ) , 1 ) ;
194194 try
195195 {
196196 project . Settings . File . Serialize ( ndsProjectFile ) ;
197197 }
198198 catch ( IOException exc )
199199 {
200- log . LogException ( "Failed to write NitroPacker NDS project file to disk" , exc ) ;
200+ log . LogException ( project . Localize ( "ErrorFailedWritingNPProjectFile" ) , exc ) ;
201201 return false ;
202202 }
203203 tracker . Finished ++ ;
204204
205- tracker . Focus ( "Packing ROM" , 1 ) ;
205+ tracker . Focus ( project . Localize ( "BuildPackingRomProgressMessage" ) , 1 ) ;
206206 try
207207 {
208208 NdsProjectFile . Pack ( Path . Combine ( project . MainDirectory , $ "{ project . Name } .nds") , ndsProjectFile ) ;
209209 }
210210 catch ( Exception exc )
211211 {
212- log . LogException ( "NitroPacker failed to pack ROM with exception" , exc ) ;
212+ log . LogException ( project . Localize ( "BuildNitroPackerFailedPacking" ) , exc ) ;
213213 return false ;
214214 }
215215 tracker . Finished ++ ;
216216
217217 return true ;
218218 }
219219
220- private static void CopyToArchivesToIterativeOriginal ( string newDataDir , string iterativeOriginalDir , ILogger log , IProgressTracker tracker )
220+ private static void CopyToArchivesToIterativeOriginal ( string newDataDir , string iterativeOriginalDir , Project project , ILogger log , IProgressTracker tracker )
221221 {
222- tracker . Focus ( "Copying Archives to Iterative Originals" , 4 ) ;
222+ tracker . Focus ( project . Localize ( "BuildCopyingArchivesMessage" ) , 4 ) ;
223223 try
224224 {
225225 File . Copy ( Path . Combine ( newDataDir , "dat.bin" ) , Path . Combine ( iterativeOriginalDir , "dat.bin" ) , overwrite : true ) ;
@@ -233,7 +233,7 @@ private static void CopyToArchivesToIterativeOriginal(string newDataDir, string
233233 }
234234 catch ( IOException exc )
235235 {
236- log . LogException ( $ "Failed to copy newly built archives to the iterative originals directory" , exc ) ;
236+ log . LogException ( project . Localize ( "ErrorFailedCopyingArchivesToIterativeDir" ) , exc ) ;
237237 }
238238 }
239239
@@ -273,7 +273,7 @@ private static void ReplaceSingleGraphicsFile(ArchiveFile<GraphicsFile> grp, str
273273 }
274274 catch ( Exception ex )
275275 {
276- log . LogException ( string . Format ( localize ( "Failed replacing graphics file {0} with file '{1}' " ) , index , filePath ) , ex ) ;
276+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingGraphicsFile " ) , index , filePath ) , ex ) ;
277277 }
278278 }
279279
@@ -290,7 +290,7 @@ private static void ReplaceSingleScreenGraphicsFile(ArchiveFile<GraphicsFile> gr
290290 }
291291 catch ( Exception ex )
292292 {
293- log . LogException ( string . Format ( localize ( "Failed replacing graphics file {0} with file '{1}' " ) , index , filePath ) , ex ) ;
293+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingGraphicsFile " ) , index , filePath ) , ex ) ;
294294 }
295295 }
296296
@@ -309,7 +309,7 @@ private static void ReplaceSingleLayoutGraphicsFile(ArchiveFile<GraphicsFile> gr
309309 }
310310 catch ( Exception ex )
311311 {
312- log . LogException ( string . Format ( localize ( "Failed replacing graphics file {0} with file '{1}' " ) , index , filePath ) , ex ) ;
312+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingGraphicsFile " ) , index , filePath ) , ex ) ;
313313 }
314314 }
315315
@@ -320,7 +320,7 @@ private static bool ReplaceSingleSourceFile(ArchiveFile<EventFile> archive, stri
320320 ( string objFile , string binFile ) = CompileSourceFile ( filePath , llvm , workingDirectory , localize , log ) ;
321321 if ( ! File . Exists ( binFile ) )
322322 {
323- log . LogError ( string . Format ( localize ( "Compiled file {0} does not exist! " ) , binFile ) ) ;
323+ log . LogError ( string . Format ( localize ( "BuildErrorCompiledFileNotExist " ) , binFile ) ) ;
324324 return false ;
325325 }
326326 ReplaceSingleFile ( archive , binFile , index , localize , log ) ;
@@ -330,7 +330,7 @@ private static bool ReplaceSingleSourceFile(ArchiveFile<EventFile> archive, stri
330330 }
331331 catch ( Exception ex )
332332 {
333- log . LogException ( string . Format ( localize ( "Failed replacing source file {0} in evt.bin with file '{1}' " ) , index , filePath ) , ex ) ;
333+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingEvtSourceFile " ) , index , filePath ) , ex ) ;
334334 return false ;
335335 }
336336 }
@@ -341,7 +341,7 @@ private static bool ReplaceSingleSourceFile(ArchiveFile<DataFile> archive, strin
341341 ( string objFile , string binFile ) = CompileSourceFile ( filePath , llvm , workingDirectory , localize , log ) ;
342342 if ( ! File . Exists ( binFile ) )
343343 {
344- log . LogError ( string . Format ( localize ( "Compiled file {0} does not exist! " ) , binFile ) ) ;
344+ log . LogError ( string . Format ( localize ( "BuildErrorCompiledFileNotExist " ) , binFile ) ) ;
345345 return false ;
346346 }
347347 ReplaceSingleFile ( archive , binFile , index , localize , log ) ;
@@ -351,7 +351,7 @@ private static bool ReplaceSingleSourceFile(ArchiveFile<DataFile> archive, strin
351351 }
352352 catch ( Exception ex )
353353 {
354- log . LogException ( string . Format ( localize ( "Failed replacing source file {0} in dat.bin with file '{1}' " ) , index , filePath ) , ex ) ;
354+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingDatFile " ) , index , filePath ) , ex ) ;
355355 return false ;
356356 }
357357 }
@@ -426,7 +426,7 @@ private static void ReplaceSingleFile(ArchiveFile<EventFile> archive, string fil
426426 }
427427 catch ( Exception ex )
428428 {
429- log . LogException ( string . Format ( localize ( "Failed replacing file {0} in evt.bin with file '{1}' " ) , index , filePath ) , ex ) ;
429+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingEvtFile " ) , index , filePath ) , ex ) ;
430430 }
431431 }
432432 private static void ReplaceSingleFile ( ArchiveFile < DataFile > archive , string filePath , int index , Func < string , string > localize , ILogger log )
@@ -440,7 +440,7 @@ private static void ReplaceSingleFile(ArchiveFile<DataFile> archive, string file
440440 }
441441 catch ( Exception ex )
442442 {
443- log . LogException ( string . Format ( localize ( "Failed replacing source file {0} in dat.bin with file '{1}' " ) , index , filePath ) , ex ) ;
443+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingDatFile " ) , index , filePath ) , ex ) ;
444444 }
445445 }
446446 private static void ReplaceSingleBinaryFile ( ArchiveFile < GraphicsFile > archive , string filePath , int index , Func < string , string > localize , ILogger log )
@@ -459,7 +459,7 @@ private static void ReplaceSingleBinaryFile(ArchiveFile<GraphicsFile> archive, s
459459 }
460460 catch ( Exception ex )
461461 {
462- log . LogException ( string . Format ( localize ( "Failed replacing animation file {0} in grp.bin with file '{1}' " ) , index , filePath ) , ex ) ;
462+ log . LogException ( string . Format ( localize ( "ErrorFailedReplacingAnimationFile " ) , index , filePath ) , ex ) ;
463463 }
464464 }
465465}
0 commit comments