@@ -284,9 +284,9 @@ void UpdateRecentProjectsList()
284284 string projectName = "" ;
285285
286286 // get project name from full path
287- if ( projectPath . IndexOf ( Path . PathSeparator ) > - 1 )
287+ if ( projectPath . IndexOf ( Path . DirectorySeparatorChar ) > - 1 )
288288 {
289- projectName = projectPath . Substring ( projectPath . LastIndexOf ( Path . PathSeparator ) + 1 ) ;
289+ projectName = projectPath . Substring ( projectPath . LastIndexOf ( Path . DirectorySeparatorChar ) + 1 ) ;
290290 }
291291 else if ( projectPath . IndexOf ( Path . AltDirectorySeparatorChar ) > - 1 )
292292 {
@@ -997,6 +997,16 @@ private void btnCheckUpdates_Click(object sender, EventArgs e)
997997 CheckUpdates ( ) ;
998998 }
999999
1000+ private void btnRefreshProjectList_Click ( object sender , EventArgs e )
1001+ {
1002+ UpdateRecentProjectsList ( ) ;
1003+ }
1004+
1005+ private void btnBrowseForProject_Click ( object sender , EventArgs e )
1006+ {
1007+ BrowseForExistingProjectFolder ( ) ;
1008+ }
1009+
10001010 #endregion UI events
10011011
10021012 // displays version selector to upgrade project
@@ -1128,7 +1138,85 @@ void CheckUpdates()
11281138 }
11291139 else
11301140 {
1131- SetStatus ( "No updates available. Current release is " + previousGitRelease ) ;
1141+ SetStatus ( "No updates available. Current release is " + ( float . Parse ( previousGitRelease ) + 0.01f ) ) ;
1142+ }
1143+ }
1144+
1145+
1146+
1147+ void BrowseForExistingProjectFolder ( )
1148+ {
1149+ folderBrowserDialog1 . Description = "Select Existing Project Folder" ;
1150+ var d = folderBrowserDialog1 . ShowDialog ( ) ;
1151+ var projectPath = folderBrowserDialog1 . SelectedPath ;
1152+ if ( String . IsNullOrWhiteSpace ( projectPath ) == false && Directory . Exists ( projectPath ) == true )
1153+ {
1154+
1155+ // TODO: remove duplicate code (from UpdateRecentList())
1156+
1157+ string projectName = "" ;
1158+
1159+ Console . WriteLine ( Path . DirectorySeparatorChar ) ;
1160+ Console . WriteLine ( Path . AltDirectorySeparatorChar ) ;
1161+
1162+ // get project name from full path
1163+ if ( projectPath . IndexOf ( Path . DirectorySeparatorChar ) > - 1 )
1164+ {
1165+ projectName = projectPath . Substring ( projectPath . LastIndexOf ( Path . DirectorySeparatorChar ) + 1 ) ;
1166+ Console . WriteLine ( "1" ) ;
1167+ }
1168+ else if ( projectPath . IndexOf ( Path . AltDirectorySeparatorChar ) > - 1 )
1169+ {
1170+ projectName = projectPath . Substring ( projectPath . LastIndexOf ( Path . AltDirectorySeparatorChar ) + 1 ) ;
1171+ Console . WriteLine ( "2" ) ;
1172+ }
1173+ else // no path separator founded
1174+ {
1175+ projectName = projectPath ;
1176+ Console . WriteLine ( "3" ) ;
1177+ }
1178+
1179+ string csprojFile = Path . Combine ( projectPath , projectName + ".csproj" ) ;
1180+
1181+ // editor only project
1182+ if ( File . Exists ( csprojFile ) == false )
1183+ {
1184+ csprojFile = Path . Combine ( projectPath , projectName + ".Editor.csproj" ) ;
1185+ }
1186+
1187+ // maybe 4.x project
1188+ if ( File . Exists ( csprojFile ) == false )
1189+ {
1190+ csprojFile = Path . Combine ( projectPath , "Assembly-CSharp.csproj" ) ;
1191+ }
1192+
1193+ // get last modified date
1194+ DateTime ? lastUpdated = Tools . GetLastModifiedTime ( csprojFile ) ;
1195+
1196+ // get project version
1197+ string projectVersion = Tools . GetProjectVersion ( projectPath ) ;
1198+
1199+ // get custom launch arguments, only if column in enabled
1200+ string customArgs = "" ;
1201+ if ( chkShowLauncherArgumentsColumn . Checked == true )
1202+ {
1203+ customArgs = Tools . ReadCustomLaunchArguments ( projectPath , launcherArgumentsFile ) ;
1204+ }
1205+
1206+ // get git branchinfo, only if column in enabled
1207+ string gitBranch = "" ;
1208+ if ( chkShowGitBranchColumn . Checked == true )
1209+ {
1210+ gitBranch = Tools . ReadGitBranchInfo ( projectPath ) ;
1211+ }
1212+
1213+ // NOTE: list item will disappear if you dont open the project once..
1214+
1215+ // TODO: dont add if not a project??
1216+
1217+ gridRecent . Rows . Insert ( 0 , projectName , projectVersion , projectPath , lastUpdated , customArgs , gitBranch ) ;
1218+ gridRecent . Rows [ 0 ] . Cells [ 1 ] . Style . ForeColor = HaveExactVersionInstalled ( projectVersion ) ? Color . Green : Color . Red ;
1219+ gridRecent . Rows [ 0 ] . Selected = true ;
11321220 }
11331221 }
11341222 }
0 commit comments