Skip to content

Commit

Permalink
Last Code QA pls??
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-nyan committed Jun 30, 2024
1 parent 9f9a49a commit 324aebe
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public bool TryCheckGameLocationHYP()
if (subKey == null) continue;

string[] subKeyKey = subKey.GetSubKeyNames();
if (subKeyKey?.Length == 0) continue;
if (subKeyKey.Length == 0) continue;

string? gameKeyName = subKeyKey?.FirstOrDefault(x => x.Equals(LauncherBizName, StringComparison.OrdinalIgnoreCase));

Check warning on line 564 in CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Conditional access qualifier expression is known to be null or not null

Conditional access qualifier expression is known to be not null

Check warning

Code scanning / QDNET

Conditional access qualifier expression is known to be null or not null Warning

Conditional access qualifier expression is known to be not null
if (string.IsNullOrEmpty(gameKeyName)) continue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using CollapseLauncher.Helper.Metadata;
using Hi3Helper;
using Hi3Helper.Shared.Region;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down
5 changes: 3 additions & 2 deletions CollapseLauncher/Classes/Interfaces/Class/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Hi3Helper.Http;
using System;
using System.IO;
// ReSharper disable CheckNamespace

namespace CollapseLauncher
{
Expand Down Expand Up @@ -171,7 +172,7 @@ public bool IsMatch(string versionToCompare)
public bool IsMatch(GameVersion? versionToCompare)
{
if (versionToCompare == null) return false;
return Major == versionToCompare?.Major && Minor == versionToCompare?.Minor && Build == versionToCompare?.Build && Revision == versionToCompare?.Revision;
return Major == versionToCompare.Value.Major && Minor == versionToCompare.Value.Minor && Build == versionToCompare.Value.Build && Revision == versionToCompare.Value.Revision;
}

public GameVersion GetIncrementedVersion()
Expand All @@ -186,7 +187,7 @@ public GameVersion GetIncrementedVersion()
NextMajor++;
}

return new GameVersion(new int[] { NextMajor, NextMinor, Build, Revision });
return new GameVersion(new[] { NextMajor, NextMinor, Build, Revision });
}

public Version ToVersion() => new Version(Major, Minor, Build, Revision);
Expand Down
2 changes: 0 additions & 2 deletions CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
using CollapseLauncher.Helper.Update;
using CollapseLauncher.Interfaces;
using CollapseLauncher.Pages;
using CollapseLauncher.Statics;
using CommunityToolkit.WinUI;
using CommunityToolkit.WinUI.Animations;
using Hi3Helper;
using Hi3Helper.Shared.ClassStruct;
using Hi3Helper.Shared.Region;
using InnoSetupHelper;
using Microsoft.UI;
using Microsoft.UI.Input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private async Task<string> FetchDataIntegrityURL(PresetConfig Profile)

GameVersion = _Entry.data.game.latest.version;

return _RepoList[GameVersion];
return _RepoList[GameVersion ?? throw new InvalidOperationException()];

Check warning

Code scanning / QDNET

Possible 'System.NullReferenceException' Warning

Possible 'System.NullReferenceException'
}

internal bool IsSourceGameExist(PresetConfig Profile)
Expand Down

0 comments on commit 324aebe

Please sign in to comment.