2024-07-25 13:18:43 +00:00
|
|
|
|
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;
|
2024-07-26 10:50:25 +00:00
|
|
|
|
using System.Collections.ObjectModel;
|
2024-07-25 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
// 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>
|
|
|
|
|
|
2024-07-26 10:50:25 +00:00
|
|
|
|
public sealed partial class ModulePage : WindowEx
|
2024-07-25 13:18:43 +00:00
|
|
|
|
{
|
2024-07-26 10:50:25 +00:00
|
|
|
|
public static List<ModulePage> ModulePageList = new();
|
|
|
|
|
public ObservableCollection<string> ScreenshotsList =new();
|
|
|
|
|
public ModInfo.Data Mod { get; set; } = new();
|
2024-07-25 13:18:43 +00:00
|
|
|
|
public ModulePage(string v)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2024-07-26 10:50:25 +00:00
|
|
|
|
ExtendsContentIntoTitleBar = true;
|
2024-07-25 13:18:43 +00:00
|
|
|
|
init(v);
|
|
|
|
|
}
|
|
|
|
|
private async void init(string v)
|
|
|
|
|
{
|
|
|
|
|
//string json = "\r\n{\"code\":0,\"message\":\"<22><>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>\",\"data\":{\"id\":\"585886886883885357567508566896\",\"name\":\"<22><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>5.0\",\"describe\":\"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\",\"icon\":\"\",\"tags\":\"[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]\",\"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);
|
|
|
|
|
}
|
2024-07-26 10:50:25 +00:00
|
|
|
|
Title = Mod.Name;
|
2024-07-25 13:18:43 +00:00
|
|
|
|
var l = " | ";
|
|
|
|
|
title_b.Text = "<22><>λ<EFBFBD><CEBB>" + Mod.UnitNumber + l + Mod.DownloadNumber + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + l + "<22>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>" + Mod.VersionName;
|
|
|
|
|
title_c.Text = "<22><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:" + Mod.CreationTime + " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + Mod.UpdateTime;
|
2024-07-26 10:50:25 +00:00
|
|
|
|
|
|
|
|
|
var ScrList = Mod.Screenshots.Split(",");
|
|
|
|
|
foreach (var s in ScrList)
|
|
|
|
|
{
|
|
|
|
|
gj.sc(s);
|
|
|
|
|
if (string.IsNullOrEmpty(s))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
ScreenshotsList.Add(s.Replace("..", wl.api));
|
|
|
|
|
}
|
|
|
|
|
if (ScreenshotsList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
fliptext.Visibility = Visibility.Visible;
|
|
|
|
|
flipview.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fliptext.Visibility = Visibility.Collapsed;
|
|
|
|
|
flipview.Visibility = Visibility.Collapsed;
|
|
|
|
|
}
|
2024-07-25 13:18:43 +00:00
|
|
|
|
grid.DataContext = this; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-26 10:50:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void WindowEx_SizeChanged(object sender, WindowSizeChangedEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
gj.sc(Width);
|
|
|
|
|
DescriptionText.Width = Width-50;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void WindowEx_Closed(object sender, WindowEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ڹر<DAB9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
ModulePageList.Remove(this);
|
|
|
|
|
}
|
2024-07-25 13:18:43 +00:00
|
|
|
|
}
|