Add TES4RU support back in

This commit is contained in:
Timothy Baldridge 2020-12-15 17:09:59 -07:00
parent b79830ad54
commit aa591bafa7
2 changed files with 12 additions and 3 deletions

View File

@ -68,6 +68,16 @@ namespace Wabbajack.Lib.Downloaders
IsAttachment = true
};
}
if (url.PathAndQuery.StartsWith("/files/download/") && long.TryParse(url.PathAndQuery.Split("/").Last(), out var fileId))
{
return new TState
{
FullURL = url.ToString(),
IsAttachment = true
};
}
if (!url.PathAndQuery.StartsWith("/files/file/"))
{
@ -76,6 +86,7 @@ namespace Wabbajack.Lib.Downloaders
absolute = false;
}
var id = HttpUtility.ParseQueryString(url.Query)["r"];
var file = absolute
? url.AbsolutePath.Split('/').Last(s => s != "")

View File

@ -407,13 +407,12 @@ namespace Wabbajack.Test
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
}
/* Site is down
[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/";
"directURL=https://tesall.ru/files/download/594545";
var state = (AbstractDownloadState)await DownloadDispatcher.ResolveArchive(ini.LoadIniString());
@ -431,7 +430,6 @@ namespace Wabbajack.Test
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
}
*/
/* WAITING FOR APPROVAL BY MODERATOR
[Fact]