@@ -123,7 +123,6 @@ void Start()
123123            UpdateUnityInstallationsList ( ) ; 
124124            HandleCommandLineLaunch ( ) ; 
125125
126- 
127126            // check for duplicate instance, and activate that instead 
128127            if  ( chkAllowSingleInstanceOnly . IsChecked  ==  true ) 
129128            { 
@@ -132,6 +131,7 @@ void Start()
132131
133132                if  ( ! isNewInstance ) 
134133                { 
134+ 
135135                    // Send a wake-up message to the running instance 
136136                    ActivateRunningInstance ( ) ; 
137137
@@ -152,9 +152,6 @@ void Start()
152152            //Properties.Settings.Default.projectPaths = null; 
153153            //Properties.Settings.Default.Save(); 
154154
155- 
156- 
157- 
158155            projectsSource  =  GetProjects . Scan ( getGitBranch :  ( bool ) chkShowGitBranchColumn . IsChecked ,  getPlasticBranch :  ( bool ) chkCheckPlasticBranch . IsChecked ,  getArguments :  ( bool ) chkShowLauncherArgumentsColumn . IsChecked ,  showMissingFolders :  ( bool ) chkShowMissingFolderProjects . IsChecked ,  showTargetPlatform :  ( bool ) chkShowPlatform . IsChecked ,  AllProjectPaths :  Properties . Settings . Default . projectPaths ,  searchGitbranchRecursively :  ( bool ) chkGetGitBranchRecursively . IsChecked ,  showSRP :  ( bool ) chkCheckSRP . IsChecked ) ; 
159156
160157            //Console.WriteLine("projectsSource.Count: " + projectsSource.Count); 
@@ -279,8 +276,6 @@ void HandleCommandLineLaunch()
279276            string [ ]  args  =  Environment . GetCommandLineArgs ( ) ; 
280277            if  ( args  !=  null  &&  args . Length  >  2 ) 
281278            { 
282- 
283- 
284279                // first argument needs to be -projectPath 
285280                var  commandLineArgs  =  args [ 1 ] ; 
286281
@@ -302,12 +297,9 @@ void HandleCommandLineLaunch()
302297                    Tools . InstallAPK ( apkPath ) ; 
303298                    Environment . Exit ( 0 ) ; 
304299                } 
305-                 else 
306- 
307- 
308-                 if  ( commandLineArgs  ==  "-projectPath" ) 
300+                 else  if  ( commandLineArgs  ==  "-projectPath" ) 
309301                { 
310-                     Console . WriteLine ( "Launching from commandline..." ) ; 
302+                     Console . WriteLine ( "Launching project  from commandline..." ) ; 
311303
312304                    // path 
313305                    var  projectPathArgument  =  args [ 2 ] ; 
@@ -348,12 +340,17 @@ void HandleCommandLineLaunch()
348340                            CreateNewEmptyProject ( proj . Path ) ; 
349341                        } 
350342                    } 
351-                     else 
343+                     else   // has version info, just launch it 
352344                    { 
353-                         // try launching it 
354-                         var  proc  =  Tools . LaunchProject ( proj ) ; 
355-                         //proj.Process = proc; 
356-                         //ProcessHandler.Add(proj, proc); 
345+                         // try launching it through 
346+                         bool  launchedViaPipe  =  LaunchProjectViaPipe ( proj ) ; 
347+ 
348+                         if  ( launchedViaPipe  ==  false ) 
349+                         { 
350+                             var  proc  =  Tools . LaunchProject ( proj ) ; 
351+                             //proj.Process = proc; 
352+                             //ProcessHandler.Add(proj, proc); 
353+                         } 
357354                    } 
358355
359356                    // quit after launch if enabled in settings 
@@ -368,6 +365,33 @@ void HandleCommandLineLaunch()
368365                    Console . WriteLine ( "Error> Invalid arguments:"  +  args [ 1 ] ) ; 
369366                } 
370367            } 
368+         }  // HandleCommandLineLaunch() 
369+ 
370+         private  bool  LaunchProjectViaPipe ( Project  proj ) 
371+         { 
372+             string  sep  =  "<|>" ; 
373+             try 
374+             { 
375+                 using  ( var  client  =  new  NamedPipeClientStream ( "." ,  launcherPipeName ,  PipeDirection . Out ) ) 
376+                 { 
377+                     client . Connect ( 500 ) ; 
378+                     using  ( var  writer  =  new  StreamWriter ( client ) ) 
379+                     { 
380+                         writer . AutoFlush  =  true ; 
381+                         writer . WriteLine ( "OpenProject:"  +  sep  +  proj . Version  +  sep  +  proj . Path  +  sep  +  proj . Arguments ) ; 
382+                     } 
383+                 } 
384+                 return  true ; 
385+             } 
386+             catch  ( TimeoutException ) 
387+             { 
388+                 return  false ; 
389+             } 
390+             catch  ( Exception  ex ) 
391+             { 
392+                 Console . WriteLine ( "Error launching via pipe: "  +  ex . Message ) ; 
393+                 return  false ; 
394+             } 
371395        } 
372396
373397        // main search 
@@ -3847,7 +3871,7 @@ private void btnFetchLatestInitScript_Click(object sender, RoutedEventArgs e)
38473871        { 
38483872            if  ( string . IsNullOrEmpty ( initScriptFileFullPath )  ==  true ) 
38493873            { 
3850-                 initScriptFileFullPath  =  Tools . GetSafeFilePath ( "Scripts" , "InitializeProject.cs" ) ; 
3874+                 initScriptFileFullPath  =  Tools . GetSafeFilePath ( "Scripts" ,   "InitializeProject.cs" ) ; 
38513875            } 
38523876
38533877            Tools . DownloadInitScript ( initScriptFileFullPath ,  txtCustomInitFileURL . Text ) ; 
@@ -3921,6 +3945,20 @@ private void OnPipeConnection(IAsyncResult result)
39213945                            RestoreFromTray ( ) ; 
39223946                        } ) ; 
39233947                    } 
3948+                     else  if  ( message . StartsWith ( "OpenProject:" ) ) 
3949+                     { 
3950+                         string [ ]  sep  =  new  string [ ]  {  "<|>"  } ; 
3951+                         var  projData  =  message . Split ( sep ,  StringSplitOptions . None ) ; 
3952+ 
3953+                         Dispatcher . Invoke ( ( )  => 
3954+                         { 
3955+                             var  proj  =  new  Project ( ) ; 
3956+                             proj . Version  =  projData [ 1 ] ; 
3957+                             proj . Path  =  projData [ 2 ] ; 
3958+                             proj . Arguments  =  projData [ 3 ] ; 
3959+                             Tools . LaunchProject ( proj ) ; 
3960+                         } ) ; 
3961+                     } 
39243962                } 
39253963            } 
39263964            catch  ( Exception  ex ) 
0 commit comments