Skip to content

Commit 2c06d09

Browse files
authored
Preview 1.82.4 Release (#617)
# What's new? - 1.82.4 - **[Fix]** (GI/SR/ZZZ Repair) Fixed Quick Repair does not check for file size matching, by @neon-nyan & @bagusnl - **[Fix]** Tray icon not appearing in any builds before Windows 11 21H2 (inc W10), by @shatyuka & @bagusnl - **[Imp]** Sentry enhancements, by @bagusnl - Disable error collection in debug builds - Add current loaded game location and CDN preference to breadcrumbs - Add a way to enable debug logging via console by adding "DEBUG_SENTRY" env var and setting it to true - **[Imp]** Update dependencies, by @bagusnl - **[Imp]** Save last known working CDN to config, by @bagusnl - **[Fix]** ArgumentNull crash on StartCarouselAutoScroll, by @bagusnl <details> <summary>Changelog Prefixes</summary> ``` **[New]** **[Imp]** **[Fix]** **[Loc]** **[Doc]** ``` </details>
2 parents 3581cb4 + 0c76376 commit 2c06d09

34 files changed

+352
-206
lines changed

.github/workflows/qodana-scan.yml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,72 @@ on:
99

1010
jobs:
1111
qodana:
12-
runs-on: ubuntu-latest
12+
runs-on: windows-latest
13+
strategy:
14+
matrix:
15+
configuration: [Release] # No need to distribute Debug builds
16+
platform: [x64]
17+
framework: [net9.0-windows10.0.22621.0]
18+
19+
env:
20+
Configuration: ${{ matrix.configuration }}
21+
Platform: ${{ matrix.platform }}
22+
DOTNET_INSTALL_DIR: '.\.dotnet'
23+
DOTNET_VERSION: '9.x'
24+
DOTNET_QUALITY: 'ga'
25+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
26+
1327
permissions:
1428
actions: read
1529
contents: write
1630
pull-requests: write
1731
checks: write
1832
security-events: write
33+
1934
steps:
2035
- uses: actions/[email protected]
2136
with:
2237
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
2338
submodules: recursive # many many submodules
2439

25-
- name: 'Qodana Scan'
26-
uses: JetBrains/qodana-action@latest
40+
# - name: Install winget
41+
# uses: Cyberboss/install-winget@v1
42+
43+
# - name: Install Qodana CLI
44+
# uses: crazy-max/ghaction-chocolatey@v3
45+
# with:
46+
# args: install qodana --pre --confirm
47+
48+
# - name: Verify Qodana
49+
# run: |
50+
# Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1"
51+
# refreshenv
52+
# qodana --version
53+
54+
- name: Install .NET
55+
uses: actions/setup-dotnet@v4
56+
with:
57+
dotnet-version: ${{ env.DOTNET_VERSION }}
58+
dotnet-quality: ${{ env.DOTNET_QUALITY }}
59+
cache: true
60+
cache-dependency-path: CollapseLauncher/packages.lock.json
61+
62+
# - name: Qodana Scan
63+
# run: |
64+
# Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1"
65+
# refreshenv
66+
# qodana scan --ide QDNET-EAP -o ${{ runner.temp }}\qodana\results --cache-dir ${{ runner.temp }}\qodana\cache
67+
68+
- name: Qodana Scan
69+
uses: JetBrains/qodana-action@next
70+
continue-on-error: true
2771
with:
28-
pr-mode: false
72+
args: --ide,QDNET-EAP
2973
env:
30-
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} # read the steps about it below
74+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
3175

3276
- uses: github/codeql-action/upload-sarif@v3
77+
if: always()
78+
continue-on-error: true
3379
with:
34-
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json
80+
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json

CollapseLauncher/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
using Hi3Helper;
44
using Hi3Helper.SentryHelper;
55
using Hi3Helper.Shared.Region;
6-
using Hi3Helper.Win32.Native;
76
using Hi3Helper.Win32.Native.Enums;
7+
using Hi3Helper.Win32.Native.LibraryImport;
88
using Microsoft.UI;
99
using Microsoft.UI.Xaml;
1010
using Microsoft.UI.Xaml.Media;

CollapseLauncher/Classes/GamePropertyVault.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using Hi3Helper;
1414
using Hi3Helper.SentryHelper;
1515
using Hi3Helper.Shared.ClassStruct;
16-
using Hi3Helper.Win32.Native;
16+
using Hi3Helper.Win32.Native.ManagedTools;
1717
using Microsoft.UI.Xaml;
1818
using System;
1919
using System.Collections.Generic;
@@ -78,6 +78,7 @@ internal GamePresetProperty(UIElement uiElementParent, RegionResourceProp apiRes
7878

7979
SentryHelper.CurrentGameCategory = _GameVersion.GameName;
8080
SentryHelper.CurrentGameRegion = _GameVersion.GameRegion;
81+
SentryHelper.CurrentGameLocation = _GameVersion.GameDirPath;
8182
SentryHelper.CurrentGameInstalled = _GameVersion.IsGameInstalled();
8283
SentryHelper.CurrentGameUpdated = _GameVersion.IsGameVersionMatch();
8384
SentryHelper.CurrentGameHasPreload = _GameVersion.IsGameHasPreload();
@@ -117,7 +118,7 @@ internal string _GameExecutableNameWithoutExtension
117118

118119
internal bool IsGameRunning
119120
{
120-
get => PInvoke.IsProcessExist(_GameExecutableName, out _, out _, Path.Combine(_GameVersion?.GameDirPath ?? "", _GameExecutableName), ILoggerHelper.GetILogger());
121+
get => ProcessChecker.IsProcessExist(_GameExecutableName, out _, out _, Path.Combine(_GameVersion?.GameDirPath ?? "", _GameExecutableName), ILoggerHelper.GetILogger());
121122
}
122123

123124
#nullable enable
@@ -136,7 +137,7 @@ internal bool IsGameRunning
136137
Process process = processArr[i];
137138
int processId = process.Id;
138139

139-
string? processPath = PInvoke.GetProcessPathByProcessId(processId, ILoggerHelper.GetILogger());
140+
string? processPath = ProcessChecker.GetProcessPathByProcessId(processId, ILoggerHelper.GetILogger());
140141
string expectedProcessPath = Path.Combine(_GameVersion?.GameDirPath ?? "", _GameExecutableName);
141142
if (string.IsNullOrEmpty(processPath) || !expectedProcessPath.Equals(processPath, StringComparison.OrdinalIgnoreCase)
142143
|| process.MainWindowHandle == IntPtr.Zero)

CollapseLauncher/Classes/Helper/WindowUtility.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
using Hi3Helper.SentryHelper;
66
using Hi3Helper.Shared.Region;
77
using Hi3Helper.Win32.FileDialogCOM;
8-
using Hi3Helper.Win32.Native;
98
using Hi3Helper.Win32.Native.Enums;
9+
using Hi3Helper.Win32.Native.LibraryImport;
10+
using Hi3Helper.Win32.Native.ManagedTools;
1011
using Hi3Helper.Win32.Native.Structs;
1112
using Hi3Helper.Win32.Screen;
1213
using Microsoft.Graphics.Display;
@@ -557,7 +558,7 @@ internal static void SetWindowTitlebarIcon(nint smallIconPtr, nint largeIconPtr)
557558
return;
558559
}
559560

560-
PInvoke.SetWindowIcon(CurrentWindowPtr, smallIconPtr, largeIconPtr);
561+
Windowing.SetWindowIcon(CurrentWindowPtr, smallIconPtr, largeIconPtr);
561562
}
562563

563564
#endregion

CollapseLauncher/Classes/Properties/InnerLauncherConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using CollapseLauncher.Pages;
55
using Hi3Helper;
66
using Hi3Helper.Shared.ClassStruct;
7-
using Hi3Helper.Win32.Native;
7+
using Hi3Helper.Win32.Native.LibraryImport;
88
using Microsoft.UI.Text;
99
using Microsoft.UI.Xaml;
1010
using Microsoft.UI.Xaml.Controls;

CollapseLauncher/Classes/RegionManagement/FallbackCDNUtil.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ public static async Task DownloadCDNFallbackContent(DownloadClient downloadClien
172172
{
173173
// Get the preferred CDN first and try get the content
174174
CDNURLProperty preferredCDN = GetPreferredCDN();
175+
SentryHelper.AppCdnOption = preferredCDN.Name;
175176
bool isSuccess = await TryGetCDNContent(preferredCDN, downloadClient, outputPath, relativeURL, parallelThread, token);
176177

177178
// If successful, then return
@@ -186,7 +187,12 @@ public static async Task DownloadCDNFallbackContent(DownloadClient downloadClien
186187
isSuccess = await TryGetCDNContent(fallbackCDN, downloadClient, outputPath, relativeURL, parallelThread, token);
187188

188189
// If successful, then return
189-
if (isSuccess) return;
190+
if (isSuccess)
191+
{
192+
var i = CDNList.IndexOf(fallbackCDN);
193+
SetAndSaveConfigValue("CurrentCDN", i);
194+
return;
195+
}
190196
}
191197

192198
// If all of them failed, then throw an exception
@@ -219,7 +225,12 @@ public static async Task DownloadCDNFallbackContent(DownloadClient downloadClien
219225
isSuccess = await TryGetCDNContent(fallbackCDN, downloadClient, outputStream, relativeURL, token);
220226

221227
// If successful, then return
222-
if (isSuccess) return;
228+
if (isSuccess)
229+
{
230+
var i = CDNList.IndexOf(fallbackCDN);
231+
SetAndSaveConfigValue("CurrentCDN", i);
232+
return;
233+
}
223234
}
224235

225236
// If all of them failed, then throw an exception
@@ -433,11 +444,11 @@ private static async ValueTask<CDNUtilHTTPStatus> TryGetURLStatus(CDNURLProperty
433444
return CDNUtilHTTPStatus.CreateInitializationError();
434445
}
435446
}
436-
447+
437448
public static CDNURLProperty GetPreferredCDN()
438449
{
439450
// Get the CurrentCDN index
440-
int cdnIndex = GetAppConfigValue("CurrentCDN").ToInt();
451+
var cdnIndex = GetAppConfigValue("CurrentCDN").ToInt();
441452

442453
// Fallback to the first CDN if index < 0 or > length of the list
443454
if (cdnIndex < 0 || cdnIndex > CDNList.Count - 1)

CollapseLauncher/Classes/RegistryMonitor/RegistryMonitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
using Hi3Helper;
1313
using Hi3Helper.SentryHelper;
14-
using Hi3Helper.Win32.Native;
1514
using Hi3Helper.Win32.Native.Enums;
15+
using Hi3Helper.Win32.Native.LibraryImport;
1616
using Microsoft.Win32;
1717
using System;
1818
using System.ComponentModel;

CollapseLauncher/Classes/RepairManagement/Genshin/Check.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Hi3Helper.Data;
55
using Hi3Helper.EncTool.Parser.AssetIndex;
66
using Hi3Helper.SentryHelper;
7-
using Hi3Helper.Win32.Native;
7+
using Hi3Helper.Win32.Native.ManagedTools;
88
using System;
99
using System.Buffers;
1010
using System.Collections.Concurrent;
@@ -49,7 +49,7 @@ private async Task Check(List<PkgVersionProperties> assetIndex, CancellationToke
4949
try
5050
{
5151
var threadCount = _threadCount;
52-
var isSsd = PInvoke.IsDriveSsd(_gameStreamingAssetsPath, ILoggerHelper.GetILogger());
52+
var isSsd = DriveTypeChecker.IsDriveSsd(_gameStreamingAssetsPath, ILoggerHelper.GetILogger());
5353
if (!isSsd)
5454
{
5555
threadCount = 1;
@@ -292,10 +292,13 @@ async ValueTask<bool> IsFileMatched(Action<bool> storeAsStreaming, Action<bool>
292292

293293
async ValueTask<bool> IsFileHashMatch(FileInfo fileInfo, ReadOnlyMemory<byte> hashToCompare, CancellationToken cancelToken)
294294
{
295-
if (_useFastMethod) return true; // Skip the hash calculation if the fast method is enabled
296295
// Refresh the fileInfo
297296
fileInfo.Refresh();
298297

298+
if (fileInfo.Length != asset.fileSize) return false; // Skip the hash calculation if the file size is different
299+
300+
if (_useFastMethod) return true; // Skip the hash calculation if the fast method is enabled
301+
299302
// Try to get filestream
300303
await using FileStream fileStream = await fileInfo.NaivelyOpenFileStreamAsync(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
301304

CollapseLauncher/Classes/RepairManagement/StarRail/Check.cs

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
using Hi3Helper.Data;
33
using Hi3Helper.SentryHelper;
44
using Hi3Helper.Shared.ClassStruct;
5-
using Hi3Helper.Win32.Native;
5+
using Hi3Helper.Win32.Native.LibraryImport;
6+
using HtmlAgilityPack;
67
using System;
78
using System.Collections.Generic;
89
using System.IO;
@@ -141,33 +142,20 @@ private async ValueTask CheckGenericAssetType(FilePropertiesRemote asset, List<F
141142
// Check if the file exist or has unmatched size
142143
if (!fileInfo.Exists)
143144
{
144-
// Update the total progress and found counter
145-
_progressAllSizeFound += asset.S;
146-
_progressAllCountFound++;
147-
148-
// Set the per size progress
149-
_progressPerFileSizeCurrent = asset.S;
150-
151-
// Increment the total current progress
152-
_progressAllSizeCurrent += asset.S;
153-
154-
Dispatch(() => AssetEntry.Add(
155-
new AssetProperty<RepairAssetType>(
156-
Path.GetFileName(asset.N),
157-
ConvertRepairAssetTypeEnum(asset.FT),
158-
Path.GetDirectoryName(asset.N),
159-
asset.S,
160-
null,
161-
null
162-
)
163-
));
164-
targetAssetIndex.Add(asset);
165-
145+
AddIndex();
166146
LogWriteLine($"File [T: {asset.FT}]: {asset.N} is not found", LogType.Warning, true);
167-
168147
return;
169148
}
170149

150+
if (fileInfo.Length != asset.S)
151+
{
152+
if (fileInfo.Name.Contains("pkg_version")) return;
153+
AddIndex();
154+
LogWriteLine($"File [T: {asset.FT}]: {asset.N} has unmatched size " +
155+
$"(Local: {fileInfo.Length} <=> Remote: {asset.S}",
156+
LogType.Warning, true);
157+
}
158+
171159
// Skip CRC check if fast method is used
172160
if (_useFastMethod)
173161
{
@@ -203,6 +191,32 @@ private async ValueTask CheckGenericAssetType(FilePropertiesRemote asset, List<F
203191

204192
LogWriteLine($"File [T: {asset.FT}]: {asset.N} is broken! Index CRC: {asset.CRC} <--> File CRC: {HexTool.BytesToHexUnsafe(localCRC)}", LogType.Warning, true);
205193
}
194+
return;
195+
196+
void AddIndex()
197+
{
198+
// Update the total progress and found counter
199+
_progressAllSizeFound += asset.S;
200+
_progressAllCountFound++;
201+
202+
// Set the per size progress
203+
_progressPerFileSizeCurrent = asset.S;
204+
205+
// Increment the total current progress
206+
_progressAllSizeCurrent += asset.S;
207+
208+
Dispatch(() => AssetEntry.Add(
209+
new AssetProperty<RepairAssetType>(
210+
Path.GetFileName(asset.N),
211+
ConvertRepairAssetTypeEnum(asset.FT),
212+
Path.GetDirectoryName(asset.N),
213+
asset.S,
214+
null,
215+
null
216+
)
217+
));
218+
targetAssetIndex.Add(asset);
219+
}
206220
}
207221

208222
private async ValueTask CheckAssetType(FilePropertiesRemote asset, List<FilePropertiesRemote> targetAssetIndex, CancellationToken token)

0 commit comments

Comments
 (0)