Skip to content

Commit de47778

Browse files
committed
Bugfix
- Fixed background self-update checker uses wrong URL.
1 parent c99018c commit de47778

24 files changed

+21
-9
lines changed

LauncherCore/Classes/BackgroundSelfUpdateChecker.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Text.Json;
77
using System.IO;
88
using System.Runtime.InteropServices;
9+
using System.Collections.Frozen;
910

1011
namespace Leayal.PSO2Launcher.Core.Classes
1112
{
@@ -36,9 +37,9 @@ public TimeSpan TickTime
3637
}
3738
}
3839

39-
private readonly IReadOnlyDictionary<string, string> files;
40+
private readonly FrozenDictionary<string, string> files;
4041

41-
public BackgroundSelfUpdateChecker(in CancellationToken cancellationToken, HttpClient client, Dictionary<string, string> filelist)
42+
public BackgroundSelfUpdateChecker(in CancellationToken cancellationToken, HttpClient client, FrozenDictionary<string, string> filelist)
4243
{
4344
this.appExit = cancellationToken;
4445
this.files = filelist;
@@ -89,7 +90,7 @@ private async ValueTask TimerTicked()
8990

9091
private async Task<IReadOnlyDictionary<string, string>> GetFileList()
9192
{
92-
var data = await this.webclient.GetStringAsync("https://leayal.github.io/PSO2-Launcher-CSharp/publish/v6/update.json").ConfigureAwait(false);
93+
var data = await this.webclient.GetStringAsync(Updater.SharedCode.LauncherUpdateManifest).ConfigureAwait(false);
9394
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
9495

9596
using (var document = JsonDocument.Parse(data))

LauncherCore/GameLauncher.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Leayal.SharedInterfaces;
2-
using Microsoft.Win32.SafeHandles;
32
using Leayal.SharedInterfaces.Communication;
43
using System;
54
using System.Threading;

LauncherCore/LauncherCore.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
<None Remove="Resources\_bgimg_dark.png" />
3232
<None Remove="Resources\_bgimg_light.png" />
3333
</ItemGroup>
34+
<ItemGroup>
35+
<Compile Include="..\Updater\SharedCode.cs" Link="SharedCode.cs" />
36+
</ItemGroup>
3437
<ItemGroup>
3538
<EmbeddedResource Include="Resources\empty_d4455ebc2bef618f29106da7692ebc1a" />
3639
<EmbeddedResource Include="Resources\ico-item-AlphaReactor.png" />

LauncherCore/StaticResources.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Security.Principal;
32

43
namespace Leayal.PSO2Launcher.Core
54
{

LauncherCore/Windows/MainMenuWindow.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using Leayal.Shared;
2626
using System.Windows.Input;
2727
using System.Runtime.CompilerServices;
28+
using System.Collections.Frozen;
2829

2930
namespace Leayal.PSO2Launcher.Core.Windows
3031
{
@@ -253,8 +254,8 @@ static void AddToDictionary(Dictionary<string, string> d, string p, int o)
253254
AddToDictionary(dictionary, Path.Combine(binDir, "native-x86"), removelen);
254255
}
255256

256-
dictionary.TrimExcess();
257-
var selfupdatecheck = new BackgroundSelfUpdateChecker(this.cancelAllOperation.Token, this.webclient, dictionary);
257+
// dictionary.TrimExcess();
258+
var selfupdatecheck = new BackgroundSelfUpdateChecker(this.cancelAllOperation.Token, this.webclient, dictionary.Count == 0 ? FrozenDictionary<string, string>.Empty : dictionary.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase));
258259
selfupdatecheck.UpdateFound += this.OnSelfUpdateFound;
259260
return selfupdatecheck;
260261
}

Updater/BootstrapUpdater.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public Task<BootstrapUpdater_CheckForUpdates> CheckForUpdatesAsync(string rootDi
224224
#if DEBUG
225225
jsonData = File.ReadAllText(Path.Combine(rootDirectory, @"..\docs\publish\v8\update.json"));
226226
#else
227-
jsonData = await this.wc.GetStringAsync("https://leayal.github.io/PSO2-Launcher-CSharp/publish/v8/update.json");
227+
jsonData = await this.wc.GetStringAsync(SharedCode.LauncherUpdateManifest);
228228
#endif
229229
}
230230
catch

Updater/SharedCode.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Duplicate this file via LINK property in project file instead of importing Updater.dll assembly into LauncherCore (avoid loading Assembly).
2+
3+
namespace Leayal.PSO2Launcher.Updater
4+
{
5+
static class SharedCode
6+
{
7+
public const string LauncherUpdateManifest = "https://leayal.github.io/PSO2-Launcher-CSharp/publish/v8/update.json";
8+
}
9+
}
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)