@@ -36,7 +36,7 @@ public static class Tools
36
36
/// <returns></returns>
37
37
public static string GetProjectVersion ( string path )
38
38
{
39
- var version = "" ;
39
+ string version = null ;
40
40
41
41
if ( File . Exists ( Path . Combine ( path , "ProjectVersionOverride.txt" ) ) )
42
42
{
@@ -75,16 +75,16 @@ public static string GetProjectVersion(string path)
75
75
Console . WriteLine ( "Invalid projectversion data found in '" + versionPath + "'.\n \n File Content:\n " + string . Join ( "\n " , data ) . ToString ( ) ) ;
76
76
}
77
77
}
78
- else // maybe its 4.x
78
+ else // maybe its 4.x?
79
79
{
80
80
versionPath = Path . Combine ( path , "ProjectSettings" , "ProjectSettings.asset" ) ;
81
81
if ( File . Exists ( versionPath ) == true )
82
82
{
83
83
// first try if its ascii format
84
84
var data = File . ReadAllLines ( versionPath ) ;
85
- if ( data != null && data . Length > 0 && data [ 0 ] . IndexOf ( "YAML" ) > - 1 )
85
+ if ( data != null && data . Length > 0 && data [ 0 ] . IndexOf ( "YAML" ) > - 1 ) // we have ascii
86
86
{
87
- // in text format, then we need to try library file instead
87
+ // check library if available
88
88
var newVersionPath = Path . Combine ( path , "Library" , "AnnotationManager" ) ;
89
89
if ( File . Exists ( newVersionPath ) == true )
90
90
{
@@ -103,8 +103,17 @@ public static string GetProjectVersion(string path)
103
103
{
104
104
bytes [ i ] = binData [ startIndex + i ] ;
105
105
}
106
- version = Encoding . UTF8 . GetString ( bytes ) ;
106
+ var vertemp = Encoding . UTF8 . GetString ( bytes ) ;
107
+ // probably failed if no dots
108
+ if ( vertemp . IndexOf ( "." ) > - 1 ) version = vertemp ;
109
+
110
+ }
111
+ // if still nothing, take a quess based on yaml year info, lets say 2011 is unity 3.5
112
+ if ( string . IsNullOrEmpty ( version ) == true && data [ 1 ] . ToLower ( ) . IndexOf ( "unity3d.com,2011" ) > - 1 )
113
+ {
114
+ version = "3.5.7f1" ;
107
115
}
116
+
108
117
}
109
118
}
110
119
}
@@ -627,7 +636,7 @@ public static void RemoveContextMenuRegistry(string contextRegRoot)
627
636
RegistryKey key = Registry . CurrentUser . OpenSubKey ( contextRegRoot , true ) ;
628
637
if ( key != null )
629
638
{
630
- var appName = "UnityLauncher " ;
639
+ var appName = "UnityLauncherPro " ;
631
640
RegistryKey appKey = Registry . CurrentUser . OpenSubKey ( contextRegRoot + "\\ " + appName , false ) ;
632
641
if ( appKey != null )
633
642
{
0 commit comments