Skip to content

Commit df6455b

Browse files
committed
[EncTool] CodeQA
1 parent 7ca16e5 commit df6455b

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

CollapseLauncher/Classes/CachesManagement/Honkai/Fetch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ private async ValueTask<ValueTuple<int, long>> BuildAssetIndex(CacheAssetType ty
256256

257257
// Parse asset index file from UABT
258258
BundleFile bundleFile = new BundleFile(stream);
259-
SerializedFile serializeFile = new SerializedFile(bundleFile.fileList!.FirstOrDefault()!.stream);
259+
SerializedFile serializeFile = new SerializedFile(bundleFile.fileList!.FirstOrDefault()!.Stream);
260260

261261
// Try to get the asset index file as byte[] and load it as TextAsset
262262
byte[] dataRaw = serializeFile.GetDataFirstOrDefaultByName("packageversion.txt");

CollapseLauncher/Classes/RepairManagement/Genshin/Fetch.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ private async Task<QueryProperty> GetDispatcherQuery(HttpClient client, Cancella
584584
DispatchInfo dispatchInfo = await dispatchHelper.LoadDispatchInfo();
585585

586586
// DEBUG ONLY: Show encrypted Proto as JSON+Base64 format
587-
string dFormat = $"Query Response (RAW Encrypted form):\r\n{dispatchInfo?.content}";
587+
string dFormat = $"Query Response (RAW Encrypted form):\r\n{dispatchInfo?.Content}";
588588
#if DEBUG
589589
LogWriteLine(dFormat);
590590
#endif
@@ -598,10 +598,8 @@ private async Task<QueryProperty> GetDispatcherQuery(HttpClient client, Cancella
598598

599599
private async Task<QueryProperty> TryDecryptAndParseDispatcher(DispatchInfo dispatchInfo, DispatchHelper dispatchHelper)
600600
{
601-
YSDispatchDec dispatchDecryptor = new YSDispatchDec();
602-
603601
// Decrypt the dispatcher data from the dispatcher info content
604-
byte[] decryptedData = dispatchDecryptor.DecryptYSDispatch(dispatchInfo.content, GameVersionManager.GamePreset.DispatcherKeyBitLength ?? 0, GameVersionManager.GamePreset.DispatcherKey);
602+
byte[] decryptedData = YSDispatchDec.DecryptYSDispatch(dispatchInfo.Content, GameVersionManager.GamePreset.DispatcherKeyBitLength ?? 0, GameVersionManager.GamePreset.DispatcherKey);
605603

606604
// DEBUG ONLY: Show the decrypted Proto as Base64 format
607605
string dFormat = $"Proto Response (RAW Decrypted form):\r\n{Convert.ToBase64String(decryptedData)}";

CollapseLauncher/Classes/RepairManagement/Honkai/Check.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ protected override ConfiguredTaskAwaitable<byte[]> GetCryptoHashAsync<T>(
791791
if (_isGame820PostVersion && typeof(T) == typeof(MD5))
792792
{
793793
// Create the Hasher provider by explicitly specify the length of the stream.
794-
MhyMurmurHash2_64B murmurHashProvider = MhyMurmurHash2_64B.CreateForStream(stream, 0, stream.Length);
794+
MhyMurmurHash264B murmurHashProvider = MhyMurmurHash264B.CreateForStream(stream, 0, stream.Length);
795795

796796
// Pass the provider and return the task
797797
return Hash.GetHashAsync(stream,

CollapseLauncher/Classes/RepairManagement/Honkai/Fetch.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ private static bool GetAssetBundleRefSpan(
386386
keyIndexes = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
387387
var alternativeLookup = keyIndexes.GetAlternateLookup<ReadOnlySpan<char>>();
388388

389-
ref AssetBundleReferenceKVPData startKvpIndex = ref MemoryMarshal.GetReference(span.KeyValuePair);
390-
ref AssetBundleReferenceKVPData endKvpIndex = ref Unsafe.Add(ref startKvpIndex, span.KeyValuePair.Length);
389+
ref AssetBundleReferenceKvpData startKvpIndex = ref MemoryMarshal.GetReference(span.KeyValuePair);
390+
ref AssetBundleReferenceKvpData endKvpIndex = ref Unsafe.Add(ref startKvpIndex, span.KeyValuePair.Length);
391391

392392
int currentDataOffset = 0;
393393
ref AssetBundleReferenceData startDataOffset = ref MemoryMarshal.GetReference(span.Data);
@@ -535,7 +535,7 @@ private HonkaiRepairAssetIgnore GetIgnoredAssetsProperty()
535535
}
536536

537537
// Find the cache asset. If null, then return
538-
CacheAsset cacheAsset = cacheProperty.Item1.FirstOrDefault(x => x!.N!.EndsWith($"{HashID.CGMetadata}"));
538+
CacheAsset cacheAsset = cacheProperty.Item1.FirstOrDefault(x => x!.N!.EndsWith($"{HashID.CgMetadata}"));
539539

540540
// Deserialize and build video index into asset index
541541
await BuildVideoIndex(downloadClient, cacheAsset, cacheProperty.Item2, assetIndex, ignoredAssetIDs, cacheProperty.Item4, token);

CollapseLauncher/XAMLs/MainApp/Pages/HomePage.GameLauncher.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,13 @@ private async void StartResizableWindowPayload(string executableName, IGam
581581
LogWriteLine("Game executable directory is not set! Cannot start Resizable Window payload!", LogType.Error);
582582
return;
583583
}
584-
585-
var resizableWindowHook = new ResizableWindowHook();
586584

587585
// Set the pos + size reinitialization to true if the game is Honkai: Star Rail
588586
// This is required for Honkai: Star Rail since the game will reset its pos + size. Making
589587
// it impossible to use custom resolution (but since you are using Collapse, it's now
590588
// possible :teriStare:)
591589
bool isNeedToResetPos = gameType == GameNameType.StarRail;
592-
await Task.Run(() => resizableWindowHook.StartHook(executableName, height, width, ResizableWindowHookToken.Token,
590+
await Task.Run(() => ResizableWindowHook.StartHook(executableName, height, width, ResizableWindowHookToken.Token,
593591
isNeedToResetPos, ILoggerHelper.GetILogger(), gameExecutableDirectory));
594592
}
595593
catch (Exception ex)

0 commit comments

Comments
 (0)