File tree Expand file tree Collapse file tree 2 files changed +12
-23
lines changed
Flow.Launcher.Infrastructure Expand file tree Collapse file tree 2 files changed +12
-23
lines changed Original file line number Diff line number Diff line change 1717using Flow . Launcher . Plugin ;
1818using System . Text . Json . Serialization ;
1919using System . Threading ;
20+ using System . Text . Json ;
2021
2122namespace Flow . Launcher . Core
2223{
@@ -51,7 +52,7 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
5152 var newReleaseVersion = Version . Parse ( newUpdateInfo . FutureReleaseEntry . Version . ToString ( ) ) ;
5253 var currentVersion = Version . Parse ( Constant . Version ) ;
5354
54- Log . Info ( $ "|Updater.UpdateApp|Future Release <{ newUpdateInfo . FutureReleaseEntry . Formatted ( ) } >") ;
55+ Log . Info ( $ "|Updater.UpdateApp|Future Release <{ Formatted ( newUpdateInfo . FutureReleaseEntry ) } >") ;
5556
5657 if ( newReleaseVersion <= currentVersion )
5758 {
@@ -151,5 +152,15 @@ public string NewVersionTips(string version)
151152
152153 return tips ;
153154 }
155+
156+ private static string Formatted < T > ( T t )
157+ {
158+ var formatted = JsonSerializer . Serialize ( t , new JsonSerializerOptions
159+ {
160+ WriteIndented = true
161+ } ) ;
162+
163+ return formatted ;
164+ }
154165 }
155166}
Original file line number Diff line number Diff line change 22
33using System ;
44using System . IO ;
5- using System . Text . Json ;
6- using System . Text . Json . Serialization ;
75
86namespace Flow . Launcher . Infrastructure
97{
108 public static class Helper
119 {
12- static Helper ( )
13- {
14- jsonFormattedSerializerOptions . Converters . Add ( new JsonStringEnumConverter ( ) ) ;
15- }
16-
1710 /// <summary>
1811 /// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
1912 /// </summary>
@@ -71,20 +64,5 @@ public static void ValidateDirectory(string path)
7164 Directory . CreateDirectory ( path ) ;
7265 }
7366 }
74-
75- private static readonly JsonSerializerOptions jsonFormattedSerializerOptions = new JsonSerializerOptions
76- {
77- WriteIndented = true
78- } ;
79-
80- public static string Formatted < T > ( this T t )
81- {
82- var formatted = JsonSerializer . Serialize ( t , new JsonSerializerOptions
83- {
84- WriteIndented = true
85- } ) ;
86-
87- return formatted ;
88- }
8967 }
9068}
You can’t perform that action at this time.
0 commit comments