@@ -20,8 +20,6 @@ namespace CUERipper.Avalonia.Services
2020{
2121 public class UpdateService : IUpdateService
2222 {
23- private const string UpdateCheckFilePath = "CT_LAST_UPDATE_CHECK" ;
24-
2523 private readonly HttpClient _httpClient ;
2624 private readonly ICUEConfigFacade _config ;
2725 private readonly ILogger _logger ;
@@ -137,19 +135,19 @@ private async Task<GithubReleaseContainer> GetLatestReleaseAsync()
137135 /// <returns></returns>
138136 private GithubReleaseContainer GetLatestReleaseFromDiskCache ( )
139137 {
140- if ( ! File . Exists ( UpdateCheckFilePath ) ) return new ( false , null , null ) ;
138+ if ( ! File . Exists ( Constants . PathUpdateCacheFile ) ) return new ( false , null , null ) ;
141139
142- string [ ] content = File . ReadAllLines ( UpdateCheckFilePath ) ;
140+ string [ ] content = File . ReadAllLines ( Constants . PathUpdateCacheFile ) ;
143141 if ( content . Length != 4 )
144142 {
145- _logger . LogError ( "Content of {File} is incorrect." , UpdateCheckFilePath ) ;
143+ _logger . LogError ( "Content of {File} is incorrect." , Constants . PathUpdateCacheFile ) ;
146144 return new ( false , null , null ) ;
147145 }
148146
149147 if ( ! DateTime . TryParseExact ( content [ 0 ] , "yyyyMMdd" , null , System . Globalization . DateTimeStyles . None
150148 , out DateTime lastUpdateCheck ) )
151149 {
152- _logger . LogError ( "Content of {File} is incorrect, can't parse to datetime." , UpdateCheckFilePath ) ;
150+ _logger . LogError ( "Content of {File} is incorrect, can't parse to datetime." , Constants . PathUpdateCacheFile ) ;
153151 return new ( false , null , null ) ;
154152 }
155153
@@ -188,7 +186,7 @@ private void WriteReleasesToDiskCache(GithubRelease? githubRelease, string? auth
188186 fileContent . Append ( Environment . NewLine ) ;
189187 fileContent . Append ( "EOF" ) ;
190188
191- File . WriteAllText ( UpdateCheckFilePath , fileContent . ToString ( ) ) ;
189+ File . WriteAllText ( Constants . PathUpdateCacheFile , fileContent . ToString ( ) ) ;
192190 }
193191 catch ( Exception ex )
194192 {
@@ -269,15 +267,15 @@ public async Task<bool> DownloadAsync(EventHandler<GenericProgressEventArgs> pro
269267 {
270268 if ( ! UpdateMetadata . UpdateAvailable ( ) ) return false ;
271269
272- if ( ! Directory . Exists ( Constants . PathUpdate ) )
270+ if ( ! Directory . Exists ( Constants . PathUpdateFolder ) )
273271 {
274- Directory . CreateDirectory ( Constants . PathUpdate ) ;
272+ Directory . CreateDirectory ( Constants . PathUpdateFolder ) ;
275273 }
276274
277275 try
278276 {
279- var setupFile = $ "{ Constants . PathUpdate } Update-{ UpdateMetadata ! . Version } .exe";
280- var hashFile = $ "{ Constants . PathUpdate } Update-{ UpdateMetadata . Version } .sha256";
277+ var setupFile = $ "{ Constants . PathUpdateFolder } Update-{ UpdateMetadata ! . Version } .exe";
278+ var hashFile = $ "{ Constants . PathUpdateFolder } Update-{ UpdateMetadata . Version } .sha256";
281279
282280 await DownloadFile ( UpdateMetadata ! . Uri
283281 , contentSize : UpdateMetadata . Size
@@ -340,7 +338,7 @@ private bool VerifyFile(string setupFile, string hashFile)
340338
341339 public void Install ( )
342340 {
343- var setupFile = $ "{ Constants . PathUpdate } Update-{ UpdateMetadata ! . Version } .exe";
341+ var setupFile = $ "{ Constants . PathUpdateFolder } Update-{ UpdateMetadata ! . Version } .exe";
344342 Process . Start ( new ProcessStartInfo
345343 {
346344 FileName = Path . GetFullPath ( setupFile ) ,
0 commit comments