@@ -49,8 +49,9 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
49
49
// UpdateApp CheckForUpdate will return value only if the app is squirrel installed
50
50
var newUpdateInfo = await updateManager . CheckForUpdate ( ) . NonNull ( ) . ConfigureAwait ( false ) ;
51
51
52
- var newReleaseVersion = Version . Parse ( newUpdateInfo . FutureReleaseEntry . Version . ToString ( ) ) ;
53
- var currentVersion = Version . Parse ( Constant . Version ) ;
52
+ var newReleaseVersion =
53
+ SemanticVersioning . Version . Parse ( newUpdateInfo . FutureReleaseEntry . Version . ToString ( ) ) ;
54
+ var currentVersion = SemanticVersioning . Version . Parse ( Constant . Version ) ;
54
55
55
56
_api . LogInfo ( ClassName , $ "Future Release <{ Formatted ( newUpdateInfo . FutureReleaseEntry ) } >") ;
56
57
@@ -71,10 +72,13 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
71
72
72
73
if ( DataLocation . PortableDataLocationInUse ( ) )
73
74
{
74
- var targetDestination = updateManager . RootAppDirectory + $ "\\ app-{ newReleaseVersion } \\ { DataLocation . PortableFolderName } ";
75
+ var targetDestination = updateManager . RootAppDirectory +
76
+ $ "\\ app-{ newReleaseVersion } \\ { DataLocation . PortableFolderName } ";
75
77
FilesFolders . CopyAll ( DataLocation . PortableDataPath , targetDestination , ( s ) => _api . ShowMsgBox ( s ) ) ;
76
- if ( ! FilesFolders . VerifyBothFolderFilesEqual ( DataLocation . PortableDataPath , targetDestination , ( s ) => _api . ShowMsgBox ( s ) ) )
77
- _api . ShowMsgBox ( string . Format ( _api . GetTranslation ( "update_flowlauncher_fail_moving_portable_user_profile_data" ) ,
78
+ if ( ! FilesFolders . VerifyBothFolderFilesEqual ( DataLocation . PortableDataPath , targetDestination ,
79
+ ( s ) => _api . ShowMsgBox ( s ) ) )
80
+ _api . ShowMsgBox ( string . Format (
81
+ _api . GetTranslation ( "update_flowlauncher_fail_moving_portable_user_profile_data" ) ,
78
82
DataLocation . PortableDataPath ,
79
83
targetDestination ) ) ;
80
84
}
@@ -87,22 +91,25 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
87
91
88
92
_api . LogInfo ( ClassName , $ "Update success:{ newVersionTips } ") ;
89
93
90
- if ( _api . ShowMsgBox ( newVersionTips , _api . GetTranslation ( "update_flowlauncher_new_update" ) , MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
94
+ if ( _api . ShowMsgBox ( newVersionTips , _api . GetTranslation ( "update_flowlauncher_new_update" ) ,
95
+ MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
91
96
{
92
97
UpdateManager . RestartApp ( Constant . ApplicationFileName ) ;
93
98
}
94
99
}
95
100
catch ( Exception e )
96
101
{
97
- if ( e is HttpRequestException or WebException or SocketException || e . InnerException is TimeoutException )
102
+ if ( e is HttpRequestException or WebException or SocketException ||
103
+ e . InnerException is TimeoutException )
98
104
{
99
- _api . LogException ( ClassName , $ "Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e ) ;
105
+ _api . LogException ( ClassName ,
106
+ $ "Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e ) ;
100
107
}
101
108
else
102
109
{
103
110
_api . LogException ( ClassName , $ "Error Occurred", e ) ;
104
111
}
105
-
112
+
106
113
if ( ! silentUpdate )
107
114
_api . ShowMsg ( _api . GetTranslation ( "update_flowlauncher_fail" ) ,
108
115
_api . GetTranslation ( "update_flowlauncher_check_connection" ) ) ;
@@ -116,14 +123,11 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
116
123
[ UsedImplicitly ]
117
124
private class GithubRelease
118
125
{
119
- [ JsonPropertyName ( "prerelease" ) ]
120
- public bool Prerelease { get ; [ UsedImplicitly ] set ; }
126
+ [ JsonPropertyName ( "prerelease" ) ] public bool Prerelease { get ; [ UsedImplicitly ] set ; }
121
127
122
- [ JsonPropertyName ( "published_at" ) ]
123
- public DateTime PublishedAt { get ; [ UsedImplicitly ] set ; }
128
+ [ JsonPropertyName ( "published_at" ) ] public DateTime PublishedAt { get ; [ UsedImplicitly ] set ; }
124
129
125
- [ JsonPropertyName ( "html_url" ) ]
126
- public string HtmlUrl { get ; [ UsedImplicitly ] set ; }
130
+ [ JsonPropertyName ( "html_url" ) ] public string HtmlUrl { get ; [ UsedImplicitly ] set ; }
127
131
}
128
132
129
133
// https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel/UpdateManager.Factory.cs
@@ -138,10 +142,7 @@ private static async Task<UpdateManager> GitHubUpdateManagerAsync(string reposit
138
142
var latest = releases . Where ( r => ! r . Prerelease ) . OrderByDescending ( r => r . PublishedAt ) . First ( ) ;
139
143
var latestUrl = latest . HtmlUrl . Replace ( "/tag/" , "/download/" ) ;
140
144
141
- var client = new WebClient
142
- {
143
- Proxy = Http . WebProxy
144
- } ;
145
+ var client = new WebClient { Proxy = Http . WebProxy } ;
145
146
var downloader = new FileDownloader ( client ) ;
146
147
147
148
var manager = new UpdateManager ( latestUrl , urlDownloader : downloader ) ;
@@ -158,10 +159,7 @@ private string NewVersionTips(string version)
158
159
159
160
private static string Formatted < T > ( T t )
160
161
{
161
- var formatted = JsonSerializer . Serialize ( t , new JsonSerializerOptions
162
- {
163
- WriteIndented = true
164
- } ) ;
162
+ var formatted = JsonSerializer . Serialize ( t , new JsonSerializerOptions { WriteIndented = true } ) ;
165
163
166
164
return formatted ;
167
165
}
0 commit comments