Skip to main content
Version: 2022.1

自定义下载地址

如果想替换掉默认的下载地址,可以使用自定下载器来实现。

示例

如何使用自定义下载器?请参考以下代码的实现方式:

public class CustomDownloader
{
// A Test behaves as an ordinary method
[Test]
public void CustomDownloadURLSimplePasses()
{
Downloader.DownloadURL = "http://127.0.0.1/Bundles";
Downloader.CustomDownloader += TestCustomDownloader;
var url = Downloader.GetDownloadURL("Arts");
Assert.AreEqual($"{Downloader.DownloadURL}/Arts_hash", url);
url = Downloader.GetDownloadURL("Data");
Assert.AreEqual($"{Downloader.DownloadURL}/Data", url);
}

private static string TestCustomDownloader(string arg)
{
return arg.Contains("Arts") ? $"{Downloader.DownloadURL}/{arg}_hash" : $"{Downloader.DownloadURL}/{arg}";
}
}