@@ -166,21 +166,33 @@ string GetProjectVersion(string path)
166
166
MessageBox . Show ( "Invalid projectversion data found in '" + versionPath + "'.\n \n File Content:\n " + string . Join ( "\n " , data ) . ToString ( ) ) ;
167
167
}
168
168
}
169
- else // maybe 4.x
169
+ else // maybe its 4.x
170
170
{
171
171
versionPath = Path . Combine ( path , "ProjectSettings" , "ProjectSettings.asset" ) ;
172
172
if ( File . Exists ( versionPath ) == true )
173
173
{
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
+
174
186
// 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 )
177
189
{
178
190
int dataLen = 7 ;
179
191
int startIndex = 20 ;
180
192
var bytes = new byte [ dataLen ] ;
181
193
for ( int i = 0 ; i < dataLen ; i ++ )
182
194
{
183
- bytes [ i ] = data [ startIndex + i ] ;
195
+ bytes [ i ] = binData [ startIndex + i ] ;
184
196
}
185
197
version = Encoding . UTF8 . GetString ( bytes ) ;
186
198
}
@@ -1005,6 +1017,19 @@ private void btnOpenUpdateWebsite_Click(object sender, EventArgs e)
1005
1017
}
1006
1018
}
1007
1019
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
+
1008
1033
1009
1034
#endregion UI events
1010
1035
@@ -1146,7 +1171,6 @@ void FetchListOfUnityUpdates()
1146
1171
private void UnityVersionsListDownloaded ( object sender , DownloadStringCompletedEventArgs e )
1147
1172
{
1148
1173
// TODO check for error..
1149
-
1150
1174
SetStatus ( "Downloading list of unity versions..Done" ) ;
1151
1175
isDownloadUnityList = false ;
1152
1176
// parse to list
0 commit comments