diff --git a/UI/MainForm.cs b/UI/MainForm.cs index 0913f241..314a0875 100644 --- a/UI/MainForm.cs +++ b/UI/MainForm.cs @@ -1339,15 +1339,35 @@ public sealed class MainForm : Form, IMessageFilter { if (!_shutdownStarted) { - _spellIconPackageStatusLabel.Text = $"下载失败:{ex.Message}"; - _settingsToolTip.SetToolTip(_spellIconPackageStatusLabel, ex.ToString()); + var releaseUrl = SpellIconPackageDownloadService.ReleasesPageUrl; + var status = $"下载失败,请到 {releaseUrl} 手动下载 SpellIcons.shgpack。"; + _spellIconPackageStatusLabel.Text = status; + _settingsToolTip.SetToolTip( + _spellIconPackageStatusLabel, + status + Environment.NewLine + Environment.NewLine + ex); AppendLog($"技能/物品图标数据包下载失败: {ex.Message}"); - MessageBox.Show( + var openPage = MessageBox.Show( this, - ex.Message, + "自动下载失败。请到以下页面手动下载 SpellIcons.shgpack,放到程序目录的 data 文件夹:" + + Environment.NewLine + + Environment.NewLine + + releaseUrl + + Environment.NewLine + + Environment.NewLine + + $"保存位置:{SpellIconCatalog.PackagePath}" + + Environment.NewLine + + Environment.NewLine + + $"原因:{ex.Message}" + + Environment.NewLine + + Environment.NewLine + + "是否现在打开下载页面?", "下载数据包失败", - MessageBoxButtons.OK, + MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (openPage == DialogResult.Yes) + { + OpenSpellIconReleasePage(); + } } } finally @@ -1411,6 +1431,30 @@ public sealed class MainForm : Form, IMessageFilter } } + private void OpenSpellIconReleasePage() + { + var releaseUrl = SpellIconPackageDownloadService.ReleasesPageUrl; + try + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(releaseUrl) + { + UseShellExecute = true + }); + } + catch (Exception ex) + { + MessageBox.Show( + this, + $"无法打开下载页面:{ex.Message}" + + Environment.NewLine + + Environment.NewLine + + releaseUrl, + "Shigure", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + } + } + private void OpenModuleDirectory() { var moduleDirectory = _moduleStore.ModuleDirectory; diff --git a/UI/SpellIconPackageDownloadService.cs b/UI/SpellIconPackageDownloadService.cs index 8eed7c14..7adb7c47 100644 --- a/UI/SpellIconPackageDownloadService.cs +++ b/UI/SpellIconPackageDownloadService.cs @@ -155,9 +155,7 @@ internal sealed class SpellIconPackageDownloadService : IDisposable throw new HttpRequestException( "无法从 GitHub 获取技能/物品数据包。" + Environment.NewLine - + string.Join(Environment.NewLine, errors) - + Environment.NewLine - + $"可从 {ReleasesPageUrl} 手动下载 {AssetName}。"); + + string.Join(Environment.NewLine, errors)); } private static async Task TryResolveAsync(