63 lines
2.4 KiB
C#
63 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices.WindowsRuntime;
|
|
using Windows.Foundation;
|
|
using Windows.Foundation.Collections;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using Microsoft.UI.Xaml.Input;
|
|
using Microsoft.UI.Xaml.Media;
|
|
using Microsoft.UI.Xaml.Navigation;
|
|
using RustTools.muqing;
|
|
using Newtonsoft.Json;
|
|
using RustTools.DataList;
|
|
using RustTools.Core.Helpers;
|
|
|
|
// To learn more about WinUI, the WinUI project structure,
|
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
|
|
|
namespace RustTools.Views;
|
|
|
|
/// <summary>
|
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
/// </summary>
|
|
|
|
public sealed partial class ModulePage : Window
|
|
{
|
|
public ModInfo.Data Mod { get; set; }
|
|
public ModulePage(string v)
|
|
{
|
|
InitializeComponent();
|
|
init(v);
|
|
}
|
|
private async void init(string v)
|
|
{
|
|
//string json = "\r\n{\"code\":0,\"message\":\"获取成功。\",\"data\":{\"id\":\"585886886883885357567508566896\",\"name\":\"升级模组5.0\",\"describe\":\"。?,。???\",\"icon\":\"\",\"tags\":\"[,。!。]\",\"screenshots\":\"\",\"developer\":\"SDL_13964\",\"link\":\"..\\/user\\/SDL_13964\\/mods\\/585886886883885357567508566896\\/585886886883885357567508566896.rwmod\",\"downloadNumber\":\"366\",\"versionNumber\":\"1\",\"versionName\":\"1.14514\",\"updateTime\":\"2022-07-20 14:20:09\",\"creationTime\":\"2022-07-20 14:20:09\",\"unitNumber\":\"909\",\"hidden\":\"0\",\"coinNumber\":\"1\",\"minVersion\":\"\"}}";
|
|
|
|
var json = await ApiFox.mod.getInfo("", v);
|
|
var a = JsonConvert.DeserializeObject<ModInfo>(json);
|
|
if (a != null)
|
|
{
|
|
Mod = a.data;
|
|
if (Mod.IconUrl.Equals(""))
|
|
{
|
|
Mod.IconUrl = "/Assets/image/image_106.svg";
|
|
}
|
|
else
|
|
{
|
|
Mod.IconUrl = Mod.IconUrl.Replace("..", wl.api);
|
|
}
|
|
|
|
gj.sc(Mod.Name);
|
|
var l = " | ";
|
|
title_b.Text = "单位数" + Mod.UnitNumber + l + Mod.DownloadNumber + "次下载" + l + "版本名称" + Mod.VersionName;
|
|
title_c.Text = "发布时间:" + Mod.CreationTime + " 最近更新:" + Mod.UpdateTime;
|
|
grid.DataContext = this; // 设置数据上下文
|
|
}
|
|
}
|
|
}
|