mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1113 from wabbajack-tools/code-cleanup
Code cleanup
This commit is contained in:
commit
66506283ec
@ -1,6 +1,6 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 2.3.0.0 - 9/21/2020
|
||||
#### Version - 2.3.0.1 - 10/1/2020
|
||||
* Rewrote the file extraction routines. New code uses less memory, less disk space, and performs less thrashing on HDDs
|
||||
* Reworked IPS4 integration to reduce download failures
|
||||
* Profiles can now contain an (optional) file `compiler_settings.json` that includes options for other games to be used during install.
|
||||
@ -9,6 +9,9 @@ This is now the only way to include extra games in the install process, implicit
|
||||
* Includes a "Favor performance over RAM" optional mode (defaults to off) that will use excessive amounts of RAM in exchange
|
||||
for almost 1GB/sec install speed on the correct hardware. Don't enable this unless you have a fast SSD and at least 2.5GB of RAM for every
|
||||
install thread.
|
||||
* Fixed Extraction so that zip files no longer cause WJ to CTD
|
||||
* Better path logging during install and compilation
|
||||
* Fix the "this was created with a newer version of Wabbajack" issue
|
||||
* If a downloaded file doesn't match the expected hash, try alternative download locations, if allowed
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<AssemblyName>wabbajack-cli</AssemblyName>
|
||||
<Company>Wabbajack</Company>
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyVersion>2.3.0.0</AssemblyVersion>
|
||||
<FileVersion>2.3.0.0</FileVersion>
|
||||
<AssemblyVersion>2.3.0.1</AssemblyVersion>
|
||||
<FileVersion>2.3.0.1</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -11,8 +11,7 @@ namespace Wabbajack.Common
|
||||
{
|
||||
public static class Consts
|
||||
{
|
||||
public static Version? CurrentWabbajackVersion { get; set; }
|
||||
|
||||
public static Version? CurrentMinimumWabbajackVersion = new Version("2.2.2.0");
|
||||
public static bool TestMode { get; set; } = false;
|
||||
|
||||
public static RelativePath GameFolderFilesDir = (RelativePath)"Game Folder Files";
|
||||
|
@ -65,10 +65,6 @@ namespace Wabbajack
|
||||
/// When the switch is on, the source will be subscribed to, and its updates passed through.
|
||||
/// When the switch is off, the subscription to the source observable will be stopped, and no signal will be published.
|
||||
/// </summary>
|
||||
/// <param name="source">Source observable to subscribe to if on</param>
|
||||
/// <param name="filterSwitch">On/Off signal of whether to subscribe to source observable</param>
|
||||
/// <param name="valueOnOff">Value to fire when switching off</param>
|
||||
/// <returns>Observable that publishes data from source, if the switch is on.</returns>
|
||||
public static IObservable<T> FlowSwitch<T>(this IObservable<T> source, IObservable<bool> filterSwitch, T valueWhenOff)
|
||||
{
|
||||
return filterSwitch
|
||||
|
@ -742,10 +742,6 @@ namespace Wabbajack.Common
|
||||
/// <summary>
|
||||
/// Roundtrips the value through the JSON routines
|
||||
/// </summary>
|
||||
/// <typeparam name="TV"></typeparam>
|
||||
/// <typeparam name="TR"></typeparam>
|
||||
/// <param name="tv"></param>
|
||||
/// <returns></returns>
|
||||
public static T ViaJSON<T>(this T tv)
|
||||
{
|
||||
var json = tv.ToJson();
|
||||
@ -844,7 +840,7 @@ namespace Wabbajack.Common
|
||||
{
|
||||
return benchmarkFile.FromJson<long>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyVersion>2.3.0.0</AssemblyVersion>
|
||||
<FileVersion>2.3.0.0</FileVersion>
|
||||
<AssemblyVersion>2.3.0.1</AssemblyVersion>
|
||||
<FileVersion>2.3.0.1</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>Wabbajack Application Launcher</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -57,7 +57,7 @@ namespace Wabbajack.Lib
|
||||
: base(steps)
|
||||
{
|
||||
//set in MainWindowVM
|
||||
WabbajackVersion = Consts.CurrentWabbajackVersion;
|
||||
WabbajackVersion = Consts.CurrentMinimumWabbajackVersion;
|
||||
}
|
||||
|
||||
public static void Info(string msg)
|
||||
|
@ -193,7 +193,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
};
|
||||
return await Download(newArchive, destination);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
return (newArchive, tempFile);
|
||||
}
|
||||
|
||||
public async Task<bool> ValidateUpgrade(Hash srcHash, AbstractDownloadState newArchiveState)
|
||||
public override async Task<bool> ValidateUpgrade(Hash srcHash, AbstractDownloadState newArchiveState)
|
||||
{
|
||||
var state = (State)newArchiveState;
|
||||
return Game == state.Game && ModID == state.ModID;
|
||||
|
@ -6,7 +6,6 @@ using System.IO.MemoryMappedFiles;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AngleSharp;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.Exceptions;
|
||||
using Wabbajack.Common.Serialization.Json;
|
||||
|
@ -1,12 +1,9 @@
|
||||
using Compression.BSA;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AngleSharp.Common;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.CompilationSteps;
|
||||
using Wabbajack.Lib.Downloaders;
|
||||
@ -61,7 +58,7 @@ namespace Wabbajack.Lib
|
||||
MO2Ini = MO2Folder.Combine("ModOrganizer.ini").LoadIniFile();
|
||||
var mo2game = (string)MO2Ini.General.gameName;
|
||||
CompilingGame = GameRegistry.Games.First(g => g.Value.MO2Name == mo2game).Value;
|
||||
GamePath = new AbsolutePath((string)MO2Ini.General.gamePath.Replace("\\\\", "\\"));
|
||||
GamePath = CompilingGame.GameLocation();
|
||||
ModListOutputFile = outputFile;
|
||||
Settings = new CompilerSettings();
|
||||
}
|
||||
@ -103,6 +100,13 @@ namespace Wabbajack.Lib
|
||||
|
||||
Info("Using Profiles: " + string.Join(", ", SelectedProfiles.OrderBy(p => p)));
|
||||
|
||||
Utils.Log($"Compiling Game: {CompilingGame}");
|
||||
Utils.Log($"Games from setting files:");
|
||||
foreach (var game in Settings.IncludedGames)
|
||||
{
|
||||
Utils.Log($"- {game}");
|
||||
}
|
||||
|
||||
Utils.Log($"VFS File Location: {VFSCacheName}");
|
||||
Utils.Log($"MO2 Folder: {MO2Folder}");
|
||||
Utils.Log($"Downloads Folder: {MO2DownloadsFolder}");
|
||||
@ -343,7 +347,7 @@ namespace Wabbajack.Lib
|
||||
ModList = new ModList
|
||||
{
|
||||
GameType = CompilingGame.Game,
|
||||
WabbajackVersion = Consts.CurrentWabbajackVersion,
|
||||
WabbajackVersion = Consts.CurrentMinimumWabbajackVersion,
|
||||
Archives = SelectedArchives.ToList(),
|
||||
ModManager = ModManager.MO2,
|
||||
Directives = InstallDirectives,
|
||||
|
@ -84,6 +84,12 @@ namespace Wabbajack.Lib
|
||||
Utils.Log("Exiting because we couldn't find the game folder.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Utils.Log($"Install Folder: {OutputFolder}");
|
||||
Utils.Log($"Downloads Folder: {DownloadFolder}");
|
||||
Utils.Log($"Game Folder: {GameFolder.Value}");
|
||||
Utils.Log($"Wabbajack Folder: {AbsolutePath.EntryPoint}");
|
||||
|
||||
|
||||
var watcher = new DiskSpaceWatcher(cancel, new[]{OutputFolder, DownloadFolder, GameFolder.Value, AbsolutePath.EntryPoint}, (long)2 << 31,
|
||||
drive =>
|
||||
|
@ -91,7 +91,7 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
var client = new Http.Client();
|
||||
return (await client.GetStringAsync(Consts.UnlistedModlistMetadataURL)).FromJsonString<List<ModlistMetadata>>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
Utils.LogStatus("Error loading unlisted modlists");
|
||||
return new List<ModlistMetadata>();
|
||||
|
@ -17,16 +17,13 @@
|
||||
<Version>3.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Fody">
|
||||
<Version>6.2.5</Version>
|
||||
<Version>6.2.6</Version>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Genbox.AlphaFS">
|
||||
<Version>2.2.2.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="GraphQL.Client">
|
||||
<Version>3.1.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="HtmlAgilityPack">
|
||||
<Version>1.11.24</Version>
|
||||
</PackageReference>
|
||||
@ -69,9 +66,6 @@
|
||||
<PackageReference Include="YamlDotNet.NetCore">
|
||||
<Version>1.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="YoutubeExplode">
|
||||
<Version>5.1.4</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Compression.BSA\Compression.BSA.csproj" />
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.BuildServer.Test;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Server.Test
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
return NotFound("File is Valid");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
//_logger.LogInformation(
|
||||
// $"Refusing to upgrade ({request.OldArchive.State.PrimaryKeyString}), due to upgrade failure");
|
||||
|
@ -3,15 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AngleSharp.Io;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.Exceptions;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.NexusApi;
|
||||
using Wabbajack.Server.DataLayer;
|
||||
using Wabbajack.Server.Services;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AngleSharp.Common;
|
||||
using Dapper;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.Downloaders;
|
||||
|
@ -17,7 +17,6 @@ namespace Wabbajack.Server.Services
|
||||
private TimeSpan _delay;
|
||||
protected ILogger<TP> _logger;
|
||||
protected QuickSync _quickSync;
|
||||
private bool _isSetup;
|
||||
|
||||
public AbstractService(ILogger<TP> logger, AppSettings settings, QuickSync quickSync, TimeSpan delay)
|
||||
{
|
||||
@ -26,7 +25,6 @@ namespace Wabbajack.Server.Services
|
||||
_logger = logger;
|
||||
_quickSync = quickSync;
|
||||
|
||||
_isSetup = false;
|
||||
}
|
||||
|
||||
public virtual async Task Setup()
|
||||
@ -42,7 +40,6 @@ namespace Wabbajack.Server.Services
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Setup();
|
||||
_isSetup = true;
|
||||
|
||||
|
||||
while (true)
|
||||
|
@ -19,8 +19,6 @@ namespace Wabbajack.Server.Services
|
||||
}
|
||||
public class DiscordWebHook : AbstractService<DiscordWebHook, int>
|
||||
{
|
||||
private AppSettings _settings;
|
||||
private ILogger<DiscordWebHook> _logger;
|
||||
private Random _random = new Random();
|
||||
|
||||
public DiscordWebHook(ILogger<DiscordWebHook> logger, AppSettings settings, QuickSync quickSync) : base(logger, settings, quickSync, TimeSpan.FromHours(1))
|
||||
|
@ -345,7 +345,7 @@ namespace Wabbajack.Server.Services
|
||||
{
|
||||
await _sql.AddNexusModInfo(ns.Game, ns.ModID, queryTime, mod);
|
||||
}
|
||||
catch (Exception _)
|
||||
catch (Exception)
|
||||
{
|
||||
// Could be a PK constraint failure
|
||||
}
|
||||
@ -368,13 +368,13 @@ namespace Wabbajack.Server.Services
|
||||
{
|
||||
await _sql.AddNexusModFiles(ns.Game, ns.ModID, queryTime, files);
|
||||
}
|
||||
catch (Exception _)
|
||||
catch (Exception)
|
||||
{
|
||||
// Could be a PK constraint failure
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return ArchiveStatus.InValid;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ namespace Wabbajack.Server.Services
|
||||
{
|
||||
modlist = entry.FromJson<ModList>();
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
catch (JsonReaderException)
|
||||
{
|
||||
_logger.LogWarning($"Bad Modlist {list.Links.MachineURL}");
|
||||
await _discord.Send(Channel.Ham,
|
||||
|
@ -52,7 +52,7 @@ namespace Wabbajack.Server.Services
|
||||
var (daily, hourly) = await client.GetRemainingApiCalls();
|
||||
await _sql.SetNexusAPIKey(key.Key, daily, hourly);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
_logger.Log(LogLevel.Warning, "Update error, purging API key");
|
||||
await _sql.DeleteNexusAPIKey(key.Key);
|
||||
@ -82,7 +82,7 @@ namespace Wabbajack.Server.Services
|
||||
var hourlyRemaining = int.Parse(response.Headers.GetValues("x-rl-hourly-remaining").First());
|
||||
await _sql.SetNexusAPIKey(ApiKey, dailyRemaining, hourlyRemaining);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ namespace Wabbajack.Server.Services
|
||||
_logger.Log(LogLevel.Information, "Starting");
|
||||
|
||||
var results = await NexusUpdatesFeeds.GetUpdates();
|
||||
NexusApiClient client = null;
|
||||
long updated = 0;
|
||||
foreach (var result in results)
|
||||
{
|
||||
|
@ -170,11 +170,11 @@ namespace Wabbajack.Server.Services
|
||||
var lst = p.Split("_", StringSplitOptions.RemoveEmptyEntries).Select(Hash.FromHex).ToArray();
|
||||
return (lst[0], lst[1]);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
catch (ArgumentException)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
catch (FormatException ex)
|
||||
catch (FormatException)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<AssemblyVersion>2.3.0.0</AssemblyVersion>
|
||||
<FileVersion>2.3.0.0</FileVersion>
|
||||
<AssemblyVersion>2.3.0.1</AssemblyVersion>
|
||||
<FileVersion>2.3.0.1</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>Wabbajack Server</Description>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
@ -25,7 +25,7 @@ namespace Wabbajack.VirtualFileSystem.Test
|
||||
{
|
||||
_helper.WriteLine(f.ShortDescription);
|
||||
}
|
||||
catch (Exception _)
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace Wabbajack.VirtualFileSystem.Test
|
||||
{
|
||||
_helper.WriteLine(f.ShortDescription);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
@ -202,6 +202,7 @@ namespace Wabbajack.VirtualFileSystem
|
||||
/// Extract the set of files and call the callback for each, handing it a stream factory and the virtual file,
|
||||
/// top level archives (native archives) will be processed in parallel. Duplicate files will not be
|
||||
/// </summary>
|
||||
/// <<param name="queue"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="callback"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -49,7 +49,7 @@ namespace Wabbajack.VirtualFileSystem.SevenZipExtractor
|
||||
{
|
||||
setter = (ISetProperties)_archive;
|
||||
}
|
||||
catch (InvalidCastException _)
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -454,31 +454,4 @@ namespace Wabbajack.VirtualFileSystem.SevenZipExtractor
|
||||
return (uint) this.BaseStream.Read(data, 0, (int) size);
|
||||
}
|
||||
}
|
||||
|
||||
internal class OutStreamWrapper : StreamWrapper, ISequentialOutStream, IOutStream
|
||||
{
|
||||
public OutStreamWrapper(Stream baseStream) : base(baseStream)
|
||||
{
|
||||
}
|
||||
|
||||
public int SetSize(long newSize)
|
||||
{
|
||||
this.BaseStream.SetLength(newSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int Write(byte[] data, uint size, IntPtr processedSize)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
/*
|
||||
this.BaseStream.Write(data, 0, (int) size);
|
||||
|
||||
if (processedSize != IntPtr.Zero)
|
||||
{
|
||||
Marshal.WriteInt32(processedSize, (int) size);
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ namespace Wabbajack.VirtualFileSystem
|
||||
_vfsCache = RocksDb.Open(options, (string)Consts.LocalAppDataPath.Combine("GlobalVFSCache2.rocksDb"));
|
||||
}
|
||||
|
||||
private AbsolutePath _stagedPath;
|
||||
|
||||
private IEnumerable<VirtualFile> _thisAndAllChildren;
|
||||
|
||||
public IPath Name { get; internal set; }
|
||||
|
@ -212,7 +212,7 @@ namespace Wabbajack
|
||||
{
|
||||
if (modList == null) return ErrorResponse.Fail("Modlist path resulted in a null object.");
|
||||
if (modList.Error != null) return ErrorResponse.Fail("Modlist is corrupt", modList.Error);
|
||||
if (modList.WabbajackVersion != null && modList.WabbajackVersion > Consts.CurrentWabbajackVersion)
|
||||
if (modList.WabbajackVersion != null && modList.WabbajackVersion > Consts.CurrentMinimumWabbajackVersion)
|
||||
return ErrorResponse.Fail("The Modlist you are trying to install was made using a newer Version of Wabbajack. Please update Wabbajack before installing!");
|
||||
return ErrorResponse.Success;
|
||||
});
|
||||
|
@ -120,7 +120,7 @@ namespace Wabbajack
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
Consts.CurrentWabbajackVersion = Version.Parse(fvi.FileVersion);
|
||||
Consts.CurrentMinimumWabbajackVersion = Version.Parse(fvi.FileVersion);
|
||||
VersionDisplay = $"v{fvi.FileVersion}";
|
||||
Utils.Log($"Wabbajack Version: {fvi.FileVersion}");
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<AssemblyVersion>2.3.0.0</AssemblyVersion>
|
||||
<FileVersion>2.3.0.0</FileVersion>
|
||||
<AssemblyVersion>2.3.0.1</AssemblyVersion>
|
||||
<FileVersion>2.3.0.1</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
Loading…
Reference in New Issue
Block a user