mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
fixup some google download links so they properly download
This commit is contained in:
parent
f1e316f544
commit
1882b9227b
@ -46,7 +46,6 @@ namespace Wabbajack.Common
|
||||
|
||||
|
||||
public static string AppName = "Wabbajack";
|
||||
public static string HashCacheName = "Wabbajack.hash_cache";
|
||||
|
||||
public static HashSet<string> GameESMs = new HashSet<string>
|
||||
{"Skyrim.esm", "Update.esm", "Dawnguard.esm", "HearthFires.esm", "Dragonborn.esm"};
|
||||
|
@ -76,7 +76,10 @@ namespace Wabbajack.Common
|
||||
|
||||
public static void Status(string msg, int progress = 0)
|
||||
{
|
||||
_statusFn?.Invoke(msg, progress);
|
||||
if (WorkQueue.CustomReportFn != null)
|
||||
WorkQueue.CustomReportFn(progress, msg);
|
||||
else
|
||||
_statusFn?.Invoke(msg, progress);
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
var regex = new Regex("(?<=/uc\\?export=download&confirm=).*(?=;id=)");
|
||||
var confirm = regex.Match(result);
|
||||
var url = $"https://drive.google.com/uc?export=download&confirm={confirm}&id={Id}";
|
||||
var http_state = new HTTPDownloader.State {Url = url};
|
||||
var http_state = new HTTPDownloader.State {Url = url, Client = client};
|
||||
return http_state;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,9 @@ namespace Wabbajack.Lib.Downloaders
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<string> Headers { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public HttpClient Client { get; set; }
|
||||
|
||||
public override bool IsWhitelisted(ServerWhitelist whitelist)
|
||||
{
|
||||
return whitelist.AllowedPrefixes.Any(p => Url.StartsWith(p));
|
||||
@ -67,7 +70,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public bool DoDownload(Archive a, string destination, bool download)
|
||||
{
|
||||
var client = new HttpClient();
|
||||
var client = Client ?? new HttpClient();
|
||||
client.DefaultRequestHeaders.Add("User-Agent", Consts.UserAgent);
|
||||
|
||||
if (Headers != null)
|
||||
|
@ -83,7 +83,6 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var entry = ar.GetEntry("modlist.json");
|
||||
using (var e = entry.Open())
|
||||
|
@ -64,7 +64,7 @@ namespace Wabbajack.UI
|
||||
WorkQueue.CustomReportFn = (progress, msg) => { DownloadProgress = progress; };
|
||||
|
||||
var state = DownloadDispatcher.ResolveArchive(_url);
|
||||
state.Download(new Archive() {Name = _downloadName}, _destination);
|
||||
state.Download(new Archive {Name = _downloadName}, _destination);
|
||||
|
||||
_parent.Result = DownloadWindow.WindowResult.Completed;
|
||||
_parent.Dispatcher.Invoke(() => _parent.Close());
|
||||
|
Loading…
Reference in New Issue
Block a user