@@ -267,7 +267,7 @@ public async Task<bool> ToggleModStatus(string internalFilePath, bool enable)
267
267
268
268
var modEntry = modList . Mods . FirstOrDefault ( x => x . fullPath == internalFilePath ) ;
269
269
270
- var result = await ToggleModUnsafe ( enable , modEntry ) ;
270
+ var result = await ToggleModUnsafe ( enable , modEntry , false , true ) ;
271
271
if ( ! result )
272
272
{
273
273
return result ;
@@ -319,7 +319,7 @@ public async Task ToggleModPackStatus(string modPackName, bool enable)
319
319
320
320
foreach ( var modEntry in mods )
321
321
{
322
- await ToggleModUnsafe ( enable , modEntry ) ;
322
+ await ToggleModUnsafe ( enable , modEntry , false , true ) ;
323
323
}
324
324
325
325
SaveModList ( modList ) ;
@@ -338,7 +338,7 @@ public async Task ToggleModPackStatus(string modPackName, bool enable)
338
338
/// <param name="enable"></param>
339
339
/// <param name="mod"></param>
340
340
/// <returns></returns>
341
- public async Task < bool > ToggleModUnsafe ( bool enable , Mod mod , bool includeInternal = false )
341
+ public async Task < bool > ToggleModUnsafe ( bool enable , Mod mod , bool includeInternal = false , bool updateCache = false )
342
342
{
343
343
if ( mod == null ) return false ;
344
344
if ( string . IsNullOrEmpty ( mod . name ) ) return false ;
@@ -368,7 +368,7 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
368
368
// Added file.
369
369
if ( enable && ! mod . enabled )
370
370
{
371
- await index . AddFileDescriptor ( mod . fullPath , mod . data . modOffset , IOUtil . GetDataFileFromPath ( mod . fullPath ) , false ) ;
371
+ await index . AddFileDescriptor ( mod . fullPath , mod . data . modOffset , IOUtil . GetDataFileFromPath ( mod . fullPath ) , updateCache ) ;
372
372
mod . enabled = true ;
373
373
374
374
// Check if we're re-enabling a metadata mod.
@@ -387,7 +387,7 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
387
387
{
388
388
389
389
// Delete file descriptor handles removing metadata as needed on its own.
390
- await index . DeleteFileDescriptor ( mod . fullPath , IOUtil . GetDataFileFromPath ( mod . fullPath ) , false ) ;
390
+ await index . DeleteFileDescriptor ( mod . fullPath , IOUtil . GetDataFileFromPath ( mod . fullPath ) , updateCache ) ;
391
391
mod . enabled = false ;
392
392
}
393
393
@@ -397,12 +397,12 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
397
397
// Standard mod.
398
398
if ( enable && ! mod . enabled )
399
399
{
400
- await index . UpdateDataOffset ( mod . data . modOffset , mod . fullPath , false ) ;
400
+ await index . UpdateDataOffset ( mod . data . modOffset , mod . fullPath , updateCache ) ;
401
401
mod . enabled = true ;
402
402
}
403
403
else if ( ! enable && mod . enabled )
404
404
{
405
- await index . UpdateDataOffset ( mod . data . originalOffset , mod . fullPath , false ) ;
405
+ await index . UpdateDataOffset ( mod . data . originalOffset , mod . fullPath , updateCache ) ;
406
406
mod . enabled = false ;
407
407
}
408
408
}
@@ -432,7 +432,7 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
432
432
// Save disabling these for last.
433
433
if ( modEntry . IsInternal ( ) ) continue ;
434
434
435
- await ToggleModUnsafe ( enable , modEntry ) ;
435
+ await ToggleModUnsafe ( enable , modEntry , false , false ) ;
436
436
progress ? . Report ( ( ++ modNum , modList . Mods . Count , string . Empty ) ) ;
437
437
}
438
438
@@ -442,7 +442,7 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
442
442
var internalEntries = modList . Mods . Where ( x => x . IsInternal ( ) ) ;
443
443
foreach ( var modEntry in internalEntries )
444
444
{
445
- await ToggleModUnsafe ( enable , modEntry , true ) ;
445
+ await ToggleModUnsafe ( enable , modEntry , true , false ) ;
446
446
}
447
447
}
448
448
0 commit comments