();
12 | Thread? thread;
13 | public PluginInfo PluginInfo { get; set; }
14 | public void Register()
15 | {
16 | if(PluginInfo != null)
17 | {
18 | Start();
19 | Runnables.Add(this);
20 | }
21 | }
22 | public virtual void Run() { }
23 | public void Start()
24 | {
25 | thread = new Thread(new ThreadStart(Run));
26 | thread.Start();
27 | }
28 | public void Stop()
29 | {
30 | if(thread != null) { thread.Abort(); }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/PluginLoader/RunnableHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PluginLoader
8 | {
9 | [AttributeUsage(AttributeTargets.Class)]
10 | public class RunnableHandler : Attribute
11 | {
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/PluginLoader/util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 | using System.Threading.Tasks;
7 |
8 | namespace PluginLoader
9 | {
10 | public static class util
11 | {
12 | ///
13 | /// 获取文件名
14 | ///
15 | ///
16 | /// 文件路径
17 | ///
18 | ///
19 | /// 文件名
20 | ///
21 | [Obsolete]
22 | public static string GetFileName(string Path)
23 | {
24 | string[] tmp = Path.Split('\\');
25 | return tmp[tmp.Length - 1];
26 | }
27 | ///
28 | /// 获取无后缀名文件名
29 | ///
30 | ///
31 | /// 文件名
32 | ///
33 | ///
34 | /// 无后缀名文件名
35 | ///
36 | [Obsolete]
37 | public static string FileName(string FileName)
38 | {
39 | string[] tmp = FileName.Split('.');
40 | string tmp2 = "";
41 | for(int i = 0; i < tmp.Length - 1; i++)
42 | {
43 | tmp2 += tmp[i];
44 | }
45 | return tmp2;
46 | }
47 | public static bool IsGuidByReg(string strSrc)
48 | {
49 | Regex reg = new Regex("^{[A-F0-9]{8}(-[A-F0-9]{4}){3}-[A-F0-9]{12}}$", RegexOptions.Compiled);
50 | return reg.IsMatch(strSrc);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | # WonderLab
8 |
9 | 下一代跨平台 Minecraft 启动器
10 |
11 |
12 |
13 | 
14 | 
15 | 
16 | 
17 |
18 | ## 介绍
19 |
20 | WonderLab是一个跨平台 Minecraft 启动器,支持自动更新,Mod安装,Java运行时安装,并支持Windows,MacOS,Linux等操作系统,同时兼容x86,x64,Arm系统架构。
21 |
22 | ## 下载
23 |
24 | 目前我们开放了Windows,MacOS,Linux的下载链接,你可以在 [这里](https://github.com/Blessing-Studio/WonderLab/releases) 下载你想要的版本。
25 | 你可以通过加入 [WonderLab内部测试群](https://jq.qq.com/?_wv=1027&k=kU7khFu6) 来获取内测版本。
26 |
27 | ## 引用
28 |
29 | #### Avalonia
30 |
31 | Avalonia是一个跨平台UI框架,提供灵活的样式系统并支持广泛的操作系统。
32 | [官网](https://www.avaloniaui.net/)
33 | [GitHub](https://github.com/AvaloniaUI/Avalonia)
34 |
35 | #### Newtonsoft.Json
36 |
37 | 流行的 .NET 高性能 JSON 框架。
38 | [官网](https://www.newtonsoft.com/json)
39 | [GitHub](https://github.com/JamesNK/Newtonsoft.Json)
40 |
41 | #### MinecraftLaunch
42 |
43 | 一个由C#编写的跨平台模块化 Minecraft 启动核心。
44 | [GitHub](https://github.com/Blessing-Studio/MinecraftLaunch)
45 |
46 | #### Natsurainko.FluentCore
47 |
48 | 一个高效的模块化的 Minecraft 启动核心。
49 | [GitHub](https://github.com/Xcube-Studio/Natsurainko.FluentCore)
50 |
51 | #### FluentAvalonia
52 |
53 | 将更多的 Fluent 设计和 WinUI 控件引入 Avalonia。
54 | [GitHub](https://github.com/amwx/FluentAvalonia)
55 |
56 | #### JavaSearcher
57 | 一个简单的java路径和版本搜索工具。
58 | [Github](https://github.com/HainanWinter-l/JavaSearcher)
59 |
60 | ## 鸣谢
61 |
62 | #### MCBBS
63 |
64 | 提供 MCBBS下载源。
65 | [MCBBS官网](https://www.mcbbs.net/)
66 |
67 | #### bangbang93
68 |
69 | 提供BMCLAPI镜像源。
70 | [爱发电](https://afdian.net/a/bangbang93)
71 | [GitHub](https://github.com/bangbang93)
72 |
73 | [GitHub](https://github.com/duhiqc)
74 | [BiliBili](https://space.bilibili.com/1934472678?spm_id_from=333.1007.0.0)
75 |
76 | #### 帮助测试的群友
77 |
78 | 他们帮忙找到了WonderLab的很多Bug。
79 |
80 | ## 开发团队
81 |
82 | #### [mail_set](https://mailset.top)
83 |
84 | 测试修复并编译Linux版本。
85 |
86 | #### [Ddggdd135](https://github.com/JWJUN233233)
87 |
88 | 后端主要编写成员
89 |
90 | #### [hei-shou](https://github.com/JWJUN233233)
91 |
92 | 前端主要设计、编写成员
93 |
--------------------------------------------------------------------------------
/WonderLab.Desktop/WonderLab.Desktop.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | osx-x64;linux-x64;win-x64
7 | enable
8 | enable
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/WonderLab/.github/ISSUE_TEMPLATE/bug.yml:
--------------------------------------------------------------------------------
1 | name: Bug 反馈
2 | description: 反馈 WonderLab 使用中遇到的问题和 Bug
3 | labels:
4 | - "🐞 Bug"
5 |
6 | body:
7 | - type: markdown
8 | attributes:
9 | value: |
10 | 感谢你使用 WonderLab 问题反馈系统!
11 |
12 | 如果此问题反馈不符合模板,将会被管理员无条件关闭。
13 | - type: checkboxes
14 | attributes:
15 | label: '❗ 检查表'
16 | description: 在反馈前, 请确认你已经做了下面这些事情
17 | options:
18 | - label: 搜索了已有的 [issues](https://github.com/Blessing-Studio/WonderLab/issues) 列表中是否有相似问题
19 | required: true
20 | - label: 查看 [Releases](https://github.com/Blessing-Studio/WonderLab/releases) 中最新版是否已修复你所遇到的问题
21 | required: true
22 |
23 | - type: textarea
24 | id: issue-description
25 | attributes:
26 | label: 问题描述
27 | description: 在此详细描述你遇到的问题
28 | validations:
29 | required: true
30 |
31 | - type: dropdown
32 | id: reproducibility
33 | attributes:
34 | label: 问题复现率
35 | description: 选择问题发生的概率
36 | options:
37 | - 无法复现
38 | - 低偶发
39 | - 高偶发
40 | - 必现
41 | validations:
42 | required: true
43 |
44 | - type: textarea
45 | id: reproduce
46 | attributes:
47 | label: 复现步骤
48 | description: 在这里简略说明如何让这个问题再次发生
49 | placeholder: |
50 | 在这里简略说明如何让这个问题再次发生
51 | 可使用 1. 2. 3. 的列表格式,或其他任意恰当的格式
52 | 如果你不确定如何复现, 请尽量描述发生当时的情景
53 | validations:
54 | required: true
55 |
56 | - type: dropdown
57 | id: server-platform-type
58 | attributes:
59 | label: 操作系统版本
60 | description: |
61 | 选择你正在使用的操作系统
62 | options:
63 | - Windows
64 | - Linux
65 | - Mac
66 | validations:
67 | required: true
68 |
69 | - type: textarea
70 | id: slimefun-version
71 | validations:
72 | required: true
73 | attributes:
74 | label: WonderLab版本
75 | description: |
76 | **"最新版" 不是版本号,请填写一个确切的版本号!**
77 | #如果你不太确定,可以截图 "" 的输出内容并截图,记得截全。
78 | placeholder: '1.0.1.0'
79 |
80 | - type: textarea
81 | id: other-plugin
82 | attributes:
83 | label: 插件信息
84 | description: 如果这个问题与你的其他插件有关,请提供你的WonderLab插件列表。
85 | placeholder: |
86 | 插件: 版本
87 |
88 | - type: textarea
89 | id: additional
90 | attributes:
91 | label: 补充信息
92 | description: 如有必要,你可以在下文继续添加其他信息
93 |
--------------------------------------------------------------------------------
/WonderLab/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 0.1.220-*
6 | all
7 |
8 |
9 |
--------------------------------------------------------------------------------
/WonderLab/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Base/TaskBase.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Threading;
3 | using FluentAvalonia.UI.Controls;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using WonderLab.Modules.Controls;
11 |
12 | namespace WonderLab.Modules.Base
13 | {
14 | ///
15 | /// 异步操作基类
16 | ///
17 | public class TaskBase : Page
18 | {
19 | ///
20 | /// 将代码调到非ui线程
21 | ///
22 | ///
23 | public static async void RunAsync(Action action)=>
24 | await Task.Run(action);
25 | ///
26 | /// 将代码调到非ui线程(可访问ui线程)
27 | ///
28 | ///
29 | public static async void InvokeAsync(Action action) =>
30 | await Task.Run(async () => await Dispatcher.UIThread.InvokeAsync(action));
31 |
32 | //public static async Task InvokeAsync(Func action)
33 | //{
34 | // return await Task.Run(async () => { return await Dispatcher.UIThread.InvokeAsync(action); });
35 | //}
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Base/ViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Platform;
2 | using Avalonia;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Runtime.CompilerServices;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using ReactiveUI;
12 | using System.Diagnostics;
13 |
14 | namespace WonderLab.Modules.Base
15 | {
16 | public class ViewModelBase : ReactiveObject, INotifyPropertyChanged
17 | {
18 | public event PropertyChangedEventHandler PropertyChanged;
19 |
20 | protected string GetAssemblyResource(string name)
21 | {
22 | var assets = AvaloniaLocator.Current.GetService();
23 | using (var stream = assets.Open(new Uri(name)))
24 | using (StreamReader reader = new StreamReader(stream))
25 | {
26 | return reader.ReadToEnd();
27 | }
28 | }
29 |
30 | protected bool RaiseAndSetIfChanged(ref T field, T value, [CallerMemberName] string propertyName = "")
31 | {
32 | if (!EqualityComparer.Default.Equals(field, value))
33 | {
34 | field = value;
35 | BackgroundWorker worker = new();
36 | worker.DoWork += (_, _) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
37 | worker.RunWorkerAsync();
38 | //Debug.WriteLine($"Value:{value}");
39 | return true;
40 | }
41 | return false;
42 | }
43 |
44 | protected void RaisePropertyChanged(string propName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Const/InfoConst.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blessing-Studio/WonderLab/953f62b11e0bd6d8a7782884ccb288ecc2924f07/WonderLab/Modules/Const/InfoConst.cs
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Frame.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Collections;
2 | using Avalonia.Controls.Presenters;
3 | using Avalonia.Controls.Primitives;
4 | using Avalonia.Controls;
5 | using Avalonia.Logging;
6 | using Avalonia.Threading;
7 | using Avalonia;
8 | using DynamicData;
9 | using FluentAvalonia.UI.Controls;
10 | using FluentAvalonia.UI.Media.Animation;
11 | using FluentAvalonia.UI.Navigation;
12 | using System;
13 | using System.Collections.Generic;
14 | using System.Collections.Specialized;
15 | using System.IO;
16 | using System.Linq;
17 | using System.Reflection.Metadata;
18 | using System.Text;
19 | using System.Threading.Tasks;
20 | using System.Runtime.CompilerServices;
21 |
22 | namespace WonderLab.Modules.Controls
23 | {
24 | public partial class FrameX : Frame
25 | {
26 | public void NavigateTo(Page page)
27 | {
28 | page.OnNavigatedTo();
29 | }
30 |
31 | public bool Navigate(Page sourcePageType) => Navigate(sourcePageType, sourcePageType.GetType(), null, null);
32 |
33 | public bool Navigate(Page sourcePageType, object parameter) => Navigate(sourcePageType, sourcePageType.GetType(),parameter, null);
34 |
35 | public bool Navigate(Page sourcePageType, Type type, object parameter, NavigationTransitionInfo infoOverride)
36 | {
37 | //sourcePageType.OnNavigatedTo();
38 | var v = Navigate(type, parameter, infoOverride);
39 | return v;
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/FrontalSkinX.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.Primitives;
3 | using Avalonia.Media;
4 | using Avalonia.Media.Imaging;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.IO;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using System.Windows.Input;
12 |
13 | namespace WonderLab.Modules.Controls
14 | {
15 | public class FrontalSkinX : TemplatedControl
16 | {
17 | public Bitmap HeadSource
18 | {
19 | get => GetValue(HeadSourceProperty);
20 | set => SetValue(HeadSourceProperty, value);
21 | }
22 |
23 | public Bitmap BodySource
24 | {
25 | get => GetValue(BodySourceProperty);
26 | set => SetValue(BodySourceProperty, value);
27 | }
28 |
29 | public Bitmap LeftArmSource
30 | {
31 | get => GetValue(LeftArmSourceProperty);
32 | set => SetValue(LeftArmSourceProperty, value);
33 | }
34 |
35 | public Bitmap RightArmSource
36 | {
37 | get => GetValue(RightArmSourceProperty);
38 | set => SetValue(RightArmSourceProperty, value);
39 | }
40 |
41 | public Bitmap LeftLegSource
42 | {
43 | get => GetValue(LeftLegSourceProperty);
44 | set => SetValue(LeftLegSourceProperty, value);
45 | }
46 |
47 | public Bitmap RightLegSource
48 | {
49 | get => GetValue(RightLegSourceProperty);
50 | set => SetValue(RightLegSourceProperty, value);
51 | }
52 |
53 |
54 | public static readonly StyledProperty HeadSourceProperty =
55 | AvaloniaProperty.Register(nameof(HeadSource));
56 |
57 | public static readonly StyledProperty BodySourceProperty =
58 | AvaloniaProperty.Register(nameof(BodySource));
59 |
60 | public static readonly StyledProperty LeftArmSourceProperty =
61 | AvaloniaProperty.Register(nameof(LeftArmSource));
62 |
63 | public static readonly StyledProperty RightArmSourceProperty =
64 | AvaloniaProperty.Register(nameof(RightArmSource));
65 |
66 | public static readonly StyledProperty LeftLegSourceProperty =
67 | AvaloniaProperty.Register(nameof(LeftLegSource));
68 |
69 | public static readonly StyledProperty RightLegSourceProperty =
70 | AvaloniaProperty.Register(nameof(RightLegSource));
71 |
72 | protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
73 | {
74 | base.OnApplyTemplate(e);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/ScrollContentPresenter.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.Presenters;
3 | using Avalonia.Controls.Primitives;
4 | using Avalonia.Input;
5 | using Avalonia.Utilities;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Diagnostics;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using WonderLab.Views;
13 |
14 | namespace WonderLab.Modules.Controls
15 | {
16 | ///
17 | /// 滚动条显示修改版,此类将不再被重写
18 | ///
19 | public sealed class ScrollContentPresenterX : ScrollContentPresenter
20 | {
21 | ///
22 | /// 此方法将不再被重写
23 | ///
24 | ///
25 | protected sealed override void OnPointerWheelChanged(PointerWheelEventArgs e)
26 | {
27 | //base.OnPointerWheelChanged(e);
28 | //The Extent is scrollviewer Maximum of the contents and the Viewport is Container Control Maximum of the contents
29 | //Debug.WriteLine($"Extent Height:{Extent.Height} Extent Width:{Extent.Width}");
30 | //Debug.WriteLine($"Viewport Height:{Viewport.Height} Viewport Width:{Viewport.Width}");
31 | if (Extent.Height > Viewport.Height || Extent.Width > Viewport.Width)
32 | {
33 | var scrollable = Child as ILogicalScrollable;
34 | var isLogical = scrollable?.IsLogicalScrollEnabled == true;
35 |
36 | var x = Offset.X;
37 | var y = Offset.Y;
38 | var delta = e.Delta;
39 |
40 | // KeyModifiers.Shift should scroll in horizontal direction. This does not work on every platform.
41 | // If Shift-Key is pressed and X is close to 0 we swap the Vector.
42 | if (MathUtilities.IsZero(delta.X))
43 | {
44 | delta = new Vector(delta.Y, delta.X);
45 | }
46 |
47 | if (782 > Viewport.Width)
48 | {
49 | double width = isLogical ? scrollable!.ScrollSize.Width : 50;
50 | x += -delta.X * width;
51 | x = Math.Max(x, 0);
52 | x = Math.Min(x, Extent.Width - Viewport.Width);
53 | }
54 |
55 | Vector newOffset = new Vector(x, y);
56 | bool offsetChanged = newOffset != Offset;
57 | Offset = newOffset;
58 |
59 | e.Handled = offsetChanged;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Styles/CaptionButtonsStyle.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
16 |
19 |
20 |
40 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Styles/FrameXStyle.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
31 |
32 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Styles/FrontalSkinXStyle.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
65 |
66 |
78 |
79 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Styles/ListBoxStyle.axaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | Test
7 | Test
8 | Test
9 | Test
10 |
11 |
12 |
13 |
14 |
15 |
42 |
43 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Styles/UserCardStyle.axaml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blessing-Studio/WonderLab/953f62b11e0bd6d8a7782884ccb288ecc2924f07/WonderLab/Modules/Controls/Styles/UserCardStyle.axaml
--------------------------------------------------------------------------------
/WonderLab/Modules/Controls/Styles/UserListBoxItemStyle.axaml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blessing-Studio/WonderLab/953f62b11e0bd6d8a7782884ccb288ecc2924f07/WonderLab/Modules/Controls/Styles/UserListBoxItemStyle.axaml
--------------------------------------------------------------------------------
/WonderLab/Modules/Enum/DownType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Enum
8 | {
9 | public enum DownType
10 | {
11 | Vanllia,
12 | Forge,
13 | Optfine,
14 | Fabric,
15 | Mod,
16 | Java
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Enum/LaunchFailedType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Enum
8 | {
9 | public enum LaunchFailedType
10 | {
11 | ///
12 | /// 资源补全时的异常
13 | ///
14 | CompletionedFailed = 1,
15 | ///
16 | /// 启动失败时的异常
17 | ///
18 | LaunchFailed,
19 | ///
20 | /// 游戏崩溃产生的异常
21 | ///
22 | CrashFailed
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Enum/LogTyoe.cs:
--------------------------------------------------------------------------------
1 | using DynamicData.Kernel;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace WonderLab.Modules.Enum
9 | {
10 | public enum LogTyoe
11 | {
12 | Error,
13 | Info,
14 | Warning,
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Interface/IPackToolkit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.Immutable;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace WonderLab.Modules.Interface
10 | {
11 | ///
12 | /// 包工具接口
13 | ///
14 | ///
15 | public interface IPackToolkit
16 | {
17 | public Task> LoadAllAsync();
18 | public Task> MoveLoadAllAsync(IEnumerable paths);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Interface/ITask.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace WonderLab.Modules.Interface
9 | {
10 | public interface ITask : IControl { }
11 | }
12 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Media/DrillInNavigationTransitionInfoX.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Animation;
3 | using Avalonia.Animation.Easings;
4 | using Avalonia.Media;
5 | using Avalonia.Styling;
6 | using Avalonia.VisualTree;
7 | using FluentAvalonia.UI.Media.Animation;
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Text;
12 | using System.Threading.Tasks;
13 |
14 | namespace WonderLab.Modules.Media
15 | {
16 | public sealed class DrillInNavigationTransitionInfoX : NavigationTransitionInfo
17 | {
18 | public bool IsReversed { get; set; } = false;
19 | public async override void RunAnimation(Animatable ctrl)
20 | {
21 | var animation = new Avalonia.Animation.Animation
22 | {
23 | Easing = new SplineEasing(0.1, 0.9, 0.2, 1.0),
24 | Children =
25 | {
26 | new KeyFrame
27 | {
28 | Setters =
29 | {
30 | new Setter(Visual.OpacityProperty, 0.0),
31 | //new Setter(ScaleTransform.ScaleXProperty, IsReversed ? 1.5 : 0.0),
32 | new Setter(ScaleTransform.ScaleYProperty, IsReversed ? 1.5 : 0.0)
33 | },
34 | Cue = new Cue(0d)
35 | },
36 | new KeyFrame
37 | {
38 | Setters =
39 | {
40 | new Setter(Visual.OpacityProperty, 1.0),
41 | new Setter(ScaleTransform.ScaleXProperty, IsReversed ? 1.0 : 1.0),
42 | new Setter(ScaleTransform.ScaleYProperty, IsReversed ? 1.0 : 1.0)
43 | },
44 | Cue = new Cue(1d)
45 | }
46 | },
47 | Duration = TimeSpan.FromSeconds(0.35),
48 | FillMode = FillMode.Forward
49 | };
50 |
51 | await animation.RunAsync(ctrl, null);
52 |
53 | (ctrl as IVisual).Opacity = 1;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Media/EntranceNavigationTransitionInfoX.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Animation.Easings;
2 | using Avalonia.Animation;
3 | using Avalonia.Media;
4 | using Avalonia.Styling;
5 | using Avalonia.VisualTree;
6 | using Avalonia;
7 | using FluentAvalonia.UI.Media.Animation;
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Text;
12 | using System.Threading.Tasks;
13 |
14 | namespace WonderLab.Modules.Media
15 | {
16 | public class EntranceNavigationTransitionInfoX : NavigationTransitionInfo
17 | {
18 | ///
19 | /// Gets or sets the Horizontal Offset used when animating
20 | ///
21 | public double FromHorizontalOffset { get; set; } = 0;
22 |
23 | ///
24 | /// Gets or sets the Vertical Offset used when animating
25 | ///
26 | public double FromVerticalOffset { get; set; } = 28;
27 |
28 | public EntranceNavigationTransitionInfoX(double fromHorizontalOffset)
29 | {
30 | FromVerticalOffset = fromHorizontalOffset;
31 | }
32 |
33 |
34 |
35 | //SlideUp and FadeIn
36 | public async override void RunAnimation(Animatable ctrl)
37 | {
38 | var animation = new Avalonia.Animation.Animation
39 | {
40 | Easing = new SplineEasing(0.1, 0.9, 0.2, 1.0),
41 | Children =
42 | {
43 | new KeyFrame
44 | {
45 | Setters =
46 | {
47 | new Setter(Visual.OpacityProperty, 0.0),
48 | new Setter(TranslateTransform.XProperty,FromHorizontalOffset),
49 | new Setter(TranslateTransform.YProperty, FromVerticalOffset)
50 | },
51 | Cue = new Cue(0d)
52 | },
53 | new KeyFrame
54 | {
55 | Setters =
56 | {
57 | new Setter(Visual.OpacityProperty, 1d),
58 | new Setter(TranslateTransform.XProperty,0.0),
59 | new Setter(TranslateTransform.YProperty, 0.0)
60 | },
61 | Cue = new Cue(1d)
62 | }
63 | },
64 | Duration = TimeSpan.FromSeconds(0.67),
65 | FillMode = FillMode.Forward
66 | };
67 |
68 | await animation.RunAsync(ctrl, null);
69 |
70 | (ctrl as IVisual).Opacity = 1;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Media/TeachingTipAnimation.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Animation.Easings;
2 | using Avalonia.Animation;
3 | using Avalonia.Media;
4 | using Avalonia.Styling;
5 | using Avalonia.VisualTree;
6 | using Avalonia;
7 | using System;
8 | using System.Collections.Generic;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 |
13 | namespace WonderLab.Modules.Media
14 | {
15 | ///
16 | /// 教学提示控件动画类
17 | ///
18 | public class TeachingTipAnimation
19 | {
20 | public bool IsReversed { get; set; }
21 |
22 | public TeachingTipAnimation(bool isReversed = false) => IsReversed = isReversed;
23 |
24 | ///
25 | /// 启动动画
26 | ///
27 | ///
28 | public async void RunAsync(Animatable ctrl)
29 | {
30 | var animation = new Animation
31 | {
32 | Easing = new SplineEasing(0.1, 0.9, 0.2, 1.0),
33 | Children =
34 | {
35 | new KeyFrame
36 | {
37 | Setters =
38 | {
39 | new Setter(Visual.OpacityProperty, 0.0),
40 | new Setter(ScaleTransform.ScaleXProperty, IsReversed ? 1.0 : 0.0),
41 | new Setter(ScaleTransform.ScaleYProperty, IsReversed ? 1.0 : 0.0)
42 | },
43 | Cue = new Cue(0d)
44 | },
45 | new KeyFrame
46 | {
47 | Setters =
48 | {
49 | new Setter(Visual.OpacityProperty, 1.0),
50 | new Setter(ScaleTransform.ScaleXProperty, IsReversed ? 0 : 1.0),
51 | new Setter(ScaleTransform.ScaleYProperty, IsReversed ? 0 : 1.0)
52 | },
53 | Cue = new Cue(1d)
54 | }
55 | },
56 | Duration = TimeSpan.FromSeconds(IsReversed ? 0.35 : 0.75),
57 | FillMode = FillMode.Forward
58 | };
59 |
60 | await animation.RunAsync(ctrl, null);
61 |
62 | (ctrl as IVisual).Opacity = 1;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Media/ZoomOutAnimation.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Animation.Easings;
2 | using Avalonia.Animation;
3 | using Avalonia.Media;
4 | using Avalonia.Styling;
5 | using Avalonia.VisualTree;
6 | using Avalonia;
7 | using System;
8 | using System.Collections.Generic;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 |
13 | namespace WonderLab.Modules.Media
14 | {
15 | ///
16 | /// 放大缩小动画
17 | ///
18 | public class ZoomOutAnimation
19 | {
20 | public bool IsReversed { get; set; }
21 |
22 | public ZoomOutAnimation(bool isReversed = false) => IsReversed = isReversed;
23 |
24 | ///
25 | /// 启动动画
26 | ///
27 | ///
28 | public async void RunAsync(Animatable ctrl)
29 | {
30 | var animation = new Animation
31 | {
32 | Easing = new SplineEasing(0.1, 0.9, 0.2, 1.0),
33 | Children =
34 | {
35 | new KeyFrame
36 | {
37 | Setters =
38 | {
39 | new Setter(Visual.OpacityProperty, 1.0),
40 | new Setter(ScaleTransform.ScaleXProperty, IsReversed ? 1.3 : 1.0),
41 | new Setter(ScaleTransform.ScaleYProperty, IsReversed ? 1.3 : 1.0)
42 | },
43 | Cue = new Cue(0d)
44 | },
45 | new KeyFrame
46 | {
47 | Setters =
48 | {
49 | new Setter(Visual.OpacityProperty, 1.0),
50 | new Setter(ScaleTransform.ScaleXProperty, IsReversed ? 1.0 : 1.3),
51 | new Setter(ScaleTransform.ScaleYProperty, IsReversed ? 1.0 : 1.3)
52 | },
53 | Cue = new Cue(1d)
54 | }
55 | },
56 | Duration = TimeSpan.FromSeconds(0.85),
57 | FillMode = FillMode.Both
58 | };
59 |
60 | await animation.RunAsync(ctrl, null);
61 |
62 | (ctrl as IVisual).Opacity = 1;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/DataModels.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using MinecraftLaunch.Modules.Models.Launch;
8 | using Newtonsoft.Json;
9 |
10 | namespace WonderLab.Modules.Models
11 | {
12 | ///
13 | /// 数据保存模型
14 | ///
15 | public class DataModels
16 | {
17 | public int Max { get; set; } = 1024;
18 | public int SelectedJava { get; set; } = 0;
19 | public int SelectedLang { get; set; } = 0;
20 | public int CurrentBranch { get; set; } = 0;
21 | public int SelectedAPI { get; set; } = 0;
22 | public int MaxThreadCount { get; set; } = 0;
23 | public string SelectedGameFooter { get; set; } = string.Empty;
24 | public string? SelectedGameCore { get; set; } = null;
25 | public UserDataModels? SelectedUser { get; set; } = null;
26 | public string CustomDownloadPath = Environment.CurrentDirectory;
27 | public string FooterPath { get; set; } = $"{Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".minecraft")}";
28 | public string NativesFolderPath { get; set; } = string.Empty;
29 | public string JavaPath { get; set; } = string.Empty;
30 | public string Jvm { get; set; } = string.Empty;
31 | public string LanguageTag { get; set; } = "zh-cn";
32 | public bool IsFull { get; set; } = false;
33 | public bool Isolate { get; set; } = false;
34 | public bool AutoSelectJava { get; set; } = true;
35 | public List JavaList { get; set; } = new();
36 | public List GameFooterList { get; set; } = new() { Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".minecraft") };
37 | public List UserList { get; set; } = new();
38 | }
39 | }
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/GameCoreItem.cs:
--------------------------------------------------------------------------------
1 | using MinecraftLaunch.Modules.Models.Install;
2 | using MinecraftLaunch.Modules.Models.Launch;
3 | using Natsurainko.FluentCore.Class.Model.Install.Vanilla;
4 | using Newtonsoft.Json;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace WonderLab.Modules.Models
12 | {
13 | public class GameCoreItem : GameCoreEmtity
14 | {
15 | public GameCoreItem(GameCoreEmtity coreManifestItem)
16 | {
17 | this.Url = coreManifestItem.Url;
18 | this.ReleaseTime = coreManifestItem.ReleaseTime;
19 | this.Time = coreManifestItem.Time;
20 | this.Id = coreManifestItem.Id;
21 | this.Type = coreManifestItem.Type;
22 | }
23 |
24 | [JsonIgnore]
25 | public GameCore GameCore => new()
26 | {
27 | Type = this.Type.ToLower(),
28 | Id = this.Id,
29 | Source = this.Id
30 | };
31 |
32 | public CoreManifestItem GetCoreManifest() => new()
33 | {
34 | Id = this.Id,
35 | ReleaseTime = this.ReleaseTime.ToString(),
36 | Time = this.Time.ToString(),
37 | Type = this.Type,
38 | Url = this.Url
39 | };
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/GameCoreViewData.cs:
--------------------------------------------------------------------------------
1 | using MinecraftLaunch.Modules.Models.Launch;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using WonderLab.ViewModels;
8 |
9 | namespace WonderLab.Modules.Models
10 | {
11 | public class GameCoreViewData : ViewDataBase
12 | {
13 | public GameCoreViewData(T data) : base(data)
14 | {
15 | }
16 |
17 | public DateTime LastLaunchTime { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/GameDataModels.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | ///
10 | /// 单一游戏核心数据保存模型
11 | ///
12 | public class GameDataModels
13 | {
14 | public string LastLaunchTime { get; set; }
15 | public DateTime LastLaunchTimeVM { get; set; }
16 | public bool IsEnableIndependencyCore { get; set; } = false;
17 |
18 | public string Jvm { get; set; } = string.Empty;
19 | public string GameLang { get; set; } = "zh";
20 | public bool Isolate { get; set; } = false;
21 | public bool IsFullWindows { get; set; } = false;
22 | public int WindowHeight { get; set; } = 480;
23 | public int WindowWidth { get; set; } = 854;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/GameLogType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | public class GameLogType
10 | {
11 | public LogType LogType { get; set; }
12 | public string LogTime { get; set; }
13 | public string Log { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/InfoBarModel.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using FluentAvalonia.UI.Controls;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Diagnostics;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using WonderLab.Modules.Base;
10 |
11 | namespace WonderLab.Modules.Models
12 | {
13 | public class InfoBarModel : ViewModelBase
14 | {
15 | public bool Removed { get; set; } = false;
16 |
17 | public string Title { get; set; } = string.Empty;
18 |
19 | public string Description { get; set; } = string.Empty;
20 |
21 | public IControl? Button { get; set; }
22 |
23 | public int Delay { get; set; } = 5000;
24 |
25 | public InfoBarSeverity Severity { get; set; } = InfoBarSeverity.Informational;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/LogModels.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Media;
2 | using MinecraftLaunch.Modules.Enum;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace WonderLab.Modules.Models
10 | {
11 | public class LogModels
12 | {
13 | public string LogType => LogLevel.ToString();
14 | public string Time { get; set; }
15 | public string Source { get; set; }
16 | public string Log { get; set; }
17 | public MinecraftLaunch.Modules.Enum.GameLogType LogLevel { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/LogType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | public enum LogType
10 | {
11 | All = 0,
12 | Unknown,
13 | Debug,
14 | Info,
15 | Warning,
16 | Fatal,
17 | Error,
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/LogViewData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using WonderLab.ViewModels;
7 |
8 | namespace WonderLab.Modules.Models
9 | {
10 | public class LogViewData : ViewDataBase
11 | {
12 | public LogViewData(string data) : base(data)
13 | {
14 |
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/ModDataModel.cs:
--------------------------------------------------------------------------------
1 | using FluentAvalonia.UI.Controls;
2 | using MinecraftLaunch.Modules.Models.Download;
3 | using MinecraftLaunch.Modules.Toolkits;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Diagnostics;
7 | using System.IO;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using WonderLab.Modules.Base;
12 | using WonderLab.Views;
13 |
14 | namespace WonderLab.Modules.Models
15 | {
16 | public class ModDataModel : ViewModelBase
17 | {
18 | public ModDataModel(ModPack modPack)
19 | {
20 | Id = modPack.Id;
21 | FileName = modPack.FileName;
22 | DisplayName = modPack.DisplayName;
23 | Description = modPack.Description;
24 | Version = modPack.Version;
25 | GameVersion = modPack.GameVersion;
26 | Authors = modPack.Authors;
27 | Url = modPack.Url;
28 | Path = modPack.Path;
29 | IsEnabled = modPack.IsEnabled;
30 | }
31 |
32 | public string Id { get; set; }
33 |
34 | public string FileName { get => _FileName; set => RaiseAndSetIfChanged(ref _FileName, value); }
35 |
36 | public string DisplayName { get; set; }
37 |
38 | public string Description { get; set; }
39 |
40 | public string Version { get; set; }
41 |
42 | public string GameVersion { get; set; }
43 |
44 | public string Authors { get; set; }
45 |
46 | public string Url { get; set; }
47 |
48 | public string Path { get => _Path; set => RaiseAndSetIfChanged(ref _Path, value); }
49 |
50 | public string _Path;
51 |
52 | public string _FileName;
53 |
54 | public bool IsEnabled { get; set; }
55 |
56 | public static ModPackToolkit ModPackToolkit { get; set; }
57 |
58 | public static void SetToolkit(ModPackToolkit modPack)
59 | {
60 | ModPackToolkit = modPack;
61 | }
62 |
63 | public void ModStateChange()
64 | {
65 | try
66 | {
67 | Debug.WriteLine($"ModStateChange,Path:{Path}");
68 | Path = ModPackToolkit.ModStateChange(Path);
69 | FileName = System.IO.Path.GetFileName(Path);
70 | }
71 | catch (Exception ex) when (ex.Message.Contains("The process cannot access the file because it is being used by another process"))
72 | {
73 | MainWindow.ShowInfoBarAsync("提示:", "更改模组启用状态失败,请尝试关闭当前正在运行的 Minecraft!", InfoBarSeverity.Warning);
74 | }
75 | catch (Exception ex)
76 | {
77 | Debug.WriteLine(ex);
78 | MainWindow.ShowInfoBarAsync("错误:", ex.ToString(), FluentAvalonia.UI.Controls.InfoBarSeverity.Error);
79 | }
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/ModInfoModels.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | public class ModInfoModels
10 | {
11 | public enum ModType
12 | {
13 | Forge = 0,
14 | Fabric = 1,
15 | ForgeAndFabric = 2
16 | }
17 |
18 | public string FileName { get; set; }
19 |
20 | public ModType Type { get; set; } = 0;
21 |
22 | public string Name { get; set; }
23 |
24 | public string Description { get; set; }
25 |
26 | public string[] Authors { get; set; }
27 |
28 | public string Version { get; set; }
29 |
30 | public bool Enable { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/ModLangDataModel.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace WonderLab.Modules.Models
9 | {
10 | public class ModLangDataModel
11 | {
12 | [JsonProperty("En")] public string CurseForgeId { get; set; }
13 | [JsonProperty("Zh")] public string Chinese { get; set; }
14 | [JsonProperty("MCModWikiId")] public int MCModId { get; set; }
15 | [JsonProperty("MCBBSId")] public int McbbsId { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/OtherDataModels.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | public class OtherDataModels
10 | {
11 |
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/ResourcePackViewData.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Media.Imaging;
2 | using MinecraftLaunch.Modules.Models.Download;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using WonderLab.Modules.Toolkits;
10 | using WonderLab.ViewModels;
11 |
12 | namespace WonderLab.Modules.Models
13 | {
14 | public class ResourcePackViewData : ViewDataBase
15 | {
16 | public ResourcePackViewData(T data) : base(data)
17 | { }
18 |
19 |
20 | public Bitmap PackLogo
21 | {
22 | get => _;
23 | set => RaiseAndSetIfChanged(ref _, value);
24 | }
25 |
26 | public Bitmap _ = (BitmapToolkit.GetAssetsImage("resm:WonderLab.Resources.normal.png")! as Bitmap)!;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/SaveUserDataModels.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | public class SaveUserDataModels : UserDataModels
10 | {
11 | public string SkinHeadUri { get; set; }
12 | public string UserType { get; set; }
13 | public string UserName { get; set; }
14 | public string UserUuid { get; set; }
15 | public string UserToken { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/TransformationModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Models
8 | {
9 | ///
10 | /// 转换模型
11 | ///
12 | public class TransformationModel
13 | {
14 | public string Id { get; set; }
15 | public string Type { get; set; }
16 | public bool HasModLoader { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/WonderLab/Modules/Models/UserDataModels.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Media;
3 | using Avalonia.Media.Imaging;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Diagnostics;
7 | using System.IO;
8 | using System.Linq;
9 | using System.Net.Http;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using WonderLab.Modules.Base;
13 |
14 | namespace WonderLab.Modules.Models
15 | {
16 | public class UserDataModels
17 | {
18 | public string UserName { get; set; }
19 | public string UserType { get; set; }
20 | public string SkinHeadImage { get; set; }
21 | public string UserUuid { get; set; }
22 | public string UserAccessToken { get; set; } = "";
23 | public string UserRefreshToken { get; set; } = "";
24 | public string AIJvm { get; set; } = "";
25 | }
26 |
27 | public class UserSkinDemo : UserDataModels
28 | {
29 | public async Task GetSkin()
30 | {//https://crafatar.com/avatars/95883f77eef84bc6b7274f9c754a5a2c
31 | return await Task.Run(async () =>
32 | {
33 | HttpClient httpClient = new();
34 | MemoryStream v1 = new(await httpClient.GetByteArrayAsync($"https://crafatar.com/avatars/{UserUuid}"));
35 | return new Bitmap(v1);
36 | });
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Toolkits/ClipboardToolkt.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blessing-Studio/WonderLab/953f62b11e0bd6d8a7782884ccb288ecc2924f07/WonderLab/Modules/Toolkits/ClipboardToolkt.cs
--------------------------------------------------------------------------------
/WonderLab/Modules/Toolkits/CryptoToolkit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WonderLab.Modules.Toolkits
8 | {
9 | public class CryptoToolkit
10 | {
11 | public static IEnumerable Remove(ReadOnlySpan data)
12 | {
13 | IEnumerable data2 = new List();
14 |
15 | if (data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF)
16 | {
17 | var v = data[3..];
18 |
19 | foreach (var i in v)
20 | {
21 | data2.Append(i);
22 | }
23 | return data2;
24 | }
25 |
26 | foreach (var i in data)
27 | {
28 | data2.Append(i);
29 | }
30 |
31 | return data2;
32 | }
33 |
34 | public static ReadOnlySpan Remove(ReadOnlySpan data,int i =2)
35 | {
36 | if (data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF)
37 | {
38 | return data[3..];
39 | }
40 | return data;
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Toolkits/FileToolkit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using WonderLab.Modules.Models;
8 |
9 | namespace WonderLab.Modules.Toolkits
10 | {
11 | public class FileToolkit
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/WonderLab/Modules/Toolkits/GameLogToolkit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 | using System.Threading.Tasks;
7 | using WonderLab.Modules.Models;
8 |
9 | namespace WonderLab.Modules.Toolkits
10 | {
11 | ///
12 | /// 游戏日志操作工具类
13 | ///
14 | public class GameLogToolkit
15 | {
16 | public static GameLogType GameLogParSing(string S)
17 | {
18 | var regex = new Regex($"FATAL|ERROR|WARN|INFO|DEBUG");
19 | var regex1 = new Regex($": .*?\\s\\S.*");
20 | var regex2 = new Regex(@"\[*(?