88using System . Linq ;
99using System . Net . Http ;
1010using System . Net . Http . Headers ;
11- using System . Text ;
1211using System . Threading . Tasks ;
1312using System . Windows ;
1413
@@ -46,7 +45,7 @@ public static async Task DownloadUpdate(string packageFile, string updaterFile,
4645 startTime = DateTimeOffset . Now ;
4746
4847 i = 0 ;
49- for ( int len = packageStream . Read ( buffer , 0 , 1024 * 1024 ) ; len != 0 ; len = packageStream . Read ( buffer , 0 , 1024 * 1024 ) )
48+ for ( int len = packageStream . Read ( buffer , 0 , 1024 * 1024 ) ; len != 0 ; len = packageStream . Read ( buffer , 0 , 1024 * 1024 ) )
5049 {
5150
5251 packageTotalBytesRead += len ;
@@ -85,7 +84,7 @@ public static async Task DownloadUpdate(string packageFile, string updaterFile,
8584 double updaterProgress = CalcUtil . CalcProgress ( updaterContentLength , updaterTotalBytesRead ) ;
8685 MainVM . SetUpdaterData ( updaterContentLength , updaterTotalBytesRead , updaterProgress ) ;
8786
88- if ( i % 15 == 0 )
87+ if ( i % 15 == 0 )
8988 {
9089 double downloadSpeed = updaterTotalBytesRead / ( DateTimeOffset . Now - startTime ) . TotalSeconds ;
9190 MainVM . SetDownloadSpeed ( downloadSpeed ) ;
@@ -124,15 +123,15 @@ public static (double, string) FormatSize(double rawSize, bool isSpeed = false)
124123 if ( isSpeed ) unit = " B/s" ;
125124
126125 int divisions = 0 ;
127- while ( size > 1 )
126+ while ( size > 1 )
128127 {
129128 size /= 1024 ;
130129 divisions ++ ;
131130
132131 if ( divisions > 3 ) break ;
133132 }
134133
135- if ( divisions > 0 )
134+ if ( divisions > 0 )
136135 {
137136 size *= 1024 ;
138137 divisions -- ;
@@ -159,7 +158,7 @@ public static class UpdateHelper
159158
160159 public static async void CheckUpdateAsync ( bool forceUpdate = false )
161160 {
162- if ( Directory . Exists ( Constants . UpdateFolder ) ) Directory . Delete ( Constants . UpdateFolder , true ) ;
161+ if ( Directory . Exists ( Constants . UpdateFolder ) ) Directory . Delete ( Constants . UpdateFolder , true ) ;
163162
164163 HttpRequestMessage request = new HttpRequestMessage ( ) { RequestUri = new Uri ( Constants . ReleasesURL ) , Method = HttpMethod . Get } ;
165164 request . Headers . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "application/json" ) ) ;
@@ -169,7 +168,7 @@ public static async void CheckUpdateAsync(bool forceUpdate = false)
169168 string res = await response . Content . ReadAsStringAsync ( ) ;
170169
171170 JArray ja = JArray . Parse ( res ) ;
172- foreach ( JObject release in ja )
171+ foreach ( JObject release in ja )
173172 {
174173 List < string > tokenizedName = release [ "name" ] . ToString ( ) . Split ( ) . ToList ( ) ;
175174 if ( tokenizedName [ 0 ] != Constants . AppName ) continue ;
@@ -189,7 +188,7 @@ public static async void CheckUpdateAsync(bool forceUpdate = false)
189188
190189 public static async void GetUpdate ( )
191190 {
192- if ( ! Directory . Exists ( Constants . UpdateFolder ) ) Directory . CreateDirectory ( Constants . UpdateFolder ) ;
191+ if ( ! Directory . Exists ( Constants . UpdateFolder ) ) Directory . CreateDirectory ( Constants . UpdateFolder ) ;
193192
194193 await UpdateUtil . DownloadUpdate ( SourceFile , UpdaterFile , latestVersionTag , client ) ;
195194 UpdateUtil . ExtractUpdate ( SourceFile , ExtractTarget ) ;
0 commit comments