Ejemplo n.º 1
0
        public async Task Execute(AppGetOption appGetOption)
        {
            var createOptions = (CreateManifestOptions)appGetOption;

            if (!Uri.IsWellFormedUriString(createOptions.DownloadUrl, UriKind.Absolute))
            {
                throw new InvalidCommandParamaterException("Invalid download URL. Make sure you enter a valid fully qualified download URL.", createOptions);
            }

            var manifestBuilder = await _xRayClient.GetBuilder(new Uri(createOptions.DownloadUrl));

            _installerBuilder.Compose(manifestBuilder.Installers.Single());

            _composeManifest.Compose(manifestBuilder, true);

            while (_booleanPrompt.Request("Add an additional installer for different architecture or version of Windows?", false))
            {
                var url = _urlPrompt.Request("Download URL (leave blank to cancel)", "");
                if (string.IsNullOrWhiteSpace(url))
                {
                    break;
                }

                try
                {
                    var manifestBuilder2 = await _xRayClient.GetInstallerBuilder(new Uri(url));

                    _installerBuilder.Compose(manifestBuilder2);
                    manifestBuilder.Installers.Add(manifestBuilder2);
                }
                catch (Exception e)
                {
                    _logger.Error(e, "Couldn't process installer URL");
                }
            }


            _packageManifestService.PrintManifest(manifestBuilder.Build());
            _packageManifestService.WriteManifest(manifestBuilder);

            var submit = _booleanPrompt.Request("Submit manifest to be reviewed and added to official repository?", true);

            if (submit)
            {
                try
                {
                    var resp = await _submissionClient.Submit(manifestBuilder);

                    _logger.Info("Thank you for your submission.");
                    _logger.Info(resp.Message);
                }
                catch (Exception e)
                {
                    _logger.Error(e, "Couldn't submit manifest");
                }
            }
        }
Ejemplo n.º 2
0
        public void Invoke(PackageManifestBuilder manifestBuilder)
        {
            var result = _prompt.Request("Product Homepage", manifestBuilder.Home.Value);

            manifestBuilder.Home.Add(result, Confidence.Authoritative, this);
        }