diff --git a/SevenZipExtractor/ArchiveFile.cs b/SevenZipExtractor/ArchiveFile.cs
index 9111e806..86165023 100644
--- a/SevenZipExtractor/ArchiveFile.cs
+++ b/SevenZipExtractor/ArchiveFile.cs
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.IO.Compression;
using System.Linq;
+using System.Reflection;
using System.Runtime.InteropServices;
namespace SevenZipExtractor
@@ -262,8 +264,13 @@ namespace SevenZipExtractor
return result;
}
+ private static object _lockobj = new object();
+ private static string _staticLibraryFilePath;
+
private void InitializeAndValidateLibrary()
{
+ this.libraryFilePath = SetupLibrary();
+
if (string.IsNullOrWhiteSpace(this.libraryFilePath))
{
string currentArchitecture = IntPtr.Size == 4 ? "x86" : "x64"; // magic check
@@ -306,6 +313,28 @@ namespace SevenZipExtractor
}
}
+ private static string SetupLibrary()
+ {
+ var zpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "7z-x64.dll");
+ if (_staticLibraryFilePath == null)
+ {
+ lock (_lockobj)
+ {
+ if (_staticLibraryFilePath == null)
+ {
+ using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("SevenZipExtractor.7z.dll.gz"))
+ using (var fs = File.OpenWrite(zpath))
+ using (var gz = new GZipStream(s, CompressionMode.Decompress))
+ {
+ gz.CopyTo(fs);
+ }
+ _staticLibraryFilePath = zpath;
+ }
+ }
+ }
+ return _staticLibraryFilePath;
+ }
+
private bool GuessFormatFromExtension(string fileExtension, out SevenZipFormat format)
{
if (string.IsNullOrWhiteSpace(fileExtension))
diff --git a/SevenZipExtractor/SevenZipExtractor.csproj b/SevenZipExtractor/SevenZipExtractor.csproj
index 1a2059c4..f09d1e3a 100644
--- a/SevenZipExtractor/SevenZipExtractor.csproj
+++ b/SevenZipExtractor/SevenZipExtractor.csproj
@@ -56,6 +56,7 @@
+
Designer
diff --git a/Wabbajack/Compiler.cs b/Wabbajack/Compiler.cs
index 308b432c..28320804 100644
--- a/Wabbajack/Compiler.cs
+++ b/Wabbajack/Compiler.cs
@@ -14,6 +14,7 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using Wabbajack.Common;
+using static Wabbajack.NexusAPI;
namespace Wabbajack
{
@@ -49,6 +50,8 @@ namespace Wabbajack
public Action Log_Fn { get; }
public List InstallDirectives { get; private set; }
+ public string NexusKey { get; private set; }
+ internal UserStatus User { get; private set; }
public List SelectedArchives { get; private set; }
public List AllFiles { get; private set; }
public ModList ModList { get; private set; }
@@ -187,6 +190,15 @@ namespace Wabbajack
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
+ NexusKey = NexusAPI.GetNexusAPIKey();
+ User = NexusAPI.GetUserStatus(NexusKey);
+
+ if (!User.is_premium)
+ {
+ Info($"User {User.name} is not a premium Nexus user, cannot continue");
+ }
+
+
GatherArchives();
BuildPatches();
@@ -319,7 +331,7 @@ namespace Wabbajack
.Select(a => a.ArchiveHash)
.Distinct();
- SelectedArchives = shas.Select(sha => ResolveArchive(sha, archives)).ToList();
+ SelectedArchives = shas.PMap(sha => ResolveArchive(sha, archives));
}
@@ -343,6 +355,16 @@ namespace Wabbajack
FileID = general.fileID,
ModID = general.modID
};
+ Status($"Getting Nexus info for {found.Name}");
+ try
+ {
+ var info = NexusAPI.GetFileInfo((NexusMod)result, NexusKey);
+ }
+ catch (Exception ex)
+ {
+ Error($"Unable to resolve {found.Name} on the Nexus was the file removed?");
+ }
+
}
else if (general.directURL != null && general.directURL.StartsWith("https://drive.google.com"))
{
diff --git a/Wabbajack/FodyWeavers.xml b/Wabbajack/FodyWeavers.xml
index 5029e706..36bc693f 100644
--- a/Wabbajack/FodyWeavers.xml
+++ b/Wabbajack/FodyWeavers.xml
@@ -1,3 +1,10 @@
-
+
+
+ 7z
+
+
+ 7z
+
+
\ No newline at end of file
diff --git a/Wabbajack/NexusAPI.cs b/Wabbajack/NexusAPI.cs
index 9e31010b..8a59b1a0 100644
--- a/Wabbajack/NexusAPI.cs
+++ b/Wabbajack/NexusAPI.cs
@@ -108,5 +108,36 @@ namespace Wabbajack
}
}
+ public class NexusFileInfo
+ {
+ public ulong file_id;
+ public string name;
+ public string version;
+ public ulong category_id;
+ public string category_name;
+ public bool is_primary;
+ public ulong size;
+ public string file_name;
+ public ulong uploaded_timestamp;
+ public DateTime uploaded_time;
+ public string mod_version;
+ public string external_virus_scan_url;
+ public string description;
+ public ulong size_kb;
+ public string changelog_html;
+ }
+
+
+ public static NexusFileInfo GetFileInfo(NexusMod mod, string apikey)
+ {
+ var url = $"https://api.nexusmods.com/v1/games/{ConvertGameName(mod.GameName)}/mods/{mod.ModID}/files/{mod.FileID}.json";
+ var client = BaseNexusClient(apikey);
+
+ using (var s = client.GetStreamSync(url))
+ {
+ return s.FromJSON();
+ }
+ }
+
}
}