1616
1717namespace Wox . Core
1818{
19- public static class Updater
19+ public class Updater
2020 {
21- private static readonly Internationalization Translater = InternationalizationManager . Instance ;
21+ public string GitHubRepository { get ; }
2222
23- public static async Task UpdateApp ( )
23+ public Updater ( string gitHubRepository )
24+ {
25+ GitHubRepository = gitHubRepository ;
26+ }
27+
28+ public async Task UpdateApp ( )
2429 {
2530 UpdateManager m ;
2631 UpdateInfo u ;
2732
2833 try
2934 {
30- m = await GitHubUpdateManager ( Constant . Repository ) ;
35+ m = await GitHubUpdateManager ( GitHubRepository ) ;
3136 }
3237 catch ( Exception e ) when ( e is HttpRequestException || e is WebException || e is SocketException )
3338 {
@@ -66,8 +71,8 @@ public static async Task UpdateApp()
6671 await m . ApplyReleases ( u ) ;
6772 await m . CreateUninstallerRegistryEntry ( ) ;
6873
69- var newVersionTips = Translater . GetTranslation ( "newVersionTips" ) ;
70- newVersionTips = string . Format ( newVersionTips , fr . Version ) ;
74+ var newVersionTips = this . NewVersinoTips ( fr . Version . ToString ( ) ) ;
75+
7176 MessageBox . Show ( newVersionTips ) ;
7277 Log . Info ( $ "|Updater.UpdateApp|Update success:{ newVersionTips } ") ;
7378 }
@@ -90,7 +95,7 @@ private class GithubRelease
9095 }
9196
9297 /// https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel/UpdateManager.Factory.cs
93- private static async Task < UpdateManager > GitHubUpdateManager ( string repository )
98+ private async Task < UpdateManager > GitHubUpdateManager ( string repository )
9499 {
95100 var uri = new Uri ( repository ) ;
96101 var api = $ "https://api.github.com/repos{ uri . AbsolutePath } /releases";
@@ -109,7 +114,7 @@ private static async Task<UpdateManager> GitHubUpdateManager(string repository)
109114 return manager ;
110115 }
111116
112- public static string NewVersinoTips ( string version )
117+ public string NewVersinoTips ( string version )
113118 {
114119 var translater = InternationalizationManager . Instance ;
115120 var tips = string . Format ( translater . GetTranslation ( "newVersionTips" ) , version ) ;
0 commit comments