Skip to content

Commit

Permalink
add info.json
Browse files Browse the repository at this point in the history
  • Loading branch information
XeronOwO committed Jan 15, 2024
1 parent 90d2a3c commit 4a22cea
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
22 changes: 21 additions & 1 deletion MiHoMo/MiHoMoAPI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MiHoMo.Models.Achievements;
using MiHoMo.Models;
using MiHoMo.Models.Achievements;
using MiHoMo.Models.Avatars;
using MiHoMo.Models.CharacterPromotions;
using MiHoMo.Models.CharacterRanks;
Expand Down Expand Up @@ -544,6 +545,24 @@ public async Task InitSimulatedEventMapAsync()

#endregion

#region API信息

/// <summary>
/// API信息
/// </summary>
public APIInfo APIInfo { get; private set; } = null;

/// <summary>
/// 初始化API信息
/// </summary>
/// <returns>任务</returns>
public async Task InitAPIInfoAsync()
{
APIInfo = await GetDataFromUrlAsync<APIInfo>($"{_indexBaseUrl}/info.json");
}

#endregion

/// <summary>
/// 初始化所有资源,包括成就、头像、角色晋阶等<br/>当然,你也可以根据需要选择性地初始化,从而使加载更快
/// </summary>
Expand Down Expand Up @@ -574,6 +593,7 @@ public async Task InitAllResourcesAsync()
await InitSimulatedBlockMapAsync();
await InitSimulatedCurioMapAsync();
await InitSimulatedEventMapAsync();
await InitAPIInfoAsync();
}

#endregion
Expand Down
31 changes: 31 additions & 0 deletions MiHoMo/Models/APIInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace MiHoMo.Models
{
/// <summary>
/// API信息
/// </summary>
public class APIInfo
{
/// <summary>
/// 版本
/// </summary>
[JsonProperty("version")]
public string Version { get; set; }

/// <summary>
/// 推荐目录
/// </summary>
[JsonProperty("folder")]
public string Folder { get; set; }

/// <summary>
/// 时间戳
/// </summary>
[JsonProperty("timestamp")]
public long Timestamp { get; set; }
}
}

0 comments on commit 4a22cea

Please sign in to comment.