diff --git a/README.en.md b/README.en.md
index 3d74784f6..9f454a711 100644
--- a/README.en.md
+++ b/README.en.md
@@ -139,7 +139,7 @@ Read what we [milestones](https://github.com/SteamTools-Team/SteamTools/mileston
* [Polly](https://github.com/App-vNext/Polly)
* [TaskScheduler](https://github.com/dahall/taskscheduler)
* [SharpZipLib](https://github.com/icsharpcode/SharpZipLib)
-* [LibVLCSharp](https://github.com/videolan/libvlcsharp)
+* [SevenZipSharp](https://github.com/squid-box/SevenZipSharp)
* [Depressurizer](https://github.com/Depressurizer/Depressurizer)
* [NLog](https://github.com/nlog/NLog)
* [NUnit](https://github.com/nunit/nunit)
@@ -149,18 +149,14 @@ Read what we [milestones](https://github.com/SteamTools-Team/SteamTools/mileston
* [AvaloniaGif](https://github.com/jmacato/AvaloniaGif)
* [Avalonia XAML Behaviors](https://github.com/wieslawsoltes/AvaloniaBehaviors)
* [APNG.NET](https://github.com/jz5/APNG.NET)
-* [Chromium Embedded Framework (CEF)](https://github.com/chromiumembedded/cef)
* [Moq](https://github.com/moq/moq4)
* [NPOI](https://github.com/nissl-lab/npoi)
* [Swashbuckle.AspNetCore](https://github.com/domaindrivendev/Swashbuckle.AspNetCore)
* [AspNet.Security.OpenId.Providers](https://github.com/aspnet-contrib/AspNet.Security.OpenId.Providers)
* [AspNet.Security.OAuth.Providers](https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers)
-* [CefNet](https://github.com/CefNet/CefNet)
-* [CefSharp](https://github.com/cefsharp/CefSharp)
* [ZXing.Net](https://github.com/micjahn/ZXing.Net)
* [ZXing.Net.Mobile](https://github.com/Redth/ZXing.Net.Mobile)
* [QRCoder](https://github.com/codebude/QRCoder)
-* [SharpCompress](https://github.com/adamhathcock/sharpcompress)
* [React](https://github.com/facebook/react)
* [Ant Design](https://github.com/ant-design/ant-design)
* [Ant Design Blazor](https://github.com/ant-design-blazor/ant-design-blazor)
diff --git a/README.md b/README.md
index 45528ad7b..4304c9cea 100644
--- a/README.md
+++ b/README.md
@@ -120,6 +120,12 @@
## 🏗️ [项目结构](./src/README.md)
+
## 📄 感谢以下开源项目
* [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
@@ -151,7 +157,7 @@
* [Polly](https://github.com/App-vNext/Polly)
* [TaskScheduler](https://github.com/dahall/taskscheduler)
* [SharpZipLib](https://github.com/icsharpcode/SharpZipLib)
-* [LibVLCSharp](https://github.com/videolan/libvlcsharp)
+* [SevenZipSharp](https://github.com/squid-box/SevenZipSharp)
* [Depressurizer](https://github.com/Depressurizer/Depressurizer)
* [NLog](https://github.com/nlog/NLog)
* [NUnit](https://github.com/nunit/nunit)
@@ -161,18 +167,14 @@
* [AvaloniaGif](https://github.com/jmacato/AvaloniaGif)
* [Avalonia XAML Behaviors](https://github.com/wieslawsoltes/AvaloniaBehaviors)
* [APNG.NET](https://github.com/jz5/APNG.NET)
-* [Chromium Embedded Framework (CEF)](https://github.com/chromiumembedded/cef)
* [Moq](https://github.com/moq/moq4)
* [NPOI](https://github.com/nissl-lab/npoi)
* [Swashbuckle.AspNetCore](https://github.com/domaindrivendev/Swashbuckle.AspNetCore)
* [AspNet.Security.OpenId.Providers](https://github.com/aspnet-contrib/AspNet.Security.OpenId.Providers)
* [AspNet.Security.OAuth.Providers](https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers)
-* [CefNet](https://github.com/CefNet/CefNet)
-* [CefSharp](https://github.com/cefsharp/CefSharp)
* [ZXing.Net](https://github.com/micjahn/ZXing.Net)
* [ZXing.Net.Mobile](https://github.com/Redth/ZXing.Net.Mobile)
* [QRCoder](https://github.com/codebude/QRCoder)
-* [SharpCompress](https://github.com/adamhathcock/sharpcompress)
* [React](https://github.com/facebook/react)
* [Ant Design](https://github.com/ant-design/ant-design)
* [Ant Design Blazor](https://github.com/ant-design-blazor/ant-design-blazor)
diff --git a/SteamToolsV2+.sln b/SteamToolsV2+.sln
index 5a00b4b9a..7e9659f1d 100644
--- a/SteamToolsV2+.sln
+++ b/SteamToolsV2+.sln
@@ -99,8 +99,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Tools.Packager.Installer
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Tools.Translate", "src\ST.Tools.Translate\ST.Tools.Translate.csproj", "{7A27EDB5-2E6A-4E01-AA55-62C8B3117226}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Tools.Win7Troubleshoot", "src\ST.Tools.Win7Troubleshoot\ST.Tools.Win7Troubleshoot.csproj", "{1A07EEE0-3533-4FD1-8D08-F89129820B1A}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Client.Desktop.Avalonia.App", "src\ST.Client.Desktop.Avalonia.App\ST.Client.Desktop.Avalonia.App.csproj", "{1CB40DC8-8FBC-4278-A19A-D872CFA353C0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Client.Desktop.Avalonia.Demo.App", "src\ST.Client.Desktop.Avalonia.Demo.App\ST.Client.Desktop.Avalonia.Demo.App.csproj", "{7EC4BAB6-B7C0-4E87-9FB6-091ABFF10D88}"
@@ -1163,34 +1161,6 @@ Global
{7A27EDB5-2E6A-4E01-AA55-62C8B3117226}.Release|x64.Build.0 = Release|Any CPU
{7A27EDB5-2E6A-4E01-AA55-62C8B3117226}.Release|x86.ActiveCfg = Release|Any CPU
{7A27EDB5-2E6A-4E01-AA55-62C8B3117226}.Release|x86.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|ARM.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|ARM64.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|iPhone.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|x64.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|x64.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Debug|x86.Build.0 = Debug|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|Any CPU.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|ARM.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|ARM.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|ARM64.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|ARM64.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|iPhone.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|iPhone.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|x64.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|x64.Build.0 = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|x86.ActiveCfg = Release|Any CPU
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A}.Release|x86.Build.0 = Release|Any CPU
{1CB40DC8-8FBC-4278-A19A-D872CFA353C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CB40DC8-8FBC-4278-A19A-D872CFA353C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CB40DC8-8FBC-4278-A19A-D872CFA353C0}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1558,7 +1528,6 @@ Global
{2BF2DA87-7F0E-4384-AF80-275D495A1972} = {E448F863-4C9D-47A4-BC4A-4A1381B54DA4}
{A4E53C27-0195-47D3-9DC7-192061402BB8} = {E448F863-4C9D-47A4-BC4A-4A1381B54DA4}
{7A27EDB5-2E6A-4E01-AA55-62C8B3117226} = {E448F863-4C9D-47A4-BC4A-4A1381B54DA4}
- {1A07EEE0-3533-4FD1-8D08-F89129820B1A} = {E448F863-4C9D-47A4-BC4A-4A1381B54DA4}
{9A8D2254-9B2B-4B92-8498-43A73BB9A410} = {E448F863-4C9D-47A4-BC4A-4A1381B54DA4}
{F4D8CD7B-6DF4-445C-AFA9-44466A552922} = {673FF8CD-9E85-4FA1-ABFC-D1149675E138}
{1F659618-71E2-4AAF-9D86-62700FD4CF02} = {1B889C56-157A-4493-85F2-76366282B002}
diff --git a/references/7z.dll b/references/7z.dll
new file mode 100644
index 000000000..b32d7bf7b
Binary files /dev/null and b/references/7z.dll differ
diff --git a/release-template.md b/release-template.md
index f31951125..a08369bb5 100644
--- a/release-template.md
+++ b/release-template.md
@@ -9,9 +9,8 @@
7. 新增 意大利语支持
8. 新增 西班牙语支持
9. 新增 通用设置内可支持访问程序的 AppData、Cache、Logs 文件夹和查看缓存及日志占用空间大小情况
-10. 新增 hosts 文件编码设置项,可在 Windows 上使用系统的活动代码页(ANSICodePage),例如 GB2312/936
-11. Android/macOS/Linux 版现已开启 Beta/Alpha 测试,可从 GitHub/Gitee 上下载
-12. 现已通过 Desktop Bridge 转制为 UWP 上架 Microsoft Store
+10. Android/macOS/Linux 版现已开启 Beta/Alpha 测试,可从 GitHub/Gitee 上下载
+11. 现已通过 Desktop Bridge 转制为 UWP 上架 Microsoft Store
### 修复问题
1. 修复 开机自启动在 2.4.x 中不生效
@@ -38,6 +37,7 @@
22. 改进 移除了CEF模块,缩减程序体积和运行时内存占用
23. 改进 库存游戏支持显示已安装游戏占用空间大小
24. 改进 库存游戏封面大小调节可支持滚动调节
+25. 改进 hosts 文件编码在 Windows 上使用系统的活动代码页(ANSICodePage),例如 GB2312/936,其他操作系统则使用 UTF-8,还原 V1 版本行为
***
-
+
diff --git a/src/ST.Client.Desktop.Avalonia.App.Bridge/FileSystemDesktopBridge.cs b/src/ST.Client.Desktop.Avalonia.App.Bridge/FileSystemDesktopBridge.cs
index 432ed8b6d..8f8849368 100644
--- a/src/ST.Client.Desktop.Avalonia.App.Bridge/FileSystemDesktopBridge.cs
+++ b/src/ST.Client.Desktop.Avalonia.App.Bridge/FileSystemDesktopBridge.cs
@@ -1,8 +1,10 @@
+using System.Runtime.Versioning;
using Windows.Storage;
// ReSharper disable once CheckNamespace
namespace System.Application
{
+ [SupportedOSPlatform("Windows10.0.10240.0")]
static class FileSystemDesktopBridge
{
internal static void InitFileSystem()
diff --git a/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj b/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj
index 7fb49ad74..0ca6af7bf 100644
--- a/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj
+++ b/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj
@@ -91,6 +91,9 @@
+
+ PreserveNewest
+
diff --git a/src/ST.Client.Desktop/Services/IHostsFileService.cs b/src/ST.Client.Desktop/Services/IHostsFileService.cs
index 3e5dbda1d..5daf5fb5b 100644
--- a/src/ST.Client.Desktop/Services/IHostsFileService.cs
+++ b/src/ST.Client.Desktop/Services/IHostsFileService.cs
@@ -7,7 +7,7 @@ namespace System.Application.Services
///
public interface IHostsFileService
{
- const string TAG = "HostsFileS";
+ protected const string TAG = "HostsFileS";
public static IHostsFileService Instance => DI.Get();
@@ -58,8 +58,8 @@ namespace System.Application.Services
///
OperationResult RemoveHostsByTag();
- static bool mOnExitRestoreHosts;
- static readonly object mOnExitRestoreHostsLock = new();
+ private static bool mOnExitRestoreHosts;
+ private static readonly object mOnExitRestoreHostsLock = new();
///
/// 当程序退出时还原 hosts 文件
@@ -76,17 +76,17 @@ namespace System.Application.Services
bool ContainsHostsByTag();
- public enum EncodingType : byte
+ enum EncodingType : byte
{
- UTF8,
-
- UTF8WithBOM,
-
///
/// 系统的活动代码页并创建 Encoding 与其对应的对象。
/// 活动代码页可能是 ANSI 代码页,其中包括 ASCII 字符集以及不同于代码页的其他字符。
///
ANSICodePage,
+
+ UTF8,
+
+ UTF8WithBOM,
}
}
}
\ No newline at end of file
diff --git a/src/ST.Client.Desktop/Services/Implementation/DesktopAppUpdateServiceImpl.cs b/src/ST.Client.Desktop/Services/Implementation/DesktopAppUpdateServiceImpl.cs
index 60b60a263..d1c2af9ec 100644
--- a/src/ST.Client.Desktop/Services/Implementation/DesktopAppUpdateServiceImpl.cs
+++ b/src/ST.Client.Desktop/Services/Implementation/DesktopAppUpdateServiceImpl.cs
@@ -6,7 +6,8 @@ using System.Diagnostics;
using System.IO;
using System.Properties;
using System.Text;
-using static System.Application.Services.IAppUpdateService;
+using System.Threading.Tasks;
+using CC = System.Common.Constants;
namespace System.Application.Services.Implementation
{
@@ -25,7 +26,7 @@ namespace System.Application.Services.Implementation
///
protected abstract void OnExit();
- protected override void OverwriteUpgrade(string value, bool isIncrement, AppDownloadType downloadType)
+ protected override async void OverwriteUpgrade(string value, bool isIncrement, AppDownloadType downloadType)
{
if (isIncrement) // 增量更新
{
@@ -40,28 +41,29 @@ namespace System.Application.Services.Implementation
Directory.Delete(dirPath, true);
}
- var isOK = downloadType switch
+ var isOK = await Task.Run(() => downloadType switch
{
AppDownloadType.Compressed_GZip
=> TarGZipHelper.Unpack(value, dirPath,
progress: new Progress(OnReportDecompressing),
- maxProgress: MaxProgressValue),
+ maxProgress: CC.MaxProgress),
AppDownloadType.Compressed_7z
=> SevenZipHelper.Unpack(value, dirPath,
progress: new Progress(OnReportDecompressing),
- maxProgress: MaxProgressValue),
- _ => throw new NotSupportedException(),
- };
+ maxProgress: CC.MaxProgress),
+ _ => false,
+ });
if (isOK)
{
- OnReport(MaxProgressValue);
+ OnReport(CC.MaxProgress);
IOPath.FileTryDelete(value);
OverwriteUpgradePrivate(dirPath);
}
else
{
toast.Show(SR.UpdateUnpackFail);
- OnReport(MaxProgressValue);
+ OnReport(CC.MaxProgress);
+ IsNotStartUpdateing = true;
}
}
diff --git a/src/ST.Client.Desktop/Services/Implementation/SteamServiceImpl.cs b/src/ST.Client.Desktop/Services/Implementation/SteamServiceImpl.cs
index 275b3e9f1..efbcb67a9 100644
--- a/src/ST.Client.Desktop/Services/Implementation/SteamServiceImpl.cs
+++ b/src/ST.Client.Desktop/Services/Implementation/SteamServiceImpl.cs
@@ -190,6 +190,7 @@ namespace System.Application.Services.Implementation
}
return users;
}
+
public bool UpdateAuthorizedDeviceList(IEnumerable model)
{
var authorizeds = new List();
diff --git a/src/ST.Client.Desktop/Services/Mvvm/SteamConnectService.cs b/src/ST.Client.Desktop/Services/Mvvm/SteamConnectService.cs
index 905b21d0d..97d315778 100644
--- a/src/ST.Client.Desktop/Services/Mvvm/SteamConnectService.cs
+++ b/src/ST.Client.Desktop/Services/Mvvm/SteamConnectService.cs
@@ -236,6 +236,7 @@ namespace System.Application.Services
if (SteamApps.Items.Any())
{
LoadGames(ApiService.OwnsApps(await ISteamService.Instance.GetAppInfos()));
+ InitializeDownloadGameList();
}
//var mainViewModel = (IWindowService.Instance.MainWindow as WindowViewModel);
//await mainViewModel.SteamAppPage.Initialize();
diff --git a/src/ST.Client.Desktop/SevenZipHelper.cs b/src/ST.Client.Desktop/SevenZipHelper.cs
index eccaf3c28..49bacad3c 100644
--- a/src/ST.Client.Desktop/SevenZipHelper.cs
+++ b/src/ST.Client.Desktop/SevenZipHelper.cs
@@ -1,15 +1,21 @@
-using SharpCompress.Archives;
-using SharpCompress.Archives.SevenZip;
-using SharpCompress.Common;
+using SevenZip;
using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
+using CC = System.Common.Constants;
namespace System.Application
{
public static class SevenZipHelper
{
+ static SevenZipHelper()
+ {
+ if (DI.Platform == Platform.Windows)
+ {
+ // ✅ AppContext.BaseDirectory
+ var sevenZipLibraryPath = Path.Combine(AppContext.BaseDirectory, "7z.dll");
+ SevenZipBase.SetLibraryPath(sevenZipLibraryPath);
+ }
+ }
+
///
/// 解压压缩包文件
///
@@ -20,58 +26,26 @@ namespace System.Application
///
public static bool Unpack(string filePath, string dirPath,
IProgress? progress = null,
- float maxProgress = 100f)
+ float maxProgress = CC.MaxProgress)
{
if (!File.Exists(filePath)) return false;
if (Directory.Exists(dirPath)) return false;
using var fs = File.OpenRead(filePath);
float length = fs.Length;
- var isFinish = false;
- CancellationTokenSource? cts = null;
- async void ProgressMonitor()
- {
- try
- {
- while (!isFinish)
- {
- var value = fs.Position / length * maxProgress;
- progress!.Report(value);
- await Task.Delay(200, cts.Token);
- }
- }
- catch (OperationCanceledException)
- {
- }
- }
Directory.CreateDirectory(dirPath);
- using var archive = SevenZipArchive.Open(fs);
+ using var archive = new SevenZipExtractor(fs);
var hasProgress = progress != null;
if (hasProgress)
{
- cts = new();
- try
+ archive.Extracting += (_, e) =>
{
- Task.Factory.StartNew(ProgressMonitor, cts.Token);
- }
- catch (OperationCanceledException)
- {
- }
+ progress!.Report(e.PercentDone);
+ };
}
- var files = archive.Entries.Where(entry => !entry.IsDirectory).ToArray();
- for (int i = 0; i < files.Length; i++)
- {
- var file = files[i];
- file.WriteToDirectory(dirPath, new ExtractionOptions()
- {
- ExtractFullPath = true,
- Overwrite = true
- });
- }
- isFinish = true;
+ archive.ExtractArchive(dirPath);
if (hasProgress)
{
- cts!.Cancel();
progress!.Report(maxProgress);
}
return true;
diff --git a/src/ST.Client.Desktop/TarGZipHelper.cs b/src/ST.Client.Desktop/TarGZipHelper.cs
index cc43a00d5..22111854b 100644
--- a/src/ST.Client.Desktop/TarGZipHelper.cs
+++ b/src/ST.Client.Desktop/TarGZipHelper.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using CC = System.Common.Constants;
namespace System.Application
{
@@ -16,7 +17,7 @@ namespace System.Application
/// 要创建的文件路径
/// 要打包的目录
/// 压缩等级,取值范围在 ~
- /// 进度消息监听
+ /// 进度值监听
///
public static bool Create(string filePath, string dirPath, int level = Deflater.BEST_COMPRESSION, ProgressMessageHandler? progress = null)
{
@@ -66,7 +67,7 @@ namespace System.Application
public static bool Unpack(string filePath, string dirPath,
ProgressMessageHandler? progressMessage = null,
IProgress? progress = null,
- float maxProgress = 100f)
+ float maxProgress = CC.MaxProgress)
{
if (!File.Exists(filePath)) return false;
if (Directory.Exists(dirPath)) return false;
diff --git a/src/ST.Client.Desktop/UI/ViewModels/Pages/GameListPageViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Pages/GameListPageViewModel.cs
index d8c89b07c..f5724c208 100644
--- a/src/ST.Client.Desktop/UI/ViewModels/Pages/GameListPageViewModel.cs
+++ b/src/ST.Client.Desktop/UI/ViewModels/Pages/GameListPageViewModel.cs
@@ -103,7 +103,7 @@ namespace System.Application.UI.ViewModels
.Filter(typeFilter)
.Filter(installFilter)
.ObserveOn(RxApp.MainThreadScheduler)
- .Sort(SortExpressionComparer.Ascending(x => x.DisplayName))
+ .Sort(SortExpressionComparer.Ascending(x => x.DisplayName).ThenByDescending(s => s.SizeOnDisk))
.Bind(out _SteamApps)
.Subscribe(_ =>
{
diff --git a/src/ST.Client.Mobile.Droid/Services/Implementation/MobileAppUpdateServiceImpl.cs b/src/ST.Client.Mobile.Droid/Services/Implementation/MobileAppUpdateServiceImpl.cs
index c2c35d600..9b8c8ab48 100644
--- a/src/ST.Client.Mobile.Droid/Services/Implementation/MobileAppUpdateServiceImpl.cs
+++ b/src/ST.Client.Mobile.Droid/Services/Implementation/MobileAppUpdateServiceImpl.cs
@@ -6,7 +6,7 @@ using System.Application.Models;
using System.Windows;
using XEPlatform = Xamarin.Essentials.Platform;
using static System.Application.UI.Resx.AppResources;
-using static System.Application.Services.IAppUpdateService;
+using CC = System.Common.Constants;
namespace System.Application.Services.Implementation
{
@@ -56,13 +56,13 @@ namespace System.Application.Services.Implementation
base.OnReport(value, str);
if (value == 0)
{
- progress?.Report(MaxProgressValue);
+ progress?.Report(CC.MaxProgress);
progress = notification.NotifyDownload(() => ProgressString,
NotificationType.NewVersionDownloadProgress);
}
- else if (value == MaxProgressValue)
+ else if (value == CC.MaxProgress)
{
- progress?.Report(MaxProgressValue);
+ progress?.Report(CC.MaxProgress);
progress = null;
}
else
diff --git a/src/ST.Client/Resources/OpenSourceLibraryList.mpo b/src/ST.Client/Resources/OpenSourceLibraryList.mpo
index d1ef1514b..c03347e0b 100644
Binary files a/src/ST.Client/Resources/OpenSourceLibraryList.mpo and b/src/ST.Client/Resources/OpenSourceLibraryList.mpo differ
diff --git a/src/ST.Client/Services/IAppUpdateService.cs b/src/ST.Client/Services/IAppUpdateService.cs
index 6ade60ff7..7737ad04b 100644
--- a/src/ST.Client/Services/IAppUpdateService.cs
+++ b/src/ST.Client/Services/IAppUpdateService.cs
@@ -13,13 +13,13 @@ namespace System.Application.Services
{
static IAppUpdateService Instance => DI.Get();
- const float MaxProgressValue = 100f;
-
///
/// 升级包存放文件夹名称
///
const string PackDirName = "UpgradePackages";
+ bool IsNotStartUpdateing { get; }
+
///
/// 进度值
///
diff --git a/src/ST.Client/Services/Implementation/AppUpdateServiceImpl.cs b/src/ST.Client/Services/Implementation/AppUpdateServiceImpl.cs
index 80cdcf3fe..86dd0a30f 100644
--- a/src/ST.Client/Services/Implementation/AppUpdateServiceImpl.cs
+++ b/src/ST.Client/Services/Implementation/AppUpdateServiceImpl.cs
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
using System.Windows.Input;
using static System.Application.Services.CloudService.Constants;
using static System.Application.Services.IAppUpdateService;
+using CC = System.Common.Constants;
namespace System.Application.Services.Implementation
{
@@ -155,6 +156,13 @@ namespace System.Application.Services.Implementation
///
const bool isSupportedResume = false;
+ bool _IsNotStartUpdateing = true;
+ public bool IsNotStartUpdateing
+ {
+ get => _IsNotStartUpdateing;
+ protected set => this.RaiseAndSetIfChanged(ref _IsNotStartUpdateing, value);
+ }
+
float _ProgressValue;
public float ProgressValue
{
@@ -190,7 +198,7 @@ namespace System.Application.Services.Implementation
onReportCalcHashing(0);
var sha256_ = Hashs.String.SHA256(File.OpenRead(filePath)); // 改为带进度的哈希计算
var value = string.Equals(sha256_, sha256, StringComparison.OrdinalIgnoreCase);
- onReportCalcHashing(MaxProgressValue);
+ onReportCalcHashing(CC.MaxProgress);
return value;
}
@@ -203,6 +211,8 @@ namespace System.Application.Services.Implementation
///
protected async void DownloadUpdate()
{
+ var isCallOverwriteUpgrade = false;
+
if (isDownloading) return;
if (!IsSupportedServerDistribution) throw new PlatformNotSupportedException();
@@ -354,10 +364,10 @@ namespace System.Application.Services.Implementation
#endregion
for_end: i++;
- OnReportDownloading3_(i / (float)allFiles.Count * MaxProgressValue);
+ OnReportDownloading3_(i / (float)allFiles.Count * CC.MaxProgress);
}
- OnReport(MaxProgressValue);
+ OnReport(CC.MaxProgress);
OverwriteUpgrade(packDirPath, isIncrement: true);
}
else // 全量更新
@@ -390,7 +400,8 @@ namespace System.Application.Services.Implementation
{
if (UpdatePackVerification(packFilePath, download!.SHA256!)) // (已有文件)哈希验证成功,进行覆盖安装
{
- OverwriteUpgrade(packFilePath, isIncrement: false);
+ isCallOverwriteUpgrade = true;
+ OverwriteUpgrade(packFilePath, isIncrement: false, downloadType: download.DownloadType);
goto end;
}
else // 验证文件失败,删除源文件,将会重新下载
@@ -476,6 +487,7 @@ namespace System.Application.Services.Implementation
requestUri: requestUri,
cacheFilePath,
new Progress(OnReportDownloading));
+ OnReportDownloading(CC.MaxProgress);
if (rsp.IsSuccess)
{
@@ -483,8 +495,8 @@ namespace System.Application.Services.Implementation
if (UpdatePackVerification(packFilePath, download!.SHA256!)) // (下载文件)哈希验证成功,进行覆盖安装
{
- OverwriteUpgrade(packFileName, isIncrement: false, downloadType: download.DownloadType);
- OnReportDownloading(MaxProgressValue);
+ isCallOverwriteUpgrade = true;
+ OverwriteUpgrade(packFilePath, isIncrement: false, downloadType: download.DownloadType);
}
else
{
@@ -504,10 +516,14 @@ namespace System.Application.Services.Implementation
}
end: isDownloading = false;
+ if (!isCallOverwriteUpgrade)
+ {
+ IsNotStartUpdateing = true;
+ }
void Fail(string error)
{
toast.Show(error);
- OnReport(MaxProgressValue);
+ OnReport(CC.MaxProgress);
}
}
@@ -533,6 +549,7 @@ namespace System.Application.Services.Implementation
NewVersionInfo.HasValue() &&
!NewVersionInfo!.DisableAutomateUpdate)
{
+ IsNotStartUpdateing = false;
DownloadUpdate();
}
else
diff --git a/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs b/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs
index d98d37fc8..3b13a7f8a 100644
--- a/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs
+++ b/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs
@@ -17,6 +17,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Application.Services.CloudService.Constants.Headers.Request;
+using CC = System.Common.Constants;
using JsonSerializer = Newtonsoft.Json.JsonSerializer;
namespace System.Application.Services.CloudService
@@ -846,7 +847,7 @@ namespace System.Application.Services.CloudService
totalRead += read;
if (canReportProgress)
{
- var progressValue = MathF.Round((float)totalRead / total, 2, MidpointRounding.AwayFromZero);
+ var progressValue = MathF.Round((float)totalRead / total * CC.MaxProgress, 2, MidpointRounding.AwayFromZero);
if (progressValue != lastProgressValue)
{
progress?.Report(progressValue);
diff --git a/src/ST.Tools.Packager/ST.Tools.Packager.csproj b/src/ST.Tools.Packager/ST.Tools.Packager.csproj
index befb5604e..362596000 100644
--- a/src/ST.Tools.Packager/ST.Tools.Packager.csproj
+++ b/src/ST.Tools.Packager/ST.Tools.Packager.csproj
@@ -1,4 +1,4 @@
-
+
WinExe
@@ -16,6 +16,9 @@
Properties\AssemblyInfo.Version.cs
+
+ Common\Constants.cs
+
Properties\ThisAssembly.cs
diff --git a/tests/ST.Client.UnitTest/HostsFileTest.cs b/tests/ST.Client.UnitTest/HostsFileTest.cs
index 98c035f21..655ed4b54 100644
--- a/tests/ST.Client.UnitTest/HostsFileTest.cs
+++ b/tests/ST.Client.UnitTest/HostsFileTest.cs
@@ -5,6 +5,9 @@ using System.Application.Services.Implementation;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+using System.Text;
using R = System.Application.Properties.Resources;
namespace System.Application
@@ -33,6 +36,7 @@ namespace System.Application
File.WriteAllLines(tempFileName, hosts);
var mock_dps = new Mock();
mock_dps.Setup(x => x.HostsFilePath).Returns(tempFileName);
+ mock_dps.Setup(x => x.Default).Returns(DefaultEncoding);
IDesktopPlatformService dps = mock_dps.Object;
IHostsFileService s = new HostsFileServiceImpl(dps);
action(hosts, s, dps);
@@ -40,6 +44,42 @@ namespace System.Application
tempFileNames.Remove(tempFileName);
}
+ #region DefaultEncoding
+
+ static volatile Encoding? defaultEncoding;
+
+ static Encoding DefaultEncoding
+ {
+ get
+ {
+ if (DI.IsWindowsOrUWP)
+ {
+ if (defaultEncoding == null)
+ {
+ defaultEncoding = CreateDefaultEncoding();
+ }
+ return defaultEncoding;
+ }
+ else
+ {
+ return Encoding.Default;
+ }
+ }
+ }
+
+ static Encoding CreateDefaultEncoding()
+ {
+ int codePage = GetACP();
+ var encoding = CodePagesEncodingProvider.Instance.GetEncoding(codePage);
+ return encoding ?? Encoding.Default;
+ }
+
+ [DllImport("kernel32.dll")]
+ [ResourceExposure(ResourceScope.None)]
+ static extern int GetACP();
+
+ #endregion
+
static bool TestEquals(IEnumerable<(string ip, string domain)> left, IEnumerable<(string ip, string domain)> right)
{
if (left.Count() != right.Count()) return false;