Exemplo n.º 1
0
        public IEnumerator InstallReleasesAsync(List <ReleaseInfo> releaseInfos)
        {
            // Need to make sure we have the most recent package list so we can determine whether this is
            // an upgrade / downgrade / etc.
            yield return(_packageHandler.RefreshPackagesAsync());

            Assert.That(releaseInfos.Select(x => x.Id).GetDuplicates().IsEmpty(), "Found duplicate releases selected - are you installing multiple versions of the same release?");

            var packageRoot = _model.TryGetCurrentPackageFolderPath();

            Assert.IsNotNull(packageRoot, "Please select a package folder before attempting to install a release");

            foreach (var releaseInfo in releaseInfos)
            {
                var userChoice = CheckShouldInstall(releaseInfo);

                yield return(userChoice);

                switch (userChoice.Current)
                {
                case InstallReleaseUserChoices.Cancel:
                {
                    yield break;
                }

                case InstallReleaseUserChoices.Install:
                {
                    yield return(_prjCommandHandler.ProcessPrjCommand(
                                     "Installing release '{0}'".Fmt(releaseInfo.Name), PrjHelper.InstallReleaseAsync(packageRoot, releaseInfo)));

                    break;
                }

                case InstallReleaseUserChoices.Skip:
                {
                    // Do nothing
                    break;
                }

                default:
                {
                    Assert.Throw();
                    break;
                }
                }
            }

            yield return(_packageHandler.RefreshPackagesAsync());
        }
Exemplo n.º 2
0
        void OnContextMenuOpenUnityPackagesFolderInExplorer()
        {
            var packageRootPath = _model.TryGetCurrentPackageFolderPath();

            if (packageRootPath == null)
            {
                Log.Error("Could not find current package folder path to open in explorer");
            }
            else
            {
                var fullPath = PrjPathVars.Expand(packageRootPath);

                if (Directory.Exists(fullPath))
                {
                    System.Diagnostics.Process.Start(fullPath);
                }
                else
                {
                    Log.Error("Could not find directory at path '{0}'", fullPath);
                }
            }
        }