@@ -79,21 +79,32 @@ async public void GetAvailableUpdates(GenericWidget Widget, bool DeepCheck = fal
79
79
80
80
new Template_LoadingPage ( Widget ) . UpdateWidget ( ) ;
81
81
82
- string old_path = Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".wingetui" , "CurrentSessionToken" ) ;
83
- string new_path = Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "UniGetUI" , "CurrentSessionToken" ) ;
82
+ string path_1 = Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".wingetui" , "CurrentSessionToken" ) ;
83
+ string path_2 = Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "UniGetUI" , "CurrentSessionToken" ) ;
84
+ string path_3 = Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "UniGetUI" , "Configuration" , "CurrentSessionToken" ) ;
85
+
86
+ DateTime date_1 = DateTime . MinValue ;
87
+ DateTime date_2 = DateTime . MinValue ;
88
+ DateTime date_3 = DateTime . MinValue ;
84
89
85
90
string SessionTokenFile ;
86
- if ( ! File . Exists ( new_path ) )
87
- SessionTokenFile = old_path ;
88
- else if ( ! File . Exists ( old_path ) )
89
- SessionTokenFile = new_path ;
90
- else
91
+
92
+ if ( File . Exists ( path_1 ) ) date_1 = new FileInfo ( path_1 ) . LastWriteTimeUtc ;
93
+ if ( File . Exists ( path_2 ) ) date_2 = new FileInfo ( path_2 ) . LastWriteTimeUtc ;
94
+ if ( File . Exists ( path_3 ) ) date_3 = new FileInfo ( path_3 ) . LastWriteTimeUtc ;
95
+
96
+ if ( date_1 > date_2 && date_1 > date_3 ) SessionTokenFile = path_1 ;
97
+ else if ( date_2 > date_1 && date_2 > date_3 ) SessionTokenFile = path_2 ;
98
+ else if ( date_3 > date_1 && date_3 > date_2 ) SessionTokenFile = path_3 ;
99
+ else SessionTokenFile = path_3 ; // If none of the files exist
100
+
101
+ if ( ! File . Exists ( SessionTokenFile ) )
91
102
{
92
- FileInfo old_path_data = new ( old_path ) ;
93
- DateTime old_created = old_path_data . LastWriteTimeUtc ; //File Creation
94
- FileInfo new_path_data = new ( new_path ) ;
95
- DateTime new_created = new_path_data . LastWriteTimeUtc ; //File Creation
96
- SessionTokenFile = old_created > new_created ? old_path : new_path ;
103
+ Logger . Log ( "GetAvailableUpdates: ABORTED connection to UniGetUI due to NO_AUTH_TOKEN" ) ;
104
+ result . Succeeded = is_connected_to_host = false ;
105
+ result . ErrorReason = "NO_AUTH_TOKEN" ;
106
+ if ( UpdateCheckFinished != null ) UpdateCheckFinished ( this , result ) ;
107
+ return ;
97
108
}
98
109
99
110
StreamReader reader = new ( SessionTokenFile ) ;
0 commit comments