@@ -169,8 +169,8 @@ public void Compile(string[] fileList, bool decompile = false)
169
169
170
170
Exe . Run ( Path . GetFullPath ( settings . CompilerPath ) , args , redirectStdOut : true ) ;
171
171
}
172
- DeleteHeaderFiles ( fileList ) ;
173
172
ProcessUassetOutput ( fileList , decompile ) ;
173
+ DeleteHeaderFiles ( fileList ) ;
174
174
} ) . Start ( ) ;
175
175
}
176
176
@@ -183,43 +183,69 @@ private void ProcessUassetOutput(string[] fileList, bool decompile)
183
183
{
184
184
if ( decompile && chk_Overwrite . Checked && Path . GetExtension ( file ) . ToUpper ( ) == ".UASSET" )
185
185
{
186
+ string bfFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + "_unwrapped.bf" ) ;
187
+ string bmdFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + "_unwrapped.bmd" ) ;
188
+ string flowFile = bfFile + ".flow" ;
189
+ string msgFile = bmdFile + ".msg" ;
190
+ string newFlowDest = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + ".flow" ) ;
191
+ string newMsgDest = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + ".msg" ) ;
192
+ string hFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + "_unwrapped.bmd.msg.h" ) ;
193
+ string newHFileDest = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + ".msg.h" ) ;
194
+
195
+ if ( ! File . Exists ( flowFile ) && ! File . Exists ( msgFile ) )
196
+ return ;
186
197
187
- string bfFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + "_unwrapped.bf" ) ;
188
- string flowFile = bfFile + ".flow" ;
189
- string newFlowDest = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + ".flow" ) ;
190
-
191
- if ( File . Exists ( bfFile ) )
192
- File . Delete ( bfFile ) ;
193
-
194
- if ( File . Exists ( newFlowDest ) )
195
- File . Delete ( newFlowDest ) ;
196
-
197
- if ( File . Exists ( flowFile ) )
198
- File . Move ( flowFile , newFlowDest ) ;
198
+ if ( File . Exists ( bfFile ) )
199
+ File . Delete ( bfFile ) ;
200
+ if ( File . Exists ( bmdFile ) )
201
+ File . Delete ( bmdFile ) ;
202
+
203
+ if ( File . Exists ( newFlowDest ) )
204
+ File . Delete ( newFlowDest ) ;
205
+ if ( File . Exists ( newMsgDest ) )
206
+ File . Delete ( newMsgDest ) ;
207
+ if ( File . Exists ( newHFileDest ) )
208
+ File . Delete ( newHFileDest ) ;
209
+
210
+ if ( File . Exists ( flowFile ) )
211
+ File . Move ( flowFile , newFlowDest ) ;
212
+ if ( File . Exists ( msgFile ) )
213
+ File . Move ( msgFile , newMsgDest ) ;
214
+ if ( File . Exists ( hFile ) )
215
+ File . Move ( hFile , newHFileDest ) ;
199
216
}
200
217
else if ( chk_Overwrite . Checked )
201
218
{
202
- string bfFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + ".bf" ) ;
203
- string uassetFile = bfFile + ".uasset" ;
219
+ string extension = ".bf" ;
220
+ if ( Path . GetFileName ( file ) . ToLower ( ) . Contains ( "bmd" ) )
221
+ extension = ".bmd" ;
222
+
223
+ string scriptFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + extension ) ;
224
+ string uassetFile = scriptFile + ".uasset" ;
204
225
string newUassetDest = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + ".uasset" ) ;
205
226
206
- if ( File . Exists ( bfFile ) )
207
- File . Delete ( bfFile ) ;
227
+ if ( ! File . Exists ( uassetFile ) )
228
+ return ;
229
+
230
+ if ( File . Exists ( scriptFile ) )
231
+ File . Delete ( scriptFile ) ;
208
232
209
233
if ( File . Exists ( newUassetDest ) )
210
234
File . Delete ( newUassetDest ) ;
211
235
212
- if ( File . Exists ( uassetFile ) )
213
- File . Move ( uassetFile , newUassetDest ) ;
236
+ File . Move ( uassetFile , newUassetDest ) ;
214
237
}
215
238
}
216
239
}
217
240
218
241
private void DeleteHeaderFiles ( string [ ] fileList )
219
242
{
243
+ if ( ! chk_DeleteHeader . Checked )
244
+ return ;
245
+
220
246
foreach ( var file in fileList )
221
247
{
222
- if ( chk_DeleteHeader . Checked && Path . GetExtension ( file ) . ToUpper ( ) == ".BMD" )
248
+ if ( Path . GetExtension ( file ) . ToUpper ( ) == ".BMD" )
223
249
{
224
250
string headerFile = file + ".msg.h" ;
225
251
if ( chk_Overwrite . Checked )
@@ -228,6 +254,15 @@ private void DeleteHeaderFiles(string[] fileList)
228
254
if ( File . Exists ( headerFile ) )
229
255
File . Delete ( headerFile ) ;
230
256
}
257
+ else if ( Path . GetExtension ( file ) . ToUpper ( ) == ".UASSET" && Path . GetFileName ( file ) . ToLower ( ) . Contains ( "bmd" ) )
258
+ {
259
+ string headerFile = Path . Combine ( Path . GetDirectoryName ( file ) , Path . GetFileNameWithoutExtension ( file ) + "_unwrapped.bmd.msg.h" ) ;
260
+ if ( chk_Overwrite . Checked )
261
+ headerFile = FileSys . GetExtensionlessPath ( file ) + ".msg.h" ;
262
+
263
+ if ( File . Exists ( headerFile ) )
264
+ File . Delete ( headerFile ) ;
265
+ }
231
266
}
232
267
}
233
268
0 commit comments