/// <summary>
        /// Initializes a new instance of the <see cref="DecryptConfigSectionCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="commandService">Command service to add command to, not null.</param>
        private DecryptConfigSectionCommand(AsyncPackage package, OleMenuCommandService commandService)
        {
            this.package   = package ?? throw new ArgumentNullException(nameof(package));
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new MenuCommand(this.ExecuteAsync, menuCommandID);

            commandService.AddCommand(menuItem);

            this.visualStudioInteropService     = new VisualStudioInteropService(this.package);
            this.configurationEncryptionService = new ConfigurationEncryptionService();
        }
Ejemplo n.º 2
0
        public override CommandExecutionResult Execute()
        {
            var svc = new ConfigurationEncryptionService();

            if (!string.IsNullOrWhiteSpace(PathToExe))
            {
                return(svc.DecryptConfigurationSection(PathToExe, ConfigurationEncryptionService.ConnectionStringsSectionName));
            }

            if (!string.IsNullOrWhiteSpace(WebSite))
            {
                throw new NotImplementedException("Web Configurations are not yet supported.");
            }

            return(CommandExecutionResult.NoOp());
        }
Ejemplo n.º 3
0
        public override CommandExecutionResult Execute()
        {
            var svc = new ConfigurationEncryptionService();

            if (!string.IsNullOrWhiteSpace(PathToExe))
            {
                return(svc.EncryptConfigurationSection(PathToExe, ConfigurationEncryptionService.ConnectionStringsSectionName, Provider));
            }

            if (!string.IsNullOrWhiteSpace(WebSite))
            {
                return(CommandExecutionResult.Fail("Web Configurations are not currently supported.  Please use aspnet_regiis.exe instead."));
            }

            return(CommandExecutionResult.NoOp());
        }