Skip to content

Commit 29f1c61

Browse files
committed
fix: 检查新版本时json解析错误
1 parent 21a2347 commit 29f1c61

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Image2Display/Image2Display/Assets/Languages/en-US.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,6 @@
229229
<system:String x:Key="Copied">Copied!</system:String>
230230
<system:String x:Key="Error">Error</system:String>
231231
<system:String x:Key="CheckUpdateFail">Check update failed.</system:String>
232+
<system:String x:Key="Notify">Notify</system:String>
233+
<system:String x:Key="NoUpdate">This is the latest version.</system:String>
232234
</ResourceDictionary>

Image2Display/Image2Display/Assets/Languages/zh-CN.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,6 @@
234234
<system:String x:Key="Copied">已复制!</system:String>
235235
<system:String x:Key="Error">错误</system:String>
236236
<system:String x:Key="CheckUpdateFail">更新检查失败,请确保网络连接正常</system:String>
237+
<system:String x:Key="Notify">提示</system:String>
238+
<system:String x:Key="NoUpdate">当前已是最新版本。</system:String>
237239
</ResourceDictionary>

Image2Display/Image2Display/Image2Display.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Authors>chenxuuu</Authors>
1111
<Company>https://github.com/chenxuuu/image2display</Company>
1212
<Description>Image data conversion tool</Description>
13-
<Version>1.1.6.4</Version>
13+
<Version>1.1.6.5</Version>
1414
<Platforms>AnyCPU;ARM32;ARM64;x64;x86</Platforms>
1515
</PropertyGroup>
1616

Image2Display/Image2Display/ViewModels/SettingsViewModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private async Task CheckUpdate()
9191
HttpClient client = new HttpClient();
9292
client.DefaultRequestHeaders.Add("user-agent", "Image2Display");
9393
string data = await client.GetStringAsync("https://api.github.com/repos/chenxuuu/Image2Display/releases/latest");
94-
var jo = JsonSerializer.Deserialize<JsonObject>(data);
94+
var jo = JsonNode.Parse(data)?.AsObject();
9595
var ver = (string)jo!["tag_name"]!;
9696

9797
var vLocal = Utils.Version.Split('.');
@@ -112,6 +112,12 @@ private async Task CheckUpdate()
112112
NewVersion = ver;
113113
HasNewVersion = true;
114114
}
115+
else
116+
{
117+
await DialogHelper.ShowNotifyDialog(Utils.GetI18n<string>("Notify"),
118+
$"{Utils.GetI18n<string>("NoUpdate")}",
119+
Symbol.Emoji);
120+
}
115121
}
116122
catch (Exception ex)
117123
{

0 commit comments

Comments
 (0)