From a4137255de293fd616c54882c8b06a391a82c0c2 Mon Sep 17 00:00:00 2001 From: Halgari Date: Wed, 28 Dec 2022 15:45:46 -0700 Subject: [PATCH] Fallback for file deletion, fix server code for the proxy --- CHANGELOG.md | 3 ++- .../NullCache.cs | 16 ++++++++++++++++ Wabbajack.Paths.IO/AbsolutePathExtensions.cs | 12 ++++++++++++ Wabbajack.Server/Startup.cs | 2 ++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Wabbajack.Downloaders.VerificationCache/NullCache.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 078a066f..3c2bfcc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ ### Changelog -#### Version - 3.0.6.0 - ?? +#### Version - 3.0.5.0 - ?? * Add support for Cubemaps in BA2 files, if you have problems with BA2 recompression, be sure to delete your `GlobalVFSCache3.sqlite` from your AppData before the next compile * Fixed slides not being shown during installation for lists compile with the 3.0 compiler * Set the "While loading slide" debug message to be `Trace` level, set the default minimum log level to `Information` + #### Version - 3.0.5.0 - 12/22/2022 * Add support for https://www.nexusmods.com/site hosted mods. * Fix Website Links diff --git a/Wabbajack.Downloaders.VerificationCache/NullCache.cs b/Wabbajack.Downloaders.VerificationCache/NullCache.cs new file mode 100644 index 00000000..97226e11 --- /dev/null +++ b/Wabbajack.Downloaders.VerificationCache/NullCache.cs @@ -0,0 +1,16 @@ +using Wabbajack.DTOs.DownloadStates; + +namespace Wabbajack.Downloaders.VerificationCache; + +public class NullCache : IVerificationCache +{ + public async Task<(bool? IsValid, IDownloadState State)> Get(IDownloadState state) + { + return (null, state); + } + + public Task Put(IDownloadState archive, bool valid) + { + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/Wabbajack.Paths.IO/AbsolutePathExtensions.cs b/Wabbajack.Paths.IO/AbsolutePathExtensions.cs index 64c64119..27cd9e90 100644 --- a/Wabbajack.Paths.IO/AbsolutePathExtensions.cs +++ b/Wabbajack.Paths.IO/AbsolutePathExtensions.cs @@ -41,6 +41,18 @@ public static class AbsolutePathExtensions throw; } } + catch (IOException ex) + { + if (ex.Message.Contains("because it is being used by another process")) + { + Thread.Sleep(1000); + File.Delete(path); + } + else + { + throw; + } + } } if (Directory.Exists(path)) file.DeleteDirectory(); diff --git a/Wabbajack.Server/Startup.cs b/Wabbajack.Server/Startup.cs index 75f2f768..30ba2c14 100644 --- a/Wabbajack.Server/Startup.cs +++ b/Wabbajack.Server/Startup.cs @@ -23,6 +23,7 @@ using Newtonsoft.Json; using Octokit; using Wabbajack.BuildServer; using Wabbajack.Downloaders; +using Wabbajack.Downloaders.VerificationCache; using Wabbajack.DTOs; using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.Logins; @@ -97,6 +98,7 @@ public class Startup var settings = s.GetRequiredService(); return new TemporaryFileManager(settings.TempPath.Combine(Environment.ProcessId + "_" + Guid.NewGuid())); }); + services.AddSingleton(); services.AddAllSingleton, WabbajackApiTokenProvider>(); services.AddAllSingleton>(s => new Resource("Downloads", 12));