is dirty tracking was breaking VFS, removed it

This commit is contained in:
Timothy Baldridge 2019-09-28 19:36:54 -06:00
parent 1418634dbb
commit 45bc7ec62d
2 changed files with 2 additions and 11 deletions

View File

@ -5,6 +5,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading;
using Compression.BSA; using Compression.BSA;
using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -23,7 +24,6 @@ namespace VFS
private bool _disableDiskCache; private bool _disableDiskCache;
private Dictionary<string, VirtualFile> _files = new Dictionary<string, VirtualFile>(); private Dictionary<string, VirtualFile> _files = new Dictionary<string, VirtualFile>();
private volatile bool _isSyncing; private volatile bool _isSyncing;
private volatile bool _isDirty = false;
static VirtualFileSystem() static VirtualFileSystem()
{ {
@ -131,15 +131,12 @@ namespace VFS
{ {
} }
_isDirty = false;
CleanDB(); CleanDB();
} }
catch (Exception ex) catch (Exception ex)
{ {
Utils.Log($"Purging cache due to {ex}"); Utils.Log($"Purging cache due to {ex}");
File.Delete("vfs_cache.bson"); File.Delete("vfs_cache.bson");
_isDirty = true;
_files.Clear(); _files.Clear();
} }
} }
@ -151,7 +148,6 @@ namespace VFS
Utils.Status("Syncing VFS Cache"); Utils.Status("Syncing VFS Cache");
lock (this) lock (this)
{ {
if (!_isDirty) return;
try try
{ {
_isSyncing = true; _isSyncing = true;
@ -170,7 +166,6 @@ namespace VFS
File.Delete("vfs_cache.bin"); File.Delete("vfs_cache.bin");
File.Move("vfs_cache.bin_new", "vfs_cache.bin"); File.Move("vfs_cache.bin_new", "vfs_cache.bin");
_isDirty = false;
} }
finally finally
{ {
@ -199,7 +194,6 @@ namespace VFS
.ToList() .ToList()
.Do(r => .Do(r =>
{ {
_isDirty = true;
_files.Remove(r.FullPath); _files.Remove(r.FullPath);
}); });
} }
@ -209,7 +203,6 @@ namespace VFS
{ {
lock (this) lock (this)
{ {
_isDirty = true;
if (_files.ContainsKey(f.FullPath)) if (_files.ContainsKey(f.FullPath))
Purge(f); Purge(f);
_files.Add(f.FullPath, f); _files.Add(f.FullPath, f);
@ -255,7 +248,6 @@ namespace VFS
.ToList() .ToList()
.Do(f => .Do(f =>
{ {
_isDirty = true;
_files.Remove(f.FullPath); _files.Remove(f.FullPath);
}); });
SyncToDisk(); SyncToDisk();

View File

@ -227,8 +227,7 @@ namespace Wabbajack
if (IndexedArchives.Any(a => a.IniData?.General?.gameName != null)) if (IndexedArchives.Any(a => a.IniData?.General?.gameName != null))
{ {
var nexusClient = new NexusApiClient(); var nexusClient = new NexusApiClient();
var status = nexusClient.GetUserStatus(); if (!nexusClient.IsPremium) Info($"User {nexusClient.Username} is not a premium Nexus user, cannot continue");
if (!status.is_premium) Info($"User {status.user_id} is not a premium Nexus user, cannot continue");
} }