Skip to content

Commit

Permalink
v2.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Aug 1, 2021
1 parent 003df68 commit 953f8d6
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 135 deletions.
1 change: 1 addition & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Read what we [milestones](https://github.com/SteamTools-Team/SteamTools/mileston
* [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)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
* [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)
Expand Down
3 changes: 2 additions & 1 deletion release-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
17. 改进 开机自启动现仅对当前用户生效
18. 改进 程序根目录结构,相较于上一个版本移除了 Bin 文件夹,减少 dll 文件数量
19. 改进 优化了发行版本压缩包体积(移除了 CEF 模块,对于需要使用第三方账号快速登录功能可使用上一个版本的压缩包中 \Bin\CEF 将这个文件夹拷贝到 \CEF 中)
20. Android/macOS/Linux 版现已开启 Beta/Alpha 测试,可从 GitHub/Gitee 上下载
20. 改进 现已编译为 ReadyToRun (R2R) 格式,这将改进应用程序的启动时间和延迟(仅 Windows 版本)
21. Android/macOS/Linux 版现已开启 Beta/Alpha 测试,可从 GitHub/Gitee 上下载

***

Expand Down
2 changes: 2 additions & 0 deletions src/Common.CoreLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using System.Runtime.CompilerServices;
using static System.Properties.ThisAssembly;

#pragma warning disable SYSLIB0025 // 类型或成员已过时
[assembly: SuppressIldasm]
#pragma warning restore SYSLIB0025 // 类型或成员已过时
[assembly: AssemblyTitle(AssemblyTrademark)]
[assembly: AssemblyTrademark(AssemblyTrademark)]
[assembly: AssemblyDescription(AssemblyDescription)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Configuration>Release</Configuration>
<PublishDir>bin\Release\Publish\win-x64</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunUseCrossgen2>false</PublishReadyToRunUseCrossgen2>
<PublishReadyToRunComposite>false</PublishReadyToRunComposite>
<Platform>Any CPU</Platform>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>false</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<EnableCompressionInSingleFile>false</EnableCompressionInSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/ST.Client.Desktop/ST.Client.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<PackageReference Include="Gameloop.Vdf" Version="0.6.1" />
<PackageReference Include="NLog" Version="4.7.10" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.7.3" />
<PackageReference Include="SharpCompress" Version="0.28.3" />
<PackageReference Include="SharpZipLib" Version="1.3.2" />
<PackageReference Include="StatefulModel.Standard" Version="0.1.0" />
<!--<PackageReference Include="Titanium.Web.Proxy" Version="3.1.1344" />-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public DesktopAppUpdateServiceImpl(IToast toast, ICloudServiceClient client, IOp
/// </summary>
protected abstract void OnExit();

protected override void OverwriteUpgrade(string value, bool isIncrement)
protected override void OverwriteUpgrade(string value, bool isIncrement, AppDownloadType downloadType)
{
if (isIncrement) // 增量更新
{
Expand All @@ -38,7 +38,19 @@ protected override void OverwriteUpgrade(string value, bool isIncrement)
Directory.Delete(dirPath, true);
}

if (TarGZipHelper.Unpack(value, dirPath, progress: new Progress<float>(OnReportDecompressing), maxProgress: MaxProgressValue))
var isOK = downloadType switch
{
AppDownloadType.Compressed_GZip
=> TarGZipHelper.Unpack(value, dirPath,
progress: new Progress<float>(OnReportDecompressing),
maxProgress: MaxProgressValue),
AppDownloadType.Compressed_7z
=> SevenZipHelper.Unpack(value, dirPath,
progress: new Progress<float>(OnReportDecompressing),
maxProgress: MaxProgressValue),
_ => throw new NotSupportedException(),
};
if (isOK)
{
OnReport(MaxProgressValue);
IOPath.FileTryDelete(value);
Expand Down
80 changes: 80 additions & 0 deletions src/ST.Client.Desktop/SevenZipHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using SharpCompress.Archives;
using SharpCompress.Archives.SevenZip;
using SharpCompress.Common;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace System.Application
{
public static class SevenZipHelper
{
/// <summary>
/// 解压压缩包文件
/// </summary>
/// <param name="filePath">要解压的压缩包文件路径</param>
/// <param name="dirPath">要解压的文件夹路径,文件夹必须不存在</param>
/// <param name="progress">进度值监听</param>
/// <param name="maxProgress"></param>
/// <returns></returns>
public static bool Unpack(string filePath, string dirPath,
IProgress<float>? progress = null,
float maxProgress = 100f)
{
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);
var hasProgress = progress != null;
if (hasProgress)
{
cts = new();
try
{
Task.Factory.StartNew(ProgressMonitor, cts.Token);
}
catch (OperationCanceledException)
{
}
}
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;
if (hasProgress)
{
cts!.Cancel();
progress!.Report(maxProgress);
}
return true;
}
}
}
37 changes: 30 additions & 7 deletions src/ST.Client.Desktop/TarGZipHelper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.Zip.Compression;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace System.Application
Expand Down Expand Up @@ -75,23 +76,45 @@ public static bool Unpack(string filePath, string dirPath,
// https://github.com/icsharpcode/SharpZipLib/blob/v1.3.1/src/ICSharpCode.SharpZipLib/Zip/Compression/Streams/InflaterInputStream.cs#L542
float length = fs.Length;
var isFinish = false;
CancellationTokenSource? cts = null;
async void ProgressMonitor()
{
while (!isFinish)
try
{
while (!isFinish)
{
var value = fs.Position / length * maxProgress;
progress!.Report(value);
await Task.Delay(200, cts.Token);
}
}
catch (OperationCanceledException)
{
var value = fs.Position / length * maxProgress;
progress.Report(value);
await Task.Delay(200);
}
}
Directory.CreateDirectory(dirPath);
using var s = new GZipInputStream(fs);
using var archive = TarArchive.CreateInputTarArchive(s, Encoding.UTF8);
if (progressMessage != null) archive.ProgressMessageEvent += progressMessage;
if (progress != null) Task.Factory.StartNew(ProgressMonitor);
var hasProgress = progress != null;
if (hasProgress)
{
cts = new();
try
{
Task.Factory.StartNew(ProgressMonitor, cts.Token);
}
catch (OperationCanceledException)
{
}
}
archive.ExtractContents(dirPath);
isFinish = true;
progress?.Report(maxProgress);
if (hasProgress)
{
cts!.Cancel();
progress!.Report(maxProgress);
}
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ST.Client.Desktop/UI/Resx/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@
<value>使用硬件加速</value>
</data>
<data name="Settings_RestartEffective" xml:space="preserve">
<value>*需重启生效</value>
<value>*需重启软件后生效</value>
</data>
<data name="Settings_General_UpdateChannel" xml:space="preserve">
<value>下载更新渠道</value>
Expand All @@ -1502,4 +1502,4 @@
<data name="BrowseBaseDirectory" xml:space="preserve">
<value>浏览基目录</value>
</data>
</root>
</root>
17 changes: 13 additions & 4 deletions src/ST.Client.Desktop/UI/Resx/R.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Properties;
using System.Reactive.Linq;
using AppRes = System.Application.UI.Resx.AppResources;
#if __MOBILE__
Expand All @@ -30,7 +31,7 @@ public sealed class R : ReactiveObject
static R()
{
DefaultCurrentUICulture = CultureInfo.CurrentUICulture;
Languages = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
var languagesDict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "", "Auto" },
{ "zh-Hans", "Chinese(Simplified)" },
Expand All @@ -39,9 +40,17 @@ static R()
{ "ko", "Koreana" },
{ "ja", "Japanese" },
{ "ru", "Russian" },
//{ "es", "Spanish" },
//{ "it", "Italian" },
}.ToList();
{ "es", "Spanish" },
{ "it", "Italian" },
};
#if !DEBUG
if (new Version(ThisAssembly.Version) < new Version(2, 5))
{
languagesDict.Remove("es");
languagesDict.Remove("it");
}
#endif
Languages = languagesDict.ToList();
SteamLanguages = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "zh-CN", "schinese" },
Expand Down
14 changes: 13 additions & 1 deletion src/ST.Client.Desktop/UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,19 @@ public MainWindowViewModel() : base()
AddTabItem<SteamAccountPageViewModel>();
AddTabItem<GameListPageViewModel>();
AddTabItem<LocalAuthPageViewModel>();
AddTabItem<ArchiSteamFarmPlusPageViewModel>();

var isVersion_2_5_OR_GREATER =
#if DEBUG
true;
#else
new Version(ThisAssembly.Version) < new Version(2, 5);
#endif

if (isVersion_2_5_OR_GREATER)
{
AddTabItem<ArchiSteamFarmPlusPageViewModel>();
}

//AddTabItem<SteamIdlePageViewModel>();
if (DI.Platform == Platform.Windows)
AddTabItem<GameRelatedPageViewModel>();
Expand Down
Binary file modified src/ST.Client/Resources/OpenSourceLibraryList.mpo
Binary file not shown.
Loading

0 comments on commit 953f8d6

Please sign in to comment.