@@ -28,7 +28,7 @@ public static class XivCache
28
28
private static DirectoryInfo _rootCachePath ;
29
29
public static readonly Version CacheVersion = new Version ( "0.0.1.1" ) ;
30
30
private const string dbFileName = "mod_cache.db" ;
31
- private const string rootCacheFileName = "roots_cache .db" ;
31
+ private const string rootCacheFileName = "item_sets .db" ;
32
32
private const string creationScript = "CreateCacheDB.sql" ;
33
33
private const string rootCacheCreationScript = "CreateRootCacheDB.sql" ;
34
34
internal static string CacheConnectionString { get
@@ -313,15 +313,33 @@ private static void CreateCache()
313
313
314
314
if ( ! File . Exists ( _rootCachePath . FullName ) )
315
315
{
316
- using ( var db = new SQLiteConnection ( RootsCacheConnectionString ) )
317
- {
318
- db . Open ( ) ;
319
- var lines = File . ReadAllLines ( "Resources\\ SQL\\ " + rootCacheCreationScript ) ;
320
- var sqlCmd = String . Join ( "\n " , lines ) ;
316
+ // If we don't have a root cache file, we can do a few things...
317
+ var cwd = System . IO . Path . GetDirectoryName ( System . Reflection . Assembly . GetEntryAssembly ( ) . Location ) ;
318
+ var backupFile = cwd + "\\ Resources\\ DB\\ " + rootCacheFileName ;
321
319
322
- using ( var cmd = new SQLiteCommand ( sqlCmd , db ) )
320
+ if ( File . Exists ( backupFile ) )
321
+ {
322
+ // Copy the backup over. - Even if the backup is not for the correct patch of
323
+ // FFXIV for this user's region, that's fine. It's still some reasonable data.
324
+ // Worst case situation is either
325
+ // A - They're missing some raw set listings in the menus (Not a big deal)
326
+ // B - They have some raw set listings in the menus that they don't have yet. (Won't load, not a big deal.)
327
+ File . Copy ( backupFile , _rootCachePath . FullName ) ;
328
+ }
329
+ else
330
+ {
331
+ // No backup DB to use, just create a blank schema, other functions will fallback to using the
332
+ // roots from the item list as a partial list.
333
+ using ( var db = new SQLiteConnection ( RootsCacheConnectionString ) )
323
334
{
324
- cmd . ExecuteScalar ( ) ;
335
+ db . Open ( ) ;
336
+ var lines = File . ReadAllLines ( "Resources\\ SQL\\ " + rootCacheCreationScript ) ;
337
+ var sqlCmd = String . Join ( "\n " , lines ) ;
338
+
339
+ using ( var cmd = new SQLiteCommand ( sqlCmd , db ) )
340
+ {
341
+ cmd . ExecuteScalar ( ) ;
342
+ }
325
343
}
326
344
}
327
345
}
@@ -1490,6 +1508,17 @@ public static async Task<List<XivDependencyRoot>> GetDependencyRoots(string inte
1490
1508
return roots ;
1491
1509
}
1492
1510
1511
+ /// <summary>
1512
+ /// Re-scans the *ENTIRE* list of possible roots in the 040000 DAT file.
1513
+ /// This operation takes a LONG time, and should not be done unless specifically
1514
+ /// user initiated.
1515
+ /// </summary>
1516
+ /// <returns></returns>
1517
+ public static async Task RebuildAllRoots ( )
1518
+ {
1519
+ await XivDependencyGraph . CacheAllRealRoots ( ) ;
1520
+ }
1521
+
1493
1522
1494
1523
/// <summary>
1495
1524
/// Updates the file children in the dependencies cache.
0 commit comments