mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
support for ModDB, and more testing fixes
This commit is contained in:
parent
dffe2a68de
commit
61862ae7dd
@ -19,9 +19,11 @@ namespace Wabbajack.Common
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var platformType = Environment.Is64BitOperatingSystem ? "x64" : "x86";
|
var platformType = Environment.Is64BitOperatingSystem ? "x64" : "x86";
|
||||||
var headerString = $"Wabbajack/{Assembly.GetEntryAssembly().GetName().Version} ({Environment.OSVersion.VersionString}; {platformType}) {RuntimeInformation.FrameworkDescription}";
|
var headerString = $"{AppName}/{Assembly.GetEntryAssembly().GetName().Version} ({Environment.OSVersion.VersionString}; {platformType}) {RuntimeInformation.FrameworkDescription}";
|
||||||
return headerString;
|
return headerString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String AppName = "Automaton";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
@ -290,6 +291,30 @@ namespace Wabbajack
|
|||||||
ModID = general.modID
|
ModID = general.modID
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (general.directURL != null && general.directURL.StartsWith("https://www.dropbox.com/"))
|
||||||
|
{
|
||||||
|
var uri = new UriBuilder((string)general.directURL);
|
||||||
|
var query = HttpUtility.ParseQueryString(uri.Query);
|
||||||
|
|
||||||
|
if (query.GetValues("dl").Count() > 0)
|
||||||
|
query.Remove("dl");
|
||||||
|
|
||||||
|
query.Set("dl", "1");
|
||||||
|
|
||||||
|
uri.Query = query.ToString();
|
||||||
|
|
||||||
|
result = new DirectURLArchive()
|
||||||
|
{
|
||||||
|
URL = uri.ToString()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (general.directURL != null && general.directURL.StartsWith("https://www.moddb.com/downloads/start"))
|
||||||
|
{
|
||||||
|
result = new MODDBArchive()
|
||||||
|
{
|
||||||
|
URL = general.directURL
|
||||||
|
};
|
||||||
|
}
|
||||||
else if (general.directURL != null)
|
else if (general.directURL != null)
|
||||||
{
|
{
|
||||||
result = new DirectURLArchive()
|
result = new DirectURLArchive()
|
||||||
@ -338,13 +363,15 @@ namespace Wabbajack
|
|||||||
IgnoreStartsWith("logs\\"),
|
IgnoreStartsWith("logs\\"),
|
||||||
IgnoreStartsWith("downloads\\"),
|
IgnoreStartsWith("downloads\\"),
|
||||||
IgnoreStartsWith("webcache\\"),
|
IgnoreStartsWith("webcache\\"),
|
||||||
IgnoreStartsWith("nxmhandler."),
|
|
||||||
IgnoreEndsWith(".pyc"),
|
IgnoreEndsWith(".pyc"),
|
||||||
IgnoreOtherProfiles(),
|
IgnoreOtherProfiles(),
|
||||||
IgnoreDisabledMods(),
|
IgnoreDisabledMods(),
|
||||||
IncludeThisProfile(),
|
IncludeThisProfile(),
|
||||||
// Ignore the ModOrganizer.ini file it contains info created by MO2 on startup
|
// Ignore the ModOrganizer.ini file it contains info created by MO2 on startup
|
||||||
IgnoreStartsWith("ModOrganizer.ini"),
|
IgnoreStartsWith("ModOrganizer.ini"),
|
||||||
|
IgnoreStartsWith(Path.Combine(Consts.GameFolderFilesDir, "Data")),
|
||||||
|
IgnoreStartsWith(Path.Combine(Consts.GameFolderFilesDir, "Papyrus Compiler")),
|
||||||
|
IgnoreStartsWith(Path.Combine(Consts.GameFolderFilesDir, "Skyrim")),
|
||||||
IgnoreRegex(Consts.GameFolderFilesDir + "\\\\.*\\.bsa"),
|
IgnoreRegex(Consts.GameFolderFilesDir + "\\\\.*\\.bsa"),
|
||||||
IncludeModIniData(),
|
IncludeModIniData(),
|
||||||
DirectMatch(),
|
DirectMatch(),
|
||||||
|
@ -5,6 +5,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
|
||||||
@ -203,6 +204,10 @@ namespace Wabbajack
|
|||||||
var url = NexusAPI.GetNexusDownloadLink(archive as NexusMod, NexusAPIKey);
|
var url = NexusAPI.GetNexusDownloadLink(archive as NexusMod, NexusAPIKey);
|
||||||
DownloadURLDirect(archive, url);
|
DownloadURLDirect(archive, url);
|
||||||
}
|
}
|
||||||
|
else if (archive is MODDBArchive)
|
||||||
|
{
|
||||||
|
DownloadModDBArchive(archive, (archive as MODDBArchive).URL);
|
||||||
|
}
|
||||||
else if (archive is DirectURLArchive)
|
else if (archive is DirectURLArchive)
|
||||||
{
|
{
|
||||||
DownloadURLDirect(archive, (archive as DirectURLArchive).URL);
|
DownloadURLDirect(archive, (archive as DirectURLArchive).URL);
|
||||||
@ -214,6 +219,15 @@ namespace Wabbajack
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DownloadModDBArchive(Archive archive, string url)
|
||||||
|
{
|
||||||
|
var client = new HttpClient();
|
||||||
|
var result = client.GetStringSync(url);
|
||||||
|
var regex = new Regex("https:\\/\\/www\\.moddb\\.com\\/downloads\\/mirror\\/.*(?=\\\")");
|
||||||
|
var match = regex.Match(result);
|
||||||
|
DownloadURLDirect(archive, match.Value);
|
||||||
|
}
|
||||||
|
|
||||||
private void DownloadURLDirect(Archive archive, string url)
|
private void DownloadURLDirect(Archive archive, string url)
|
||||||
{
|
{
|
||||||
HttpClient client = new HttpClient();
|
HttpClient client = new HttpClient();
|
||||||
@ -225,7 +239,10 @@ namespace Wabbajack
|
|||||||
var stream = response.Content.ReadAsStreamAsync();
|
var stream = response.Content.ReadAsStreamAsync();
|
||||||
stream.Wait();
|
stream.Wait();
|
||||||
|
|
||||||
var header = response.Content.Headers.GetValues("Content-Length").FirstOrDefault();
|
string header = "1";
|
||||||
|
if (response.Content.Headers.Contains("Content-Length"))
|
||||||
|
header = response.Content.Headers.GetValues("Content-Length").FirstOrDefault();
|
||||||
|
|
||||||
long content_size = header != null ? long.Parse(header) : 1;
|
long content_size = header != null ? long.Parse(header) : 1;
|
||||||
|
|
||||||
var output_path = Path.Combine(DownloadFolder, archive.Name);
|
var output_path = Path.Combine(DownloadFolder, archive.Name);
|
||||||
|
@ -32,9 +32,11 @@ namespace Wabbajack
|
|||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
compiler.LoadArchives();
|
compiler.LoadArchives();
|
||||||
compiler.MO2Profile = "Lexy's Legacy of The Dragonborn Special Edition";
|
compiler.MO2Profile = "Basic Graphics and Fixes";
|
||||||
compiler.Compile();
|
compiler.Compile();
|
||||||
|
|
||||||
|
compiler.ModList.ToJSON("C:\\tmp\\modpack.json");
|
||||||
|
|
||||||
var installer = new Installer(compiler.ModList, "c:\\tmp\\install\\", msg => context.LogMsg(msg));
|
var installer = new Installer(compiler.ModList, "c:\\tmp\\install\\", msg => context.LogMsg(msg));
|
||||||
installer.Install();
|
installer.Install();
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ namespace Wabbajack
|
|||||||
};
|
};
|
||||||
|
|
||||||
_websocket.Connect();
|
_websocket.Connect();
|
||||||
_websocket.Send("{\"id\": \"" + guid + "\", \"appid\": \"Wabbajack\"}");
|
_websocket.Send("{\"id\": \"" + guid + "\", \"appid\": \""+ Consts.AppName+"\"}");
|
||||||
|
|
||||||
Process.Start($"https://www.nexusmods.com/sso?id={guid}&application=Wabbajack");
|
Process.Start($"https://www.nexusmods.com/sso?id={guid}&application=" + Consts.AppName);
|
||||||
|
|
||||||
api_key.Task.Wait();
|
api_key.Task.Wait();
|
||||||
var result = api_key.Task.Result;
|
var result = api_key.Task.Result;
|
||||||
@ -59,7 +59,7 @@ namespace Wabbajack
|
|||||||
_baseHttpClient.DefaultRequestHeaders.Add("User-Agent", Consts.UserAgent);
|
_baseHttpClient.DefaultRequestHeaders.Add("User-Agent", Consts.UserAgent);
|
||||||
_baseHttpClient.DefaultRequestHeaders.Add("apikey", apikey);
|
_baseHttpClient.DefaultRequestHeaders.Add("apikey", apikey);
|
||||||
_baseHttpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
|
_baseHttpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
_baseHttpClient.DefaultRequestHeaders.Add("Application-Name", "Wabbajack");
|
_baseHttpClient.DefaultRequestHeaders.Add("Application-Name", Consts.AppName);
|
||||||
_baseHttpClient.DefaultRequestHeaders.Add("Application-Version", $"{Assembly.GetEntryAssembly().GetName().Version}");
|
_baseHttpClient.DefaultRequestHeaders.Add("Application-Version", $"{Assembly.GetEntryAssembly().GetName().Version}");
|
||||||
return _baseHttpClient;
|
return _baseHttpClient;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
Loading…
Reference in New Issue
Block a user