CI / Go Backend (push) Canceled after 0s
初始化 monorepo: Go后端(7微服务) + Unity客户端(9模块) + 启动器 HTML5原型: Three.js 3D体素世界, Perlin噪声地形, 原版材质, 22种方块 Minecraft创造模式背包: 双栏布局, 拖拽移动物品, 方向性元件引脚 AI助搭策划文档 + 客户端/服务端骨架 + Docker Compose + CI
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using PCL.Core.Utils;
|
|
|
|
namespace PCL;
|
|
|
|
public class UpdatesRandomModel : IUpdateSource // 社区自己的更新系统格式
|
|
{
|
|
private readonly int _randIndex;
|
|
|
|
private readonly IEnumerable<IUpdateSource> _sources;
|
|
|
|
public UpdatesRandomModel(IEnumerable<IUpdateSource> sources)
|
|
{
|
|
_sources = sources;
|
|
var rand = new Random(DateTime.Now.Millisecond);
|
|
_randIndex = rand.Next(0, _sources.Count() - 1);
|
|
}
|
|
|
|
public string SourceName
|
|
{
|
|
get => _sources.ElementAt(_randIndex).SourceName;
|
|
set => _sources.ElementAt(_randIndex).SourceName = value;
|
|
}
|
|
|
|
public bool IsAvailable()
|
|
{
|
|
return _sources.ElementAt(_randIndex).IsAvailable();
|
|
}
|
|
|
|
public bool RefreshCache()
|
|
{
|
|
return _sources.ElementAt(_randIndex).RefreshCache();
|
|
}
|
|
|
|
public VersionDataModel GetLatestVersion(UpdateChannel channel, UpdateArch arch)
|
|
{
|
|
return _sources.ElementAt(_randIndex).GetLatestVersion(channel, arch);
|
|
}
|
|
|
|
public bool IsLatest(UpdateChannel channel, UpdateArch arch, SemVer currentVersion, int currentVersionCode)
|
|
{
|
|
return _sources.ElementAt(_randIndex).IsLatest(channel, arch, currentVersion, currentVersionCode);
|
|
}
|
|
|
|
public VersionAnnouncementDataModel GetAnnouncementList()
|
|
{
|
|
return _sources.ElementAt(_randIndex).GetAnnouncementList();
|
|
}
|
|
|
|
public List<ModLoader.LoaderBase> GetDownloadLoader(UpdateChannel channel, UpdateArch arch, string output)
|
|
{
|
|
return _sources.ElementAt(_randIndex).GetDownloadLoader(channel, arch, output);
|
|
}
|
|
} |