Skip to content

Commit 7fa46bc

Browse files
committed
Major changes: Obsolete .NET5
- Add more PSO2 Game Options. - Adjusted how backup is searched and restored for better concurrent operations. **This release is also marked as final release for .NET5 branch.**
1 parent f1fb1be commit 7fa46bc

15 files changed

+29
-26
lines changed

Leayal.SharedInterfaces/Communication/BootstrapUpdater.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public interface IBootstrapUpdater : IDisposable
193193
///
194194
/// </summary>
195195
/// <param name="parent"></param>
196-
/// <returns>Null to cancel. True to proceed. False to ignore and continue.</returns>
196+
/// <returns>Null to cancel. True to proceed updating. False to ignore and continue.</returns>
197197
bool? DisplayUpdatePrompt(System.Windows.Forms.Form? parent);
198198
#nullable restore
199199

Updater/BootstrapUpdater.cs

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public partial class BootstrapUpdater : IBootstrapUpdater, IBootstrapUpdater_v2
2828
private readonly Architecture _osArch;
2929

3030
private readonly HttpClient wc;
31-
private bool recommendBootstrapUpdate; // requireBootstrapUpdate
31+
private bool recommendBootstrapUpdate, isRuntimeObsoleted; // requireBootstrapUpdate
3232

3333
private readonly int bootstrapversion;
3434

@@ -191,7 +191,13 @@ public Task<BootstrapUpdater_CheckForUpdates> CheckForUpdatesAsync(string rootDi
191191
}
192192
else
193193
{
194-
return await this.ParseFileList_2(doc, rootDirectory, entryExecutableName);
194+
var result_list = await this.ParseFileList_2(doc, rootDirectory, entryExecutableName);
195+
if (result_list.Items.Count == 0)
196+
{
197+
isRuntimeObsoleted = true;
198+
result_list.Items.Add(string.Empty, new UpdateItem(string.Empty, string.Empty, string.Empty, string.Empty));
199+
}
200+
return result_list;
195201
}
196202
}
197203
else
@@ -211,16 +217,22 @@ public Task<BootstrapUpdater_CheckForUpdates> CheckForUpdatesAsync(string rootDi
211217
public bool? DisplayUpdatePrompt(Form? parent)
212218
{
213219
DialogResult result;
214-
if (this.failToCheck)
220+
if (this.isRuntimeObsoleted)
215221
{
216-
if (parent == null)
222+
result = MsgBoxShortHand(parent, $"The current release of the bootstrap is obsolete.{Environment.NewLine}It is recommended to download the newer bootstrap release.{Environment.NewLine}{Environment.NewLine}Do you want to download now or keep using the current version?{Environment.NewLine}Yes = Open the download page{Environment.NewLine}No = Continue using this{Environment.NewLine}Cancel = Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
223+
if (result == DialogResult.Yes)
217224
{
218-
result = MessageBox.Show("Failed to check for launcher updates.\r\nDo you want to continue anyway?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
225+
Process.Start(Path.GetFullPath("explorer.exe", Environment.GetFolderPath(Environment.SpecialFolder.Windows)), @"https://github.com/Leayal/PSO2-Launcher-CSharp/releases/latest")?.Dispose();
219226
}
220-
else
227+
return result switch
221228
{
222-
result = MessageBox.Show(parent, "Failed to check for launcher updates.\r\nDo you want to continue anyway?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
223-
}
229+
DialogResult.No => false,
230+
_ => null
231+
};
232+
}
233+
else if (this.failToCheck)
234+
{
235+
result = MsgBoxShortHand(parent, $"Failed to check for launcher updates.{Environment.NewLine}Do you want to continue anyway?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
224236
return result switch
225237
{
226238
DialogResult.Yes => false,
@@ -231,14 +243,7 @@ public Task<BootstrapUpdater_CheckForUpdates> CheckForUpdatesAsync(string rootDi
231243
{
232244
if (this.recommendBootstrapUpdate)
233245
{
234-
if (parent == null)
235-
{
236-
result = MessageBox.Show("Found new version. Update the launcher?\r\nYes: Update [Recommended]\r\nNo: Continue using old version\r\nCancel: Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
237-
}
238-
else
239-
{
240-
result = MessageBox.Show(parent, "Found new version. Update the launcher?\r\nYes: Update [Recommended]\r\nNo: Continue using old version\r\nCancel: Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
241-
}
246+
result = MsgBoxShortHand(parent, $"Found new version. Update the launcher?{Environment.NewLine}Yes: Update [Recommended]{Environment.NewLine}No: Continue using old version{Environment.NewLine}Cancel: Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
242247
}
243248
else
244249
{
@@ -247,14 +252,7 @@ public Task<BootstrapUpdater_CheckForUpdates> CheckForUpdatesAsync(string rootDi
247252
{
248253
return true;
249254
}
250-
if (parent == null)
251-
{
252-
result = MessageBox.Show("Found new version. Update the launcher?\r\nYes: Update [Recommended]\r\nNo: Continue using old version\r\nCancel: Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
253-
}
254-
else
255-
{
256-
result = MessageBox.Show(parent, "Found new version. Update the launcher?\r\nYes: Update [Recommended]\r\nNo: Continue using old version\r\nCancel: Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
257-
}
255+
result = MsgBoxShortHand(parent, $"Found new version. Update the launcher?{Environment.NewLine}Yes: Update [Recommended]{Environment.NewLine}No: Continue using old version{Environment.NewLine}Cancel: Exit", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
258256
}
259257
return result switch
260258
{
@@ -264,6 +262,11 @@ public Task<BootstrapUpdater_CheckForUpdates> CheckForUpdatesAsync(string rootDi
264262
};
265263
}
266264
}
265+
266+
private static DialogResult MsgBoxShortHand(Form? parent, string msg, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
267+
{
268+
return (parent == null) ? MessageBox.Show(msg, title, buttons, icon) : MessageBox.Show(parent, msg, title, buttons, icon);
269+
}
267270
#nullable restore
268271

269272
public Task<bool?> PerformUpdate(BootstrapUpdater_CheckForUpdates updateinfo)
3.5 KB
Binary file not shown.
12.5 KB
Binary file not shown.

docs/publish/files/LauncherRSS.dll

0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)