@@ -47,6 +47,7 @@ public class ALoadoutSynchronizer : ILoadoutSynchronizer
47
47
private readonly IOSInformation _os ;
48
48
private readonly ISorter _sorter ;
49
49
private readonly IGarbageCollectorRunner _garbageCollectorRunner ;
50
+ private readonly ISynchronizerService _synchronizerService ;
50
51
private readonly IServiceProvider _serviceProvider ;
51
52
52
53
/// <summary>
@@ -71,7 +72,9 @@ protected ALoadoutSynchronizer(
71
72
IGarbageCollectorRunner garbageCollectorRunner )
72
73
{
73
74
_serviceProvider = serviceProvider ;
75
+ _synchronizerService = serviceProvider . GetRequiredService < ISynchronizerService > ( ) ;
74
76
_jobMonitor = serviceProvider . GetRequiredService < IJobMonitor > ( ) ;
77
+
75
78
_fileHashService = fileHashService ;
76
79
77
80
Logger = logger ;
@@ -353,7 +356,7 @@ private static bool FileIsEnabled(LoadoutItem.ReadOnly arg)
353
356
/// <inheritdoc />
354
357
public async Task < Dictionary < GamePath , SyncNode > > BuildSyncTree ( Loadout . ReadOnly loadout )
355
358
{
356
- var metadata = await ReindexState ( loadout . InstallationInstance , false , Connection ) ;
359
+ var metadata = await ReindexState ( loadout . InstallationInstance , ignoreModifiedDates : false , Connection ) ;
357
360
var previouslyApplied = loadout . Installation . GetLastAppliedDiskState ( ) ;
358
361
return BuildSyncTree ( DiskStateToPathPartPair ( metadata . DiskStateEntries ) , DiskStateToPathPartPair ( previouslyApplied ) , loadout ) ;
359
362
}
@@ -530,7 +533,7 @@ where versionFiles.Contains(path)
530
533
// Delete all the matching override files
531
534
foreach ( var file in toDelete )
532
535
{
533
- tx . Delete ( file , false ) ;
536
+ tx . Delete ( file , recursive : false ) ;
534
537
535
538
// The backed up file is being 'promoted' to a game file, which needs
536
539
// to be rooted explicitly in case the user uses a feature like 'undo'
@@ -689,7 +692,7 @@ private void ActionAddReifiedDelete(Dictionary<GamePath, SyncNode> groupings, Lo
689
692
continue ;
690
693
691
694
// If we found a match, we need to remove the entity itself
692
- tx . Delete ( match , false ) ;
695
+ tx . Delete ( match , recursive : false ) ;
693
696
continue ;
694
697
}
695
698
}
@@ -1440,15 +1443,17 @@ private async ValueTask<Hash> MaybeHashFile(IDb hashDb, GamePath gamePath, Absol
1440
1443
// If there is no currently synced loadout, then we can ingest the game folder
1441
1444
if ( ! GameInstallMetadata . LastSyncedLoadout . TryGetValue ( remappedLoadout . Installation , out var lastSyncedLoadoutId ) )
1442
1445
{
1443
- remappedLoadout = await Synchronize ( remappedLoadout ) ;
1446
+ await _synchronizerService . Synchronize ( remappedLoadout . LoadoutId ) ;
1447
+ remappedLoadout = remappedLoadout . Rebase ( ) ;
1444
1448
}
1445
1449
else
1446
1450
{
1447
1451
// check if the last synced loadout is valid (can apparently happen if the user unmanaged the game and manages it again)
1448
1452
var lastSyncedLoadout = Loadout . Load ( remappedLoadout . Db , lastSyncedLoadoutId ) ;
1449
1453
if ( ! lastSyncedLoadout . IsValid ( ) )
1450
1454
{
1451
- remappedLoadout = await Synchronize ( lastSyncedLoadout ) ;
1455
+ await _synchronizerService . Synchronize ( remappedLoadout . LoadoutId ) ;
1456
+ remappedLoadout = remappedLoadout . Rebase ( ) ;
1452
1457
}
1453
1458
}
1454
1459
return remappedLoadout ;
@@ -1491,7 +1496,7 @@ public Optional<LoadoutId> GetCurrentlyActiveLoadout(GameInstallation installati
1491
1496
public async Task ActivateLoadout ( LoadoutId loadoutId )
1492
1497
{
1493
1498
var loadout = Loadout . Load ( Connection . Db , loadoutId ) ;
1494
- var reindexed = await ReindexState ( loadout . InstallationInstance , false , Connection ) ;
1499
+ var reindexed = await ReindexState ( loadout . InstallationInstance , ignoreModifiedDates : false , Connection ) ;
1495
1500
1496
1501
var tree = BuildSyncTree ( DiskStateToPathPartPair ( reindexed . DiskStateEntries ) , DiskStateToPathPartPair ( reindexed . DiskStateEntries ) , loadout ) ;
1497
1502
ProcessSyncTree ( tree ) ;
@@ -1551,7 +1556,7 @@ await _jobMonitor.Begin(new UnmanageGameJob(installation), async ctx =>
1551
1556
foreach ( var file in GameBackedUpFile . All ( Connection . Db ) )
1552
1557
{
1553
1558
if ( file . GameInstallId . Value == installation . GameMetadataId )
1554
- tx . Delete ( file , false ) ;
1559
+ tx . Delete ( file , recursive : false ) ;
1555
1560
}
1556
1561
1557
1562
await tx . Commit ( ) ;
@@ -1622,7 +1627,7 @@ await _jobMonitor.Begin(new UnmanageGameJob(installation), async ctx =>
1622
1627
datom . ValueSpan . CopyTo ( buffer . Span ) ;
1623
1628
1624
1629
// Create the new datom and reference the copied value
1625
- var prefix = new KeyPrefix ( newId , datom . A , TxId . Tmp , false , datom . Prefix . ValueTag ) ;
1630
+ var prefix = new KeyPrefix ( newId , datom . A , TxId . Tmp , isRetract : false , datom . Prefix . ValueTag ) ;
1626
1631
var newDatom = new Datom ( prefix , buffer [ ..datom . ValueSpan . Length ] ) ;
1627
1632
1628
1633
// Remap any entity ids in the value
@@ -1681,10 +1686,10 @@ public async Task DeleteLoadout(LoadoutId loadoutId, GarbageCollectorRunMode gcR
1681
1686
}
1682
1687
1683
1688
using var tx = Connection . BeginTransaction ( ) ;
1684
- tx . Delete ( loadoutId , false ) ;
1689
+ tx . Delete ( loadoutId , recursive : false ) ;
1685
1690
foreach ( var item in loadout . Items )
1686
1691
{
1687
- tx . Delete ( item . Id , false ) ;
1692
+ tx . Delete ( item . Id , recursive : false ) ;
1688
1693
}
1689
1694
await tx . Commit ( ) ;
1690
1695
@@ -1695,7 +1700,7 @@ public async Task DeleteLoadout(LoadoutId loadoutId, GarbageCollectorRunMode gcR
1695
1700
public async Task ResetToOriginalGameState ( GameInstallation installation , LocatorId [ ] locatorIds )
1696
1701
{
1697
1702
var gameState = _fileHashService . GetGameFiles ( ( installation . Store , locatorIds ) ) ;
1698
- var metaData = await ReindexState ( installation , false , Connection ) ;
1703
+ var metaData = await ReindexState ( installation , ignoreModifiedDates : false , Connection ) ;
1699
1704
1700
1705
List < PathPartPair > diskState = [ ] ;
1701
1706
0 commit comments