XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

SpaceEngineersModDev/SpaceEngineersBlueprintEditorInWinUI

完善安装程序

245dfe3
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

11 个文件 +58 -53
Added .editorconfig +4 -0
@@ -0,0 +1,4 @@
1 [*.cs]
2
3 # MVVMTK0045: Using [ObservableProperty] on fields is not AOT compatible for WinRT
4 dotnet_diagnostic.MVVMTK0045.severity = none
Modified SpaceEngineersBlueprintEditor.Installer/App.xaml.cs +1 -1
@@ -19,7 +19,7 @@ public partial class App : Application
19 19 else
20 20 {
21 21 SystemProfile.StartMode = e.Args[0];
22 SystemProfile.ServerUrl = e.Args[1];
22 SystemProfile.DownloadUrl = e.Args[1];
23 23 SystemProfile.InstallPath = e.Args[2];
24 24 }
25 25 }
Modified SpaceEngineersBlueprintEditor.Installer/Profiles/SystemProfile.cs +4 -4
@@ -23,15 +23,15 @@ public class SystemProfile
23 23 /// </summary>
24 24 public static string StartMode { get; set; } = string.Empty;
25 25 /// <summary>
26 /// 服务器Url
26 /// 下载Url
27 27 /// </summary>
28 public static string ServerUrl { get; set; } = string.Empty;
28 public static string DownloadUrl { get; set; } = string.Empty;
29 29 /// <summary>
30 30 /// 安装目录
31 31 /// </summary>
32 public static string InstallPath { get; set; } = string.Empty;
32 public static string InstallPath { get; set; } = @$"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}\SpaceEngineersBlueprintEditor";
33 33 /// <summary>
34 34 /// 第一次安装
35 35 /// </summary>
36 36 public static bool FirstInstall { get; set; } = false;
37 }
37 }
Modified SpaceEngineersBlueprintEditor.Installer/Resources/Resource/EULA.txt +7 -7
@@ -4,19 +4,19 @@
4 4
5 5 发布日期:2024年12月29日
6 6
7 版权所有 © XFE工作室,2024。保留所有权利。
7 版权所有 © XFEstudio,2024。保留所有权利。
8 8
9 9
10 10 1. 定义
11 11
12 12 “软件” 指 “太空工程师蓝图编辑器” ,包括但不限于所有包含的文件、文档和在线或电子文档。
13 13 “用户” 或 “您” 指软件的最终用户或用户。
14 “许可” 指 “XFE工作室” 授予用户使用软件的非独占、不可转让、可撤销的许可。
14 “许可” 指 “XFEstudio” 授予用户使用软件的非独占、不可转让、可撤销的许可。
15 15
16 16
17 17 2. 许可授予
18 18
19 2.1 XFE工作室 授予您一个个人、非独占、不可转让、可撤销的许可,以使用软件,仅限于非商业目的。
19 2.1 XFEstudio 授予您一个个人、非独占、不可转让、可撤销的许可,以使用软件,仅限于非商业目的。
20 20 2.2 您不得出售、出租、出借、转让或以其他方式分配软件或其任何部分。
21 21
22 22
@@ -29,18 +29,18 @@
29 29
30 30 4. 许可费用
31 31
32 4.1 本软件是免费提供给用户的,但XFE工作室保留随时变更许可费用的权利。
32 4.1 本软件是免费提供给用户的,但XFEstudio保留随时变更许可费用的权利。
33 33
34 34
35 35 5. 保证与责任限制
36 36
37 5.1 XFE工作室 不提供任何形式的保证,包括但不限于适销性、特定用途的适用性或不侵权的保证。
38 5.2 在任何情况下,XFE工作室 对因使用或无法使用软件而引起的任何直接、间接、附带、特殊、惩罚性或后果性损害,均不承担责任。
37 5.1 XFEstudio 不提供任何形式的保证,包括但不限于适销性、特定用途的适用性或不侵权的保证。
38 5.2 在任何情况下,XFEstudio 对因使用或无法使用软件而引起的任何直接、间接、附带、特殊、惩罚性或后果性损害,均不承担责任。
39 39
40 40
41 41 6. 许可终止
42 42
43 6.1 如果您违反本协议的任何条款,XFE工作室 有权立即终止本许可。
43 6.1 如果您违反本协议的任何条款,XFEstudio 有权立即终止本许可。
44 44 6.2 终止本许可后,您必须停止使用软件并销毁所有软件副本。
45 45
46 46
Modified SpaceEngineersBlueprintEditor.Installer/SpaceEngineersBlueprintEditor.Installer.csproj +1 -1
@@ -50,7 +50,7 @@
50 50 <ItemGroup>
51 51 <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
52 52 <PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
53 <PackageReference Include="XFEExtension.NetCore" Version="3.2.7" />
53 <PackageReference Include="XFEExtension.NetCore" Version="3.3.2" />
54 54 <PackageReference Include="XFEExtension.NetCore.InputSimulator" Version="2.3.0" />
55 55 </ItemGroup>
56 56
Modified SpaceEngineersBlueprintEditor.Installer/Utilities/DownloadHelper.cs +2 -30
@@ -1,38 +1,10 @@
1 using SpaceEngineersBlueprintEditor.Installer.Profiles;
2 using System.Net;
1 using System.Net;
3 2 using System.Net.Http;
4 using System.Windows;
5 using XFEExtension.NetCore.StringExtension.Json;
6 3
7 4 namespace SpaceEngineersBlueprintEditor.Installer.Utilities;
8 5
9 6 public static class DownloadHelper
10 7 {
11 public static async Task<string> GetDownloadUrl()
12 {
13 try
14 {
15 var result = await GetServerResponse(new
16 {
17 execute = "get_clientAppUrl"
18 }.ToJson(), SystemProfile.ServerUrl);
19 if (result.Item2 == HttpStatusCode.OK)
20 {
21 return result.Item1;
22 }
23 else
24 {
25 MessageBox.Show($"无法获取下载链接:未知原因");
26 return string.Empty;
27 }
28 }
29 catch (Exception ex)
30 {
31 MessageBox.Show($"无法获取下载链接:{ex.Message}");
32 return string.Empty;
33 }
34 }
35
36 8 /// <summary>
37 9 /// 获取服务器响应
38 10 /// </summary>
@@ -51,4 +23,4 @@ public static class DownloadHelper
51 23 return (ex.Message, result.StatusCode);
52 24 }
53 25 }
54 }
26 }
Modified SpaceEngineersBlueprintEditor.Installer/ViewModel/Pages/DownloadProgressPageViewModel.cs +2 -3
@@ -103,12 +103,11 @@ public partial class DownloadProgressPageViewModel(DownloadProgressPage viewPage
103 103 [RelayCommand]
104 104 async Task Retry()
105 105 {
106 var url = await DownloadHelper.GetDownloadUrl();
107 if (!url.IsNullOrEmpty())
106 if (!SystemProfile.DownloadUrl.IsNullOrEmpty())
108 107 {
109 108 Downloader = new()
110 109 {
111 DownloadUrl = url,
110 DownloadUrl = SystemProfile.DownloadUrl,
112 111 SavePath = Path.Combine(SystemProfile.InstallPath, "InstallPackage.zip")
113 112 };
114 113 }
Modified SpaceEngineersBlueprintEditor.Installer/Views/Pages/InstallProgressPage.xaml.cs +1 -1
@@ -43,7 +43,7 @@ public partial class InstallProgressPage : Page
43 43 if (SystemProfile.InstallPath != string.Empty && !Directory.Exists(SystemProfile.InstallPath))
44 44 Directory.CreateDirectory(SystemProfile.InstallPath);
45 45 if (Install(innerStream))
46 FileHelper.CreateShortCut($@"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\太空工程师蓝图编辑器.lnk", Path.Combine(SystemProfile.InstallPath, "SpaceEngineersBlueprintEditor.ClientApplication.exe"), null, "太空工程师蓝图编辑器快捷方式", null, SystemProfile.InstallPath);
46 FileHelper.CreateShortCut($@"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\太空工程师蓝图编辑器.lnk", Path.Combine(SystemProfile.InstallPath, "SpaceEngineersBlueprintEditor.exe"), null, "太空工程师蓝图编辑器快捷方式", null, SystemProfile.InstallPath);
47 47 }
48 48 break;
49 49 }
Modified SpaceEngineersBlueprintEditor.sln +5 -0
@@ -21,6 +21,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceEngineersBlueprintEdit
21 21 EndProject
22 22 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceEngineersBlueprintEditor.Installer", "SpaceEngineersBlueprintEditor.Installer\SpaceEngineersBlueprintEditor.Installer.csproj", "{5327FD79-E8BA-1477-AEF6-2357FE84A802}"
23 23 EndProject
24 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
25 ProjectSection(SolutionItems) = preProject
26 .editorconfig = .editorconfig
27 EndProjectSection
28 EndProject
24 29 Global
25 30 GlobalSection(SolutionConfigurationPlatforms) = preSolution
26 31 Debug|Any CPU = Debug|Any CPU
Modified SpaceEngineersBlueprintEditor/SpaceEngineersBlueprintEditor.csproj +2 -1
@@ -77,7 +77,7 @@
77 77 <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
78 78 <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.250402" />
79 79 <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4188" />
80 <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250401001" />
80 <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
81 81 <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
82 82 <PackageReference Include="System.Drawing.Common" Version="9.0.0" />
83 83 <PackageReference Include="WinUIEx" Version="2.5.1" />
@@ -85,6 +85,7 @@
85 85 <PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="2.0.5" />
86 86 <PackageReference Include="XFEExtension.NetCore.AutoPath" Version="1.0.1" />
87 87 <PackageReference Include="XFEExtension.NetCore.TodoHighLight" Version="1.0.0" />
88 <PackageReference Include="XFEExtension.NetCore.UpgradeHelper" Version="1.0.1" />
88 89 <PackageReference Include="XFEExtension.NetCore.WinUIHelper" Version="1.2.*" />
89 90 </ItemGroup>
90 91 <ItemGroup>
Modified SpaceEngineersBlueprintEditor/Utilities/Helpers/UpgradeHelper.cs +29 -5
@@ -1,10 +1,33 @@
1 using System.Diagnostics;
1 using ApplicationUpgradeManager.Core.Model;
2 using SpaceEngineersBlueprintEditor.Profiles;
3 using System.Diagnostics;
4 using System.Reflection;
5 using XFEExtension.NetCore.UpgradeHelper.Utilities;
2 6
3 namespace SpaceEngineersBlueprintEditor.Utilities.Helper;
7 namespace SpaceEngineersBlueprintEditor.Utilities.Helpers;
4 8
5 9 public static class UpgradeHelper
6 10 {
7 public static void StartUpdate()
11 public static string RequestAddress => UnloadProfile.ServerUrl;
12 public static Upgrader Upgrader { get; set; } = new(RequestAddress);
13 public static Version Version => Assembly.GetExecutingAssembly().GetName().Version ?? new Version(1, 0, 0);
14
15 /// <summary>
16 /// 检测是否需要更新
17 /// </summary>
18 /// <returns></returns>
19 public static async Task<bool> NeedUpgrade() => (await Upgrader.GetReleaseNotes("太空工程师蓝图编辑器", Version.ToString())).IsLatest;
20
21 /// <summary>
22 /// 获取更新信息
23 /// </summary>
24 /// <returns></returns>
25 public static async Task<UpgradeInfoNotes> GetReleaseNotes() => await Upgrader.GetReleaseNotes("太空工程师蓝图编辑器", Version.ToString());
26
27 /// <summary>
28 /// 开始更新
29 /// </summary>
30 public static void StartUpdate(string downloadUrl)
8 31 {
9 32 var startInfo = new ProcessStartInfo("SpaceEngineersBlueprintEditor.Installer.exe")
10 33 {
@@ -12,9 +35,10 @@ public static class UpgradeHelper
12 35 Verb = "runas"
13 36 };
14 37 startInfo.ArgumentList.Add("Upgrade");
15 startInfo.ArgumentList.Add(SystemProfile.ServerIp);
38 startInfo.ArgumentList.Add(downloadUrl);
16 39 startInfo.ArgumentList.Add("");
17 40 Process.Start(startInfo);
41 Process.GetCurrentProcess().Kill();
18 42 Application.Current.Exit();
19 43 }
20 }
44 }