mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add TESAll download support
This commit is contained in:
parent
8c70771f0e
commit
c5dd1d6388
@ -38,6 +38,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
typeof(VectorPlexusDownloader.State),
|
typeof(VectorPlexusDownloader.State),
|
||||||
typeof(DeadlyStreamDownloader.State),
|
typeof(DeadlyStreamDownloader.State),
|
||||||
typeof(TESAllianceDownloader.State),
|
typeof(TESAllianceDownloader.State),
|
||||||
|
typeof(TESAllDownloader.State),
|
||||||
typeof(BethesdaNetDownloader.State),
|
typeof(BethesdaNetDownloader.State),
|
||||||
typeof(YouTubeDownloader.State),
|
typeof(YouTubeDownloader.State),
|
||||||
typeof(WabbajackCDNDownloader.State)
|
typeof(WabbajackCDNDownloader.State)
|
||||||
|
@ -19,8 +19,8 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
where TState : AbstractIPS4Downloader<TDownloader, TState>.State<TDownloader>, new()
|
where TState : AbstractIPS4Downloader<TDownloader, TState>.State<TDownloader>, new()
|
||||||
where TDownloader : IDownloader
|
where TDownloader : IDownloader
|
||||||
{
|
{
|
||||||
protected AbstractIPS4Downloader(Uri loginUri, string encryptedKeyName, string cookieDomain)
|
protected AbstractIPS4Downloader(Uri loginUri, string encryptedKeyName, string cookieDomain, string loginCookie = "ips4_member_id")
|
||||||
: base(loginUri, encryptedKeyName, cookieDomain, "ips4_member_id")
|
: base(loginUri, encryptedKeyName, cookieDomain, loginCookie)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +52,15 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
FileName = name
|
FileName = name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url.PathAndQuery.StartsWith("/files/getdownload"))
|
||||||
|
{
|
||||||
|
return new TState
|
||||||
|
{
|
||||||
|
FullURL = url.ToString(),
|
||||||
|
IsAttachment = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!url.PathAndQuery.StartsWith("/files/file/"))
|
if (!url.PathAndQuery.StartsWith("/files/file/"))
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
new DeadlyStreamDownloader(),
|
new DeadlyStreamDownloader(),
|
||||||
new BethesdaNetDownloader(),
|
new BethesdaNetDownloader(),
|
||||||
new TESAllianceDownloader(),
|
new TESAllianceDownloader(),
|
||||||
|
new TESAllDownloader(),
|
||||||
new YouTubeDownloader(),
|
new YouTubeDownloader(),
|
||||||
new WabbajackCDNDownloader(),
|
new WabbajackCDNDownloader(),
|
||||||
new HTTPDownloader(),
|
new HTTPDownloader(),
|
||||||
|
22
Wabbajack.Lib/Downloaders/TESAllDownloader.cs
Normal file
22
Wabbajack.Lib/Downloaders/TESAllDownloader.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using Wabbajack.Common.Serialization.Json;
|
||||||
|
|
||||||
|
namespace Wabbajack.Lib.Downloaders
|
||||||
|
{
|
||||||
|
public class TESAllDownloader : AbstractIPS4Downloader<TESAllDownloader, TESAllDownloader.State>
|
||||||
|
{
|
||||||
|
#region INeedsDownload
|
||||||
|
public override string SiteName => "TESALL";
|
||||||
|
public override Uri SiteURL => new Uri("http://tesall.ru");
|
||||||
|
public override Uri IconUri => new Uri("http://tesall.ru/favicon.ico");
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public TESAllDownloader() : base(new Uri("https://tesall.ru/index.php?app=core&module=global§ion=login"),
|
||||||
|
"tesall", "tesall.ru", "member_id")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonName("TESAllDownloader")]
|
||||||
|
public class State : State<TESAllDownloader>{}
|
||||||
|
}
|
||||||
|
}
|
@ -362,6 +362,30 @@ namespace Wabbajack.Test
|
|||||||
|
|
||||||
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task TESAllDownloader()
|
||||||
|
{
|
||||||
|
await DownloadDispatcher.GetInstance<TESAllDownloader>().Prepare();
|
||||||
|
const string ini = "[General]\n" +
|
||||||
|
"directURL=https://tesall.ru/files/getdownload/594545-wabbajack-test-file/";
|
||||||
|
|
||||||
|
var state = (AbstractDownloadState)await DownloadDispatcher.ResolveArchive(ini.LoadIniString());
|
||||||
|
|
||||||
|
Assert.NotNull(state);
|
||||||
|
|
||||||
|
var converted = RoundTripState(state);
|
||||||
|
Assert.True(await converted.Verify(new Archive(state: null!) { Size = 20}));
|
||||||
|
await using var filename = new TempFile();
|
||||||
|
|
||||||
|
Assert.True(converted.IsWhitelisted(new ServerWhitelist { AllowedPrefixes = new List<string>() }));
|
||||||
|
|
||||||
|
await converted.Download(new Archive(state: null!) { Name = "TESAll Test.zip" }, filename.Path);
|
||||||
|
|
||||||
|
Assert.Equal(Hash.FromBase64("eSIyd+KOG3s="), await filename.Path.FileHashAsync());
|
||||||
|
|
||||||
|
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
||||||
|
}
|
||||||
|
|
||||||
/* WAITING FOR APPROVAL BY MODERATOR
|
/* WAITING FOR APPROVAL BY MODERATOR
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Loading…
Reference in New Issue
Block a user