@@ -166,21 +166,33 @@ string GetProjectVersion(string path)
166166 MessageBox . Show ( "Invalid projectversion data found in '" + versionPath + "'.\n \n File Content:\n " + string . Join ( "\n " , data ) . ToString ( ) ) ;
167167 }
168168 }
169- else // maybe 4.x
169+ else // maybe its 4.x
170170 {
171171 versionPath = Path . Combine ( path , "ProjectSettings" , "ProjectSettings.asset" ) ;
172172 if ( File . Exists ( versionPath ) == true )
173173 {
174+ // first try if its ascii format
175+ var data = File . ReadAllLines ( versionPath ) ;
176+ if ( data != null && data . Length > 0 && data [ 0 ] . IndexOf ( "YAML" ) > - 1 )
177+ {
178+ // in text format, then we need to try library file instead
179+ var newVersionPath = Path . Combine ( path , "Library" , "AnnotationManager" ) ;
180+ if ( File . Exists ( versionPath ) == true )
181+ {
182+ versionPath = newVersionPath ;
183+ }
184+ }
185+
174186 // try to get version data out from binary asset
175- var data = File . ReadAllBytes ( versionPath ) ;
176- if ( data != null && data . Length > 0 )
187+ var binData = File . ReadAllBytes ( versionPath ) ;
188+ if ( binData != null && binData . Length > 0 )
177189 {
178190 int dataLen = 7 ;
179191 int startIndex = 20 ;
180192 var bytes = new byte [ dataLen ] ;
181193 for ( int i = 0 ; i < dataLen ; i ++ )
182194 {
183- bytes [ i ] = data [ startIndex + i ] ;
195+ bytes [ i ] = binData [ startIndex + i ] ;
184196 }
185197 version = Encoding . UTF8 . GetString ( bytes ) ;
186198 }
@@ -1005,6 +1017,19 @@ private void btnOpenUpdateWebsite_Click(object sender, EventArgs e)
10051017 }
10061018 }
10071019
1020+ private void tabControl1_SelectedIndexChanged ( object sender , EventArgs e )
1021+ {
1022+ // if enter Updates tab, then automatically fetch list of unity versions if list is empty (not fetched)
1023+ if ( ( ( TabControl ) sender ) . SelectedIndex == 3 ) // FIXME: fixed index 3 for this tab..
1024+ {
1025+ if ( gridUnityUpdates . Rows . Count == 0 )
1026+ {
1027+ FetchListOfUnityUpdates ( ) ;
1028+ }
1029+ }
1030+ }
1031+
1032+
10081033
10091034 #endregion UI events
10101035
@@ -1146,7 +1171,6 @@ void FetchListOfUnityUpdates()
11461171 private void UnityVersionsListDownloaded ( object sender , DownloadStringCompletedEventArgs e )
11471172 {
11481173 // TODO check for error..
1149-
11501174 SetStatus ( "Downloading list of unity versions..Done" ) ;
11511175 isDownloadUnityList = false ;
11521176 // parse to list
0 commit comments