public static void LaunchOnTargets(BuildTargetGroup targetGroup, BuildTarget buildTarget, BuildReport buildReport, List <DeploymentTargetId> launchTargets)
 {
     try
     {
         if (buildReport == null || !DeploymentTargetManager.IsExtensionSupported(targetGroup, buildReport.summary.platform))
         {
             throw new NotSupportedException();
         }
         ProgressHandler handler = new ProgressHandler("Deploying Player", delegate(string title, string message, float globalProgress)
         {
             if (EditorUtility.DisplayCancelableProgressBar(title, message, globalProgress))
             {
                 throw new DeploymentOperationAbortedException();
             }
         }, 0.1f, 1f);
         ProgressTaskManager taskManager = new ProgressTaskManager(handler);
         taskManager.AddTask(delegate
         {
             int num = 0;
             List <DeploymentOperationFailedException> list = new List <DeploymentOperationFailedException>();
             foreach (DeploymentTargetId current in launchTargets)
             {
                 try
                 {
                     DeploymentTargetManager.LaunchBuildOnTarget(targetGroup, buildReport, current, taskManager.SpawnProgressHandlerFromCurrentTask());
                     num++;
                 }
                 catch (DeploymentOperationFailedException item)
                 {
                     list.Add(item);
                 }
             }
             foreach (DeploymentOperationFailedException current2 in list)
             {
                 UnityEngine.Debug.LogException(current2);
             }
             if (num == 0)
             {
                 throw new PostprocessBuildPlayer.NoTargetsFoundException("Could not launch build");
             }
         });
         taskManager.Run();
     }
     catch (DeploymentOperationFailedException ex)
     {
         UnityEngine.Debug.LogException(ex);
         EditorUtility.DisplayDialog(ex.title, ex.Message, "Ok");
     }
     catch (DeploymentOperationAbortedException)
     {
         Console.WriteLine("Deployment aborted");
     }
     catch (PostprocessBuildPlayer.NoTargetsFoundException)
     {
         throw new UnityException(string.Format("Could not find any valid targets to launch on for {0}", buildTarget));
     }
 }
        static public void LaunchOnTargets(BuildTargetGroup targetGroup, BuildTarget buildTarget, Build.Reporting.BuildReport buildReport, List <DeploymentTargetId> launchTargets)
        {
            try
            {
                // Early out so as not to show/update progressbars unnecessarily
                if (buildReport == null || !DeploymentTargetManager.IsExtensionSupported(targetGroup, buildReport.summary.platform))
                {
                    throw new System.NotSupportedException();
                }

                ProgressHandler progressHandler = new ProgressHandler("Deploying Player",
                                                                      delegate(string title, string message, float globalProgress)
                {
                    if (EditorUtility.DisplayCancelableProgressBar(title, message, globalProgress))
                    {
                        throw new DeploymentOperationAbortedException();
                    }
                }, 0.1f);         // BuildPlayer.cpp starts off at 0.1f for some reason

                var taskManager = new ProgressTaskManager(progressHandler);

                // Launch on all selected targets
                taskManager.AddTask(() =>
                {
                    int successfulLaunches = 0;
                    var exceptions         = new List <DeploymentOperationFailedException>();
                    foreach (var target in launchTargets)
                    {
                        try
                        {
                            DeploymentTargetManager.LaunchBuildOnTarget(targetGroup, buildReport, target, taskManager.SpawnProgressHandlerFromCurrentTask());
                            successfulLaunches++;
                        }
                        catch (DeploymentOperationFailedException e)
                        {
                            exceptions.Add(e);
                        }
                    }

                    foreach (var e in exceptions)
                    {
                        UnityEngine.Debug.LogException(e);
                    }

                    if (successfulLaunches == 0)
                    {
                        // TODO: Maybe more specifically no compatible targets?
                        throw new NoTargetsFoundException("Could not launch build");
                    }
                });

                taskManager.Run();
            }
            catch (DeploymentOperationFailedException e)
            {
                UnityEngine.Debug.LogException(e);
                EditorUtility.DisplayDialog(e.title, e.Message, "Ok");
            }
            catch (DeploymentOperationAbortedException)
            {
                System.Console.WriteLine("Deployment aborted");
            }
            catch (NoTargetsFoundException)
            {
                throw new UnityException(string.Format("Could not find any valid targets to launch on for {0}", buildTarget));
            }
        }