diff --git a/Wabbajack.CacheServer/JobQueueEndpoints.cs b/Wabbajack.CacheServer/JobQueueEndpoints.cs index 8cf23027..f68ce0cb 100644 --- a/Wabbajack.CacheServer/JobQueueEndpoints.cs +++ b/Wabbajack.CacheServer/JobQueueEndpoints.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Linq.Expressions; using System.Security.Policy; using System.Threading.Tasks; -using Windows.Media.Playback; using MongoDB.Driver; using MongoDB.Driver.Linq; using Nancy; diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index afa739fc..377bf7e0 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Data.HashFunction.xxHash; using System.Diagnostics; @@ -1122,6 +1123,20 @@ namespace Wabbajack.Common return path.ToLower().TrimEnd('\\').StartsWith(parent.ToLower().TrimEnd('\\') + "\\"); } + public static HashSet ToHashSet(this IEnumerable coll) + { + var hs = new HashSet(); + coll.Do(v => hs.Add(v)); + return hs; + } + + public static HashSet ToHashSet(this T[] coll) + { + var hs = new HashSet(); + coll.Do(v => hs.Add(v)); + return hs; + } + public class NexusErrorResponse { public int code; diff --git a/Wabbajack.Common/Wabbajack.Common.csproj b/Wabbajack.Common/Wabbajack.Common.csproj index 430458da..09fecdb0 100644 --- a/Wabbajack.Common/Wabbajack.Common.csproj +++ b/Wabbajack.Common/Wabbajack.Common.csproj @@ -5,35 +5,35 @@ AnyCPU;x64 - - - + + + - - - + + + - - - - - - - - - - - + + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/Wabbajack.Lib/AInstaller.cs b/Wabbajack.Lib/AInstaller.cs index 3ab7058e..78dd8851 100644 --- a/Wabbajack.Lib/AInstaller.cs +++ b/Wabbajack.Lib/AInstaller.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Alphaleonis.Win32.Filesystem; using Wabbajack.Common; @@ -27,13 +28,16 @@ namespace Wabbajack.Lib public string ModListArchive { get; private set; } public ModList ModList { get; private set; } public Dictionary HashedArchives { get; set; } + + public SystemParameters SystemParameters { get; set; } - public AInstaller(string archive, ModList modList, string outputFolder, string downloadFolder) + public AInstaller(string archive, ModList modList, string outputFolder, string downloadFolder, SystemParameters parameters) { ModList = modList; ModListArchive = archive; OutputFolder = outputFolder; DownloadFolder = downloadFolder; + SystemParameters = parameters; } public void Info(string msg) @@ -108,7 +112,7 @@ namespace Wabbajack.Lib Info("Building Folder Structure"); ModList.Directives .Select(d => Path.Combine(OutputFolder, Path.GetDirectoryName(d.To))) - .ToHashSet() + .Distinct() .Do(f => { if (Directory.Exists(f)) return; diff --git a/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs b/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs index 4f28c933..c39240af 100644 --- a/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs +++ b/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs @@ -15,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps public IgnoreDisabledMods(ACompiler compiler) : base(compiler) { _mo2Compiler = (MO2Compiler) compiler; - var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IsAlwaysEnabled(f.Value)).Select(f => f.Key).ToHashSet(); + var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IsAlwaysEnabled(f.Value)).Select(f => f.Key).Distinct(); _allEnabledMods = _mo2Compiler.SelectedProfiles .SelectMany(p => File.ReadAllLines(Path.Combine(_mo2Compiler.MO2Folder, "profiles", p, "modlist.txt"))) diff --git a/Wabbajack.Lib/Downloaders/GoogleDriveDownloader.cs b/Wabbajack.Lib/Downloaders/GoogleDriveDownloader.cs index 32bc3488..385f7212 100644 --- a/Wabbajack.Lib/Downloaders/GoogleDriveDownloader.cs +++ b/Wabbajack.Lib/Downloaders/GoogleDriveDownloader.cs @@ -1,8 +1,8 @@ using System.Net.Http; using System.Text.RegularExpressions; using System.Threading.Tasks; -using System.Web; using Wabbajack.Common; +using Wabbajack.Lib.Exceptions; using Wabbajack.Lib.Validation; namespace Wabbajack.Lib.Downloaders diff --git a/Wabbajack.Lib/Downloaders/HTTPDownloader.cs b/Wabbajack.Lib/Downloaders/HTTPDownloader.cs index dd353f9b..c9264885 100644 --- a/Wabbajack.Lib/Downloaders/HTTPDownloader.cs +++ b/Wabbajack.Lib/Downloaders/HTTPDownloader.cs @@ -7,11 +7,10 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Reflection.Emit; using System.Threading.Tasks; -using System.Web; -using Windows.Networking.BackgroundTransfer; using Ceras; using SharpCompress.Common; using Wabbajack.Common; +using Wabbajack.Lib.Exceptions; using Wabbajack.Lib.Validation; using File = Alphaleonis.Win32.Filesystem.File; diff --git a/Wabbajack.Lib/Downloaders/ManualDownloader.cs b/Wabbajack.Lib/Downloaders/ManualDownloader.cs index c3352514..988dad42 100644 --- a/Wabbajack.Lib/Downloaders/ManualDownloader.cs +++ b/Wabbajack.Lib/Downloaders/ManualDownloader.cs @@ -5,8 +5,8 @@ using System.Linq; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading.Tasks; -using Syroot.Windows.IO; using Wabbajack.Common; +using Wabbajack.Common.IO; using Wabbajack.Lib.Validation; using File = System.IO.File; diff --git a/Wabbajack.Lib/Exceptions/HttpException.cs b/Wabbajack.Lib/Exceptions/HttpException.cs new file mode 100644 index 00000000..41d46b03 --- /dev/null +++ b/Wabbajack.Lib/Exceptions/HttpException.cs @@ -0,0 +1,17 @@ +using System; + +namespace Wabbajack.Lib.Exceptions +{ + public class HttpException : Exception + { + public string Reason { get; set; } + public int Code { get; set; } + + public HttpException(int code, string reason) : base($"Http Error {code} - {reason}") + { + Code = code; + Reason = reason; + } + + } +} diff --git a/Wabbajack.Lib/MO2Installer.cs b/Wabbajack.Lib/MO2Installer.cs index 74a5c5b1..8827739f 100644 --- a/Wabbajack.Lib/MO2Installer.cs +++ b/Wabbajack.Lib/MO2Installer.cs @@ -30,12 +30,13 @@ namespace Wabbajack.Lib public string GameFolder { get; set; } - public MO2Installer(string archive, ModList modList, string outputFolder, string downloadFolder) + public MO2Installer(string archive, ModList modList, string outputFolder, string downloadFolder, SystemParameters parameters) : base( archive: archive, modList: modList, outputFolder: outputFolder, - downloadFolder: downloadFolder) + downloadFolder: downloadFolder, + parameters: parameters) { } @@ -280,8 +281,8 @@ namespace Wabbajack.Lib if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null) { - data.Sections["Display"]["iSize W"] = SystemParameters.PrimaryScreenWidth.ToString(CultureInfo.CurrentCulture); - data.Sections["Display"]["iSize H"] = SystemParameters.PrimaryScreenHeight.ToString(CultureInfo.CurrentCulture); + data.Sections["Display"]["iSize W"] = SystemParameters.ScreenWidth.ToString(CultureInfo.CurrentCulture); + data.Sections["Display"]["iSize H"] = SystemParameters.ScreenHeight.ToString(CultureInfo.CurrentCulture); } parser.WriteFile(file, data); diff --git a/Wabbajack.Lib/ModListRegistry/ModListMetadata.cs b/Wabbajack.Lib/ModListRegistry/ModListMetadata.cs index c42f54c8..038777a8 100644 --- a/Wabbajack.Lib/ModListRegistry/ModListMetadata.cs +++ b/Wabbajack.Lib/ModListRegistry/ModListMetadata.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using System.Windows.Media.Imaging; using Newtonsoft.Json; using Wabbajack.Common; using File = System.IO.File; @@ -45,7 +45,7 @@ namespace Wabbajack.Lib.ModListRegistry public string ImageUri { get; set; } [JsonIgnore] - public BitmapImage Image { get; set; } + public Bitmap Image { get; set; } [JsonProperty("readme")] public string Readme { get; set; } diff --git a/Wabbajack.Lib/NexusApi/NexusApi.cs b/Wabbajack.Lib/NexusApi/NexusApi.cs index 4365a6c3..c4e417bb 100644 --- a/Wabbajack.Lib/NexusApi/NexusApi.cs +++ b/Wabbajack.Lib/NexusApi/NexusApi.cs @@ -8,17 +8,12 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Security.Authentication; -using System.Text; using System.Threading.Tasks; using Wabbajack.Common; using Wabbajack.Lib.Downloaders; -using Wabbajack.Lib.LibCefHelpers; using WebSocketSharp; using static Wabbajack.Lib.NexusApi.NexusApiUtils; using System.Threading; -using CefSharp; -using CefSharp.Handler; -using Newtonsoft.Json; using Wabbajack.Lib.WebAutomation; namespace Wabbajack.Lib.NexusApi diff --git a/Wabbajack.Lib/Properties/AssemblyInfo.cs b/Wabbajack.Lib/Properties/AssemblyInfo.cs deleted file mode 100644 index 5d41ef04..00000000 --- a/Wabbajack.Lib/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Wabbajack.Lib")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wabbajack.Lib")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0a820830-a298-497d-85e0-e9a89efef5fe")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Wabbajack.Lib/ReportBuilder.cs b/Wabbajack.Lib/ReportBuilder.cs index 8096a162..8c64570d 100644 --- a/Wabbajack.Lib/ReportBuilder.cs +++ b/Wabbajack.Lib/ReportBuilder.cs @@ -129,7 +129,7 @@ namespace Wabbajack.Lib .Concat(lst.Directives .OfType() .Select(f => (f.To, "patched", SizeForID(f.PatchID)))) - .ToHashSet() + .Distinct() .OrderByDescending(f => f.Item3); NoWrapText("\n\n### Summary of inlined files in this installer"); diff --git a/Wabbajack.Lib/SystemParameters.cs b/Wabbajack.Lib/SystemParameters.cs new file mode 100644 index 00000000..ceec3d09 --- /dev/null +++ b/Wabbajack.Lib/SystemParameters.cs @@ -0,0 +1,8 @@ +namespace Wabbajack.Lib +{ + public class SystemParameters + { + public int ScreenHeight { get; set; } + public int ScreenWidth { get; set; } + } +} diff --git a/Wabbajack.Lib/VortexCompiler.cs b/Wabbajack.Lib/VortexCompiler.cs index 02ead8e1..adb0bb49 100644 --- a/Wabbajack.Lib/VortexCompiler.cs +++ b/Wabbajack.Lib/VortexCompiler.cs @@ -7,8 +7,8 @@ using System.Text; using System.Threading.Tasks; using System.Threading; using Newtonsoft.Json; -using Syroot.Windows.IO; using Wabbajack.Common; +using Wabbajack.Common.IO; using Wabbajack.Common.StoreHandlers; using Wabbajack.Lib.CompilationSteps; using Wabbajack.Lib.NexusApi; diff --git a/Wabbajack.Lib/VortexInstaller.cs b/Wabbajack.Lib/VortexInstaller.cs index e0062b3e..2d86df47 100644 --- a/Wabbajack.Lib/VortexInstaller.cs +++ b/Wabbajack.Lib/VortexInstaller.cs @@ -20,12 +20,13 @@ namespace Wabbajack.Lib public override ModManager ModManager => ModManager.Vortex; - public VortexInstaller(string archive, ModList modList, string outputFolder, string downloadFolder) + public VortexInstaller(string archive, ModList modList, string outputFolder, string downloadFolder, SystemParameters parameters) : base( archive: archive, modList: modList, outputFolder: outputFolder, - downloadFolder: downloadFolder) + downloadFolder: downloadFolder, + parameters: parameters) { #if DEBUG // TODO: only for testing diff --git a/Wabbajack.Lib/Wabbajack.Lib.csproj b/Wabbajack.Lib/Wabbajack.Lib.csproj index a76b1be6..bbc886c9 100644 --- a/Wabbajack.Lib/Wabbajack.Lib.csproj +++ b/Wabbajack.Lib/Wabbajack.Lib.csproj @@ -1,250 +1,72 @@  - - - - Debug - AnyCPU - {0A820830-A298-497D-85E0-E9A89EFEF5FE} - Library - Properties - Wabbajack.Lib - Wabbajack.Lib - v4.8 - 512 - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - x64 - CS1998 - CS4014 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - CS1998 - CS4014 - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - 7.3 - prompt - MinimumRecommendedRules.ruleset - false - CS4014 - CS1998 - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - 7.3 - prompt - MinimumRecommendedRules.ruleset - CS4014 - CS1998 - - - - ..\..\..\Users\tbald\.nuget\packages\mongodb.bson\2.10.0\lib\net452\MongoDB.Bson.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {ff5d892f-8ff4-44fc-8f7f-cd58f307ad1b} - Compression.BSA - - - {b3f3fb6e-b9eb-4f49-9875-d78578bc7ae5} - Wabbajack.Common - - - {5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E} - Wabbajack.VirtualFileSystem - - - - - - - - - - - 2.2.6 - - - 75.1.143 - - - 4.1.7 - - - 0.15.1 - - - 1.11.17 - - - 1.7.1 - - - 6.0.0 - - - 2.1.0 - - - 12.0.3 - - - 11.1.1 - - - 11.1.1 - - - 0.24.0 - - - 1.2.1 - - - 4.3.2 - - - 1.0.4 - - - 8.0.0 - - - - + + + netstandard2.0 + AnyCPU;x64 + + + + 75.1.143 + + + 75.1.143 + + + 4.1.7 + + + 0.15.1 + + + 6.0.6 + + + 2.2.2.1 + + + 1.11.17 + + + 1.7.1 + + + 4.7.0 + + + 2.1.0 + + + 11.1.6 + + + 11.1.6 + + + 0.24.0 + + + 1.7.0 + + + 4.7.0 + + + 4.3.4 + + + 1.0.1 + + + 1.0.0 + + + + + + + + + + + \ No newline at end of file diff --git a/Wabbajack.Lib/WebAutomation/CefSharpWrapper.cs b/Wabbajack.Lib/WebAutomation/CefSharpWrapper.cs index 84fa7c37..fcb9e919 100644 --- a/Wabbajack.Lib/WebAutomation/CefSharpWrapper.cs +++ b/Wabbajack.Lib/WebAutomation/CefSharpWrapper.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.Remoting.Channels; using System.Text; using System.Threading.Tasks; using CefSharp; diff --git a/Wabbajack.Test/ACompilerTest.cs b/Wabbajack.Test/ACompilerTest.cs index 58f2d5cd..19b8fd07 100644 --- a/Wabbajack.Test/ACompilerTest.cs +++ b/Wabbajack.Test/ACompilerTest.cs @@ -5,6 +5,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Wabbajack.Common; using Wabbajack.Lib; using Wabbajack.Lib.LibCefHelpers; +using Wabbajack.Util; namespace Wabbajack.Test { @@ -57,7 +58,8 @@ namespace Wabbajack.Test archive: compiler.ModListOutputFile, modList: modlist, outputFolder: utils.InstallFolder, - downloadFolder: utils.DownloadsFolder); + downloadFolder: utils.DownloadsFolder, + parameters: SystemParametersConstructor.Create()); installer.WarnOnOverwrite = false; installer.GameFolder = utils.GameFolder; await installer.Begin(); diff --git a/Wabbajack.Test/AVortexCompilerTest.cs b/Wabbajack.Test/AVortexCompilerTest.cs index 1f9c7466..a8691415 100644 --- a/Wabbajack.Test/AVortexCompilerTest.cs +++ b/Wabbajack.Test/AVortexCompilerTest.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; using Wabbajack.Common; using Wabbajack.Lib; +using Wabbajack.Util; namespace Wabbajack.Test { @@ -67,7 +68,8 @@ namespace Wabbajack.Test archive: vortexCompiler.ModListOutputFile, modList: modList, outputFolder: utils.InstallFolder, - downloadFolder: utils.DownloadsFolder) + downloadFolder: utils.DownloadsFolder, + parameters: SystemParametersConstructor.Create()) { GameFolder = utils.GameFolder, }; diff --git a/Wabbajack.Test/EndToEndTests.cs b/Wabbajack.Test/EndToEndTests.cs index d120ede9..1a9da3ef 100644 --- a/Wabbajack.Test/EndToEndTests.cs +++ b/Wabbajack.Test/EndToEndTests.cs @@ -8,6 +8,7 @@ using Wabbajack.Common; using Wabbajack.Lib; using Wabbajack.Lib.Downloaders; using Wabbajack.Lib.NexusApi; +using Wabbajack.Util; namespace Wabbajack.Test { @@ -153,7 +154,8 @@ namespace Wabbajack.Test archive: compiler.ModListOutputFile, modList: modlist, outputFolder: utils.InstallFolder, - downloadFolder: utils.DownloadsFolder); + downloadFolder: utils.DownloadsFolder, + parameters: SystemParametersConstructor.Create()); installer.GameFolder = utils.GameFolder; await installer.Begin(); } diff --git a/Wabbajack/Util/SystemParametersConstructor.cs b/Wabbajack/Util/SystemParametersConstructor.cs new file mode 100644 index 00000000..e8b3ddbc --- /dev/null +++ b/Wabbajack/Util/SystemParametersConstructor.cs @@ -0,0 +1,17 @@ +using MahApps.Metro.Controls; +using Wabbajack.Lib; + +namespace Wabbajack.Util +{ + public static class SystemParametersConstructor + { + public static SystemParameters Create() + { + return new SystemParameters + { + ScreenWidth = (int)System.Windows.SystemParameters.PrimaryScreenWidth, + ScreenHeight = (int)System.Windows.SystemParameters.PrimaryScreenHeight + }; + } + } +} diff --git a/Wabbajack/View Models/Installers/MO2InstallerVM.cs b/Wabbajack/View Models/Installers/MO2InstallerVM.cs index b55c2537..f32b5a1d 100644 --- a/Wabbajack/View Models/Installers/MO2InstallerVM.cs +++ b/Wabbajack/View Models/Installers/MO2InstallerVM.cs @@ -12,6 +12,7 @@ using ReactiveUI.Fody.Helpers; using Wabbajack.Common; using Wabbajack.Lib; using Wabbajack.UI; +using Wabbajack.Util; namespace Wabbajack { @@ -149,7 +150,8 @@ namespace Wabbajack archive: Parent.ModListLocation.TargetPath, modList: Parent.ModList.SourceModList, outputFolder: Location.TargetPath, - downloadFolder: DownloadLocation.TargetPath); + downloadFolder: DownloadLocation.TargetPath, + parameters: SystemParametersConstructor.Create()); await Task.Run(async () => { diff --git a/Wabbajack/View Models/Installers/VortexInstallerVM.cs b/Wabbajack/View Models/Installers/VortexInstallerVM.cs index efc91e02..6952ee86 100644 --- a/Wabbajack/View Models/Installers/VortexInstallerVM.cs +++ b/Wabbajack/View Models/Installers/VortexInstallerVM.cs @@ -8,6 +8,7 @@ using ReactiveUI; using ReactiveUI.Fody.Helpers; using Wabbajack.Common; using Wabbajack.Lib; +using Wabbajack.Util; namespace Wabbajack { @@ -66,7 +67,8 @@ namespace Wabbajack archive: Parent.ModListLocation.TargetPath, modList: Parent.ModList.SourceModList, outputFolder: staging, - downloadFolder: download); + downloadFolder: download, + parameters: SystemParametersConstructor.Create()); await Task.Run(async () => { diff --git a/Wabbajack/Wabbajack.csproj b/Wabbajack/Wabbajack.csproj index 63c5d3ac..e676468a 100644 --- a/Wabbajack/Wabbajack.csproj +++ b/Wabbajack/Wabbajack.csproj @@ -174,6 +174,7 @@ + @@ -536,7 +537,7 @@ 11.1.1 - 11.1.1 + 11.1.6 11.1.1