Skip to content

Commit 0669a0a

Browse files
Fix warnings Handle nulls, update process handling, and add config UseRidGraph
1 parent daf4b64 commit 0669a0a

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

src/IntelOrca.OpenLauncher.Core/Build.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,20 @@ public Version? ParsedVersion
3333

3434
public override string ToString() => Version;
3535

36-
public int CompareTo(Build other)
36+
public int CompareTo(Build? other)
3737
{
38+
ArgumentNullException.ThrowIfNull(other);
39+
3840
var a = PublishedAt;
3941
var b = other.PublishedAt;
42+
4043
if (a is null && b is null)
4144
return 0;
4245
if (a is null)
4346
return 1;
4447
if (b is null)
4548
return -1;
49+
4650
return b.Value.CompareTo(a.Value);
4751
}
4852
}

src/IntelOrca.OpenLauncher.Core/BuildAsset.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,13 @@ public class BuildAssetComparer : IComparer<BuildAsset>
117117

118118
public static BuildAssetComparer Default = new BuildAssetComparer();
119119

120-
public int Compare(BuildAsset x, BuildAsset y)
120+
public int Compare(BuildAsset? x, BuildAsset? y)
121121
{
122+
if (x == null || y == null)
123+
{
124+
throw new ArgumentNullException("BuildAsset objects cannot be null");
125+
}
126+
122127
if (x.Platform == y.Platform)
123128
{
124129
if (x.Arch != y.Arch)

src/IntelOrca.OpenLauncher.Core/InstallService.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text;
88
using System.Threading;
99
using System.Threading.Tasks;
10+
using System.Xml.Linq;
1011

1112
namespace IntelOrca.OpenLauncher.Core
1213
{
@@ -73,12 +74,15 @@ public Task Launch()
7374
{
7475
RedirectStandardError = true
7576
};
76-
var process = Process.Start(psi);
77+
78+
var process = Process.Start(psi) ?? throw new InvalidOperationException($"Failed to start process '{psi}'");
79+
7780
var outputBuilder = new StringBuilder();
7881
var sw = Stopwatch.StartNew();
82+
7983
while (sw.ElapsedMilliseconds < 2000)
8084
{
81-
var s = process.StandardError.ReadToEnd();
85+
string? s = process.StandardError.ReadToEnd();
8286
if (s != null)
8387
outputBuilder.Append(s);
8488

src/IntelOrca.OpenLauncher.Core/IntelOrca.OpenLauncher.Core.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
<ItemGroup>
77
<PackageReference Include="Octokit" Version="0.51.0" />
88
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
9-
<PackageReference Include="System.Text.Json" Version="8.0.4" />
109
</ItemGroup>
1110
</Project>

src/IntelOrca.OpenLauncher.Core/Shell.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public int RunProcess(string name, params string[] args)
2525
{
2626
psi.ArgumentList.Add(arg);
2727
}
28-
var p = Process.Start(psi);
28+
var p = Process.Start(psi) ?? throw new InvalidOperationException($"Failed to start process '{name}'");
2929
p.WaitForExit();
3030
return p.ExitCode;
3131
}

src/openlauncher/openlauncher.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
1919
<ApplicationIcon>resources\logo.ico</ApplicationIcon>
2020
</PropertyGroup>
21+
<ItemGroup>
22+
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" />
23+
</ItemGroup>
2124
<ItemGroup>
2225
<Compile Update="Properties\Resources.Designer.cs">
2326
<DesignTime>True</DesignTime>

0 commit comments

Comments
 (0)