mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add VectorPlexus and LoversLab stubs for old download formats
This commit is contained in:
parent
fa50b4cf4b
commit
2b1e0f73cf
61
Wabbajack.Lib/Downloaders/ADeprecatedDownloader.cs
Normal file
61
Wabbajack.Lib/Downloaders/ADeprecatedDownloader.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.Serialization.Json;
|
||||
using Wabbajack.Lib.Validation;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public class ADeprecatedDownloader<TDownloader, TState> : IDownloader
|
||||
where TDownloader: ADeprecatedDownloader<TDownloader, TState>
|
||||
where TState: ADeprecatedDownloader<TDownloader, TState>.State
|
||||
{
|
||||
public async Task<AbstractDownloadState?> GetDownloaderState(dynamic archiveINI, bool quickMode = false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task Prepare()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public class State : AbstractDownloadState
|
||||
{
|
||||
[JsonName("PrimaryKeyString")] private string _primaryKeyString { get; set; } = "";
|
||||
public override object[] PrimaryKey => _primaryKeyString.Split("|").Cast<object>().ToArray();
|
||||
|
||||
public override bool IsWhitelisted(ServerWhitelist whitelist)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Task<bool> Download(Archive a, AbsolutePath destination)
|
||||
{
|
||||
throw new Exception($"Downloader {this.GetType().FullName} is deprecated");
|
||||
}
|
||||
|
||||
public override async Task<bool> Verify(Archive archive, CancellationToken? token = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override IDownloader GetDownloader()
|
||||
{
|
||||
return DownloadDispatcher.GetInstance<TDownloader>();
|
||||
}
|
||||
|
||||
public override string? GetManifestURL(Archive a)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string[] GetMetaIni()
|
||||
{
|
||||
return new[] {"[General]", "downloaderIsDeprecated=True"};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public static List<Type> KnownSubTypes = new List<Type>
|
||||
{
|
||||
typeof(DeprecatedLoversLabDownloader.State),
|
||||
typeof(HTTPDownloader.State),
|
||||
typeof(GameFileSourceDownloader.State),
|
||||
typeof(GoogleDriveDownloader.State),
|
||||
|
12
Wabbajack.Lib/Downloaders/DeprecatedLoversLabDownloader.cs
Normal file
12
Wabbajack.Lib/Downloaders/DeprecatedLoversLabDownloader.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Wabbajack.Common.Serialization.Json;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public class DeprecatedLoversLabDownloader : ADeprecatedDownloader<DeprecatedLoversLabDownloader, DeprecatedLoversLabDownloader.State>
|
||||
{
|
||||
[JsonName("LoversLabDownloader")]
|
||||
public class State : ADeprecatedDownloader<DeprecatedLoversLabDownloader, DeprecatedLoversLabDownloader.State>.State
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using Wabbajack.Common.Serialization.Json;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public class DeprecatedVectorPlexusDownloader : ADeprecatedDownloader<DeprecatedVectorPlexusDownloader, DeprecatedVectorPlexusDownloader.State>
|
||||
{
|
||||
[JsonName("VectorPlexusDownloader")]
|
||||
public class State : ADeprecatedDownloader<DeprecatedVectorPlexusDownloader, DeprecatedVectorPlexusDownloader.State>.State
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
new YandexDownloader(),
|
||||
new HTTPDownloader(),
|
||||
new ManualDownloader(),
|
||||
new DeprecatedVectorPlexusDownloader(),
|
||||
new DeprecatedLoversLabDownloader(),
|
||||
};
|
||||
|
||||
public static readonly List<IUrlInferencer> Inferencers = new List<IUrlInferencer>()
|
||||
|
@ -27,7 +27,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
}
|
||||
|
||||
|
||||
[JsonName("LoversLabOAuthDownloader+State")]
|
||||
[JsonName("LoversLabOAuthDownloader")]
|
||||
public class State : AbstractIPS4OAuthDownloader<LoversLabOAuthDownloader, LoversLabOAuthDownloader.State>.State
|
||||
{
|
||||
public override IDownloader GetDownloader()
|
||||
|
@ -24,9 +24,9 @@ namespace Wabbajack
|
||||
/// <param name="This">Object to watch</param>
|
||||
/// <param name="property1">Expression path to the property to subscribe to</param>
|
||||
/// <returns></returns>
|
||||
public static IObservable<TRet> WhenAny<TSender, TRet>(
|
||||
public static IObservable<TRet?> WhenAny<TSender, TRet>(
|
||||
this TSender This,
|
||||
Expression<Func<TSender, TRet>> property1)
|
||||
Expression<Func<TSender, TRet?>> property1)
|
||||
where TSender : class
|
||||
{
|
||||
return This.WhenAny(property1, selector: x => x.GetValue());
|
||||
|
@ -347,8 +347,13 @@ namespace Wabbajack.Test
|
||||
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task CanLoadOldLLMeta()
|
||||
{
|
||||
var state = (DeprecatedLoversLabDownloader.State)(AbsolutePath.EntryPoint.Combine(@"Resources\LoversLabState.json").FromJson<Archive>().State);
|
||||
Assert.Equal("", state.PrimaryKeyString);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task VectorPlexusDownload()
|
||||
|
21
Wabbajack.Test/Resources/LoversLabState.json
Normal file
21
Wabbajack.Test/Resources/LoversLabState.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"$type": "Archive, Wabbajack.Lib",
|
||||
"Hash": "WLBnqZUBA/8=",
|
||||
"Meta": "[General]\ndirectURL=http://www.loverslab.com/files/file/5815-uslep-unpatch/?do=download&r=665125&confirm=1&t=1",
|
||||
"Name": "USLEP_UnPatch_V104.7z",
|
||||
"Size": 11962608,
|
||||
"State": {
|
||||
"$type": "LoversLabDownloader, Wabbajack.Lib",
|
||||
"FullURL": "/files/file/5815-uslep-unpatch/",
|
||||
"IsAttachment": false,
|
||||
"FileID": "665125",
|
||||
"FileName": "5815-uslep-unpatch",
|
||||
"URL": "http://www.loverslab.com/files/file/5815-uslep-unpatch",
|
||||
"Name": "USLEP UnPatch V1.04",
|
||||
"Author": "MadMansGun",
|
||||
"Version": "V1.04",
|
||||
"ImageURL": null,
|
||||
"Description": null,
|
||||
"PrimaryKeyString": "LoversLabDownloader+State|https://www.loverslab.com/|5815-uslep-unpatch|665125"
|
||||
}
|
||||
}
|
@ -25,6 +25,9 @@
|
||||
<None Update="Resources\test_ini01.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\LoversLabState.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user