@@ -36,7 +36,7 @@ public static class Tools
3636 /// <returns></returns>
3737 public static string GetProjectVersion ( string path )
3838 {
39- var version = "" ;
39+ string version = null ;
4040
4141 if ( File . Exists ( Path . Combine ( path , "ProjectVersionOverride.txt" ) ) )
4242 {
@@ -75,16 +75,16 @@ public static string GetProjectVersion(string path)
7575 Console . WriteLine ( "Invalid projectversion data found in '" + versionPath + "'.\n \n File Content:\n " + string . Join ( "\n " , data ) . ToString ( ) ) ;
7676 }
7777 }
78- else // maybe its 4.x
78+ else // maybe its 4.x?
7979 {
8080 versionPath = Path . Combine ( path , "ProjectSettings" , "ProjectSettings.asset" ) ;
8181 if ( File . Exists ( versionPath ) == true )
8282 {
8383 // first try if its ascii format
8484 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
8686 {
87- // in text format, then we need to try library file instead
87+ // check library if available
8888 var newVersionPath = Path . Combine ( path , "Library" , "AnnotationManager" ) ;
8989 if ( File . Exists ( newVersionPath ) == true )
9090 {
@@ -103,8 +103,17 @@ public static string GetProjectVersion(string path)
103103 {
104104 bytes [ i ] = binData [ startIndex + i ] ;
105105 }
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" ;
107115 }
116+
108117 }
109118 }
110119 }
@@ -627,7 +636,7 @@ public static void RemoveContextMenuRegistry(string contextRegRoot)
627636 RegistryKey key = Registry . CurrentUser . OpenSubKey ( contextRegRoot , true ) ;
628637 if ( key != null )
629638 {
630- var appName = "UnityLauncher " ;
639+ var appName = "UnityLauncherPro " ;
631640 RegistryKey appKey = Registry . CurrentUser . OpenSubKey ( contextRegRoot + "\\ " + appName , false ) ;
632641 if ( appKey != null )
633642 {
0 commit comments