Beispiel #1
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(new MethodTaskItem("Add", "Add...", string.Empty).SetUsage());
                if (_owner.SelectedItem != null)
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage());
                    if (_owner.SelectedItem.Flag == "Local")
                    {
                        result.Add(new MethodTaskItem("Change", "Change Status Code", string.Empty).SetUsage());
                    }

                    result.Add(RemoveTaskItem);
                }

                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new MethodTaskItem("Set", "Edit Feature Settings...", string.Empty).SetUsage());
                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #2
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                if (_owner.IsInOrder)
                {
                    result.Add(GetMoveUpTaskItem(_owner.CanMoveUp));
                    result.Add(GetMoveDownTaskItem(_owner.CanMoveDown));
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("Unorder", "View Unordered List...", string.Empty).SetUsage());
                }
                else
                {
                    result.Add(new MethodTaskItem("Add", "Add...", string.Empty).SetUsage());
                    if (_owner.SelectedItem != null)
                    {
                        result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        result.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage());
                        result.Add(new MethodTaskItem("Rename", "Rename", string.Empty).SetUsage());
                        result.Add(RemoveTaskItem);
                    }

                    result.Add(MethodTaskItem.CreateSeparator().SetUsage(true, MethodTaskItemUsages.TaskList));
                    if (_owner.CanRevert)
                    {
                        result.Add(new MethodTaskItem("Revert", "Revert to Parent", string.Empty).SetUsage());
                    }

                    result.Add(new MethodTaskItem("InOrder", "View Ordered List...", string.Empty).SetUsage());

                    if (_owner.IsSite)
                    {
                        result.Add(new MethodTaskItem("ViewTraceLogs", "View Trace Logs...", string.Empty).SetUsage());
                        result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        result.Add(new MethodTaskItem("Set", "Edit Site Tracing...", string.Empty).SetUsage());
                    }
                }

                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #3
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(
                    new MethodTaskItem("Add", "Add Application Pool...", string.Empty, string.Empty, Resources.application_pool_new_16)
                    .SetUsage());
                result.Add(new MethodTaskItem("Set", "Set Application Pool Defaults...", string.Empty).SetUsage());
                if (_owner.SelectedItem != null)
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new TextTaskItem("Application Pool Tasks", string.Empty, true));
                    result.Add(
                        new MethodTaskItem("Start", "Start", string.Empty, string.Empty, Resources.start_16).SetUsage(
                            !_owner.IsBusy && _owner.SelectedItem.State != ObjectState.Started));
                    result.Add(
                        new MethodTaskItem("Stop", "Stop", string.Empty, string.Empty, Resources.stop_16).SetUsage(
                            !_owner.IsBusy && _owner.SelectedItem.State == ObjectState.Started));
                    result.Add(
                        new MethodTaskItem("Recycle", "Recycle...", string.Empty, string.Empty, Resources.restart_16)
                        .SetUsage(!_owner.IsBusy && _owner.SelectedItem.State == ObjectState.Started));
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new TextTaskItem("Edit Application Pool", string.Empty, true));
                    result.Add(
                        new MethodTaskItem("Basic", "Basic Settings...", string.Empty, string.Empty,
                                           Resources.basic_settings_16).SetUsage());
                    result.Add(new MethodTaskItem("Recycling", "Recycling...", string.Empty).SetUsage());
                    result.Add(new MethodTaskItem("Advanced", "Advanced Settings", string.Empty).SetUsage());
                    result.Add(new MethodTaskItem("Rename", "Rename", string.Empty).SetUsage());
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(RemoveTaskItem);
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(
                        new MethodTaskItem("Applications", "View Applications", string.Empty).SetUsage());
                }

                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #4
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(new MethodTaskItem("Explore", "Explore", string.Empty, string.Empty, Resources.explore_16).SetUsage());
                result.Add(new MethodTaskItem("Permissions", "Edit Permissions...", string.Empty).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(
                    new MethodTaskItem("Basic", "Basic Settings...", string.Empty, string.Empty,
                                       Resources.basic_settings_16).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new MethodTaskItem("VirtualDirectories", "View Virtual Directories", string.Empty).SetUsage());

                if (_owner.SiteBindings.Any(item => item.CanBrowse))
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    var manageGroup = new GroupTaskItem(string.Empty, "Manage Application", string.Empty, true);
                    result.Add(manageGroup);
                    manageGroup.Items.Add(new TextTaskItem("Browse Application", string.Empty, true));
                    foreach (Binding binding in _owner.SiteBindings)
                    {
                        if (binding.CanBrowse)
                        {
                            var uri = binding.ToUri();
                            manageGroup.Items.Add(
                                new MethodTaskItem("Browse", $"Browse {binding.ToShortString()}",
                                                   string.Empty, string.Empty,
                                                   Resources.browse_16, uri).SetUsage());
                        }
                    }

                    manageGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    manageGroup.Items.Add(new MethodTaskItem("Advanced", "Advanced Settings...", string.Empty).SetUsage());
                }

                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #5
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                if (_owner.IsInOrder)
                {
                    result.Add(GetMoveUpTaskItem(_owner.CanMoveUp));
                    result.Add(GetMoveDownTaskItem(_owner.CanMoveDown));
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("Unorder", "View Unordered List...", string.Empty).SetUsage());
                }
                else
                {
                    result.Add(new MethodTaskItem("AddManaged", "Add Managed Handler...", string.Empty).SetUsage());
                    result.Add(new MethodTaskItem("AddScript", "Add Script Map...", string.Empty).SetUsage());
                    result.Add(new MethodTaskItem("AddWildcard", "Add Wildcard Script Map...", string.Empty).SetUsage());
                    result.Add(new MethodTaskItem("Add", "Add Module Mapping...", string.Empty).SetUsage());
                    if (_owner.SelectedItem != null)
                    {
                        result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        result.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage());
                        result.Add(RemoveTaskItem);
                    }

                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("Set", "Edit Feature Permissions...", string.Empty).SetUsage());
                    if (_owner.CanRevert)
                    {
                        result.Add(new MethodTaskItem("Revert", "Revert to Parent", string.Empty).SetUsage());
                    }

                    result.Add(new MethodTaskItem("InOrder", "View Ordered List...", string.Empty).SetUsage());
                }

                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(new MethodTaskItem("AddAllow", "Add Allow Entry...", string.Empty).SetUsage());
                result.Add(new MethodTaskItem("AddDeny", "Add Deny Entry...", string.Empty).SetUsage());
                if (_owner.SelectedItem != null)
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(RemoveTaskItem);
                }

                result.Add(MethodTaskItem.CreateSeparator().SetUsage()); // IMPORTANT: this is where IIS Manager was wrong
                result.Add(new MethodTaskItem("Set", "Edit Feature Settings...", string.Empty).SetUsage());
                if (_owner.CanRevert)
                {
                    result.Add(new MethodTaskItem("Revert", "Revert To Parent", string.Empty).SetUsage());
                }

                result.Add(new MethodTaskItem("View", "View Ordered List...", string.Empty).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new MethodTaskItem("Dynamic", "Edit Dynamic Restriction Settings...", string.Empty).SetUsage());
                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #7
0
 public static MethodTaskItem SetUsage(this MethodTaskItem method, bool enabled = true)
 {
     method.Enabled = enabled;
     method.Usage   = MethodTaskItemUsages.ContextMenu | MethodTaskItemUsages.TaskList;
     return(method);
 }
Beispiel #8
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(new MethodTaskItem("Import", "Import...", string.Empty).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new MethodTaskItem("CreateRequest", "Create Certificate Request...", string.Empty).SetUsage());
                result.Add(new MethodTaskItem("Complete", "Complete Certificate Request...", string.Empty).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new MethodTaskItem("CreateDomain", "Create Domain Certificate...", string.Empty).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new MethodTaskItem("CreateSelf", "Create Self-Signed Certificate...", string.Empty).SetUsage());
                if (_owner.SelectedItem != null)
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("View", "View...", string.Empty).SetUsage());
                    if (_owner.SelectedItem.Certificate.HasPrivateKey)
                    {
                        try
                        {
                            ECDsaCng eCdsa = _owner.SelectedItem.Certificate.GetECDsaPrivateKey() as ECDsaCng;
                            if (eCdsa != null)
                            {
                                if (eCdsa.Key.ExportPolicy.HasFlag(CngExportPolicies.AllowExport))
                                {
                                    result.Add(new MethodTaskItem("Export", "Export...", string.Empty).SetUsage());
                                    if (_owner.SelectedItem.Certificate.Issuer != LocalhostIssuer && _owner.SelectedItem.Certificate.Issuer != _localMachineIssuer)
                                    {
                                        // result.Add(new MethodTaskItem("Renew", "Renew...", string.Empty).SetUsage());
                                    }
                                }
                            }
                            else if (_owner.SelectedItem.Certificate.GetRSAPrivateKey() is RSACng cng)
                            {
                                if (cng.Key.ExportPolicy.HasFlag(CngExportPolicies.AllowExport))
                                {
                                    result.Add(new MethodTaskItem("Export", "Export...", string.Empty).SetUsage());
                                    if (_owner.SelectedItem.Certificate.Issuer != LocalhostIssuer && _owner.SelectedItem.Certificate.Issuer != _localMachineIssuer)
                                    {
                                        // result.Add(new MethodTaskItem("Renew", "Renew...", string.Empty).SetUsage());
                                    }
                                }
                            }
                            else if (_owner.SelectedItem.Certificate.GetRSAPrivateKey() is RSACryptoServiceProvider keyInfo)
                            {
                                if (keyInfo.CspKeyContainerInfo.Exportable)
                                {
                                    result.Add(new MethodTaskItem("Export", "Export...", string.Empty).SetUsage());
                                    if (_owner.SelectedItem.Certificate.Issuer != LocalhostIssuer && _owner.SelectedItem.Certificate.Issuer != _localMachineIssuer)
                                    {
                                        // result.Add(new MethodTaskItem("Renew", "Renew...", string.Empty).SetUsage());
                                    }
                                }
                            }
                        }
                        catch (CryptographicException ex)
                        {
                            if (ex.HResult != NativeMethods.BadKeySet)
                            {
                                // TODO: add CNG support.
                                // throw;
                                RollbarLocator.RollbarInstance.Error($"ate exception in certificates feature {ex}");
                            }
                        }
                    }

                    result.Add(RemoveTaskItem);
                    if (_owner.SelectedItem.Certificate.Issuer == LocalhostIssuer || _owner.SelectedItem.Certificate.Issuer == _localMachineIssuer)
                    {
                        result.Add(new MethodTaskItem("Trust", "Trust Self-Signed Certificate", string.Empty).SetUsage());
                    }
                }

                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                if (!_owner.AutomicRebindEnabled)
                {
                    result.Add(new MethodTaskItem("Enable", "Enable Automatic Rebind of Renewed Certificate", string.Empty).SetUsage());
                }

                if (_owner.AutomicRebindEnabled)
                {
                    result.Add(new MethodTaskItem("Disable", "Disable Automatic Rebind of Renewed Certificate", string.Empty).SetUsage());
                }

                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #9
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(
                    new MethodTaskItem("Add", "Add Website...", string.Empty, string.Empty, Resources.site_new_16)
                    .SetUsage());
                result.Add(new MethodTaskItem("Set", "Set Website Defaults", string.Empty).SetUsage());
                if (_owner.SelectedItem != null)
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new TextTaskItem("Edit Site", string.Empty, true));
                    result.Add(new MethodTaskItem("Bindings", "Bindings...", string.Empty).SetUsage());
                    result.Add(
                        new MethodTaskItem("Basic", "Basic Settings...", string.Empty, string.Empty,
                                           Resources.basic_settings_16).SetUsage());
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(
                        new MethodTaskItem("Explore", "Explore", string.Empty, string.Empty, Resources.explore_16)
                        .SetUsage());
                    result.Add(new MethodTaskItem("Permissions", "Edit Permissions...", string.Empty).SetUsage());
                    result.Add(RemoveTaskItem);
                    result.Add(new MethodTaskItem("Rename", "Rename", string.Empty).SetUsage());
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("Applications", "View Applications", string.Empty).SetUsage());
                    result.Add(
                        new MethodTaskItem("VirtualDirectories", "View Virtual Directories", string.Empty).SetUsage());

                    if (_owner.SelectedItem.Bindings.Any(item => item.CanBrowse))
                    {
                        result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        var manageGroup = new GroupTaskItem(string.Empty, "Manage Website", string.Empty, true);
                        result.Add(manageGroup);
                        manageGroup.Items.Add(
                            new MethodTaskItem("Restart", "Restart", string.Empty, string.Empty, Resources.restart_16)
                            .SetUsage(!_owner.IsBusy));
                        manageGroup.Items.Add(
                            new MethodTaskItem("Start", "Start", string.Empty, string.Empty, Resources.start_16).SetUsage(
                                !_owner.IsBusy && _owner.SelectedItem.State != ObjectState.Started));
                        manageGroup.Items.Add(new MethodTaskItem("Stop", "Stop", string.Empty, string.Empty,
                                                                 Resources.stop_16)
                                              .SetUsage(
                                                  !_owner.IsBusy && _owner.SelectedItem.State == ObjectState.Started));
                        manageGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        manageGroup.Items.Add(new TextTaskItem("Browse Website", string.Empty, true));
                        foreach (Binding binding in _owner.SelectedItem.Bindings)
                        {
                            if (binding.CanBrowse)
                            {
                                var uri = binding.ToUri();
                                manageGroup.Items.Add(
                                    new MethodTaskItem("Browse", $"Browse {uri}", string.Empty,
                                                       string.Empty,
                                                       Resources.browse_16, uri).SetUsage());
                            }
                        }

                        manageGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        manageGroup.Items.Add(
                            new MethodTaskItem("Advanced", "Advanced Settings...", string.Empty).SetUsage());
                        manageGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                        manageGroup.Items.Add(new TextTaskItem("Configure", string.Empty, true));
                        manageGroup.Items.Add(
                            new MethodTaskItem("Tracing", "Failed Request Tracing...", string.Empty).SetUsage());
                        manageGroup.Items.Add(new MethodTaskItem("Limits", "Limits...", string.Empty).SetUsage());
                    }
                }

                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }
Beispiel #10
0
            public override ICollection GetTaskItems()
            {
                var result = new ArrayList();

                result.Add(new MethodTaskItem("Add", "Add Rule(s)...", string.Empty).SetUsage());
                if (_owner.Inbound.CanRevert)
                {
                    result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    result.Add(new MethodTaskItem("Revert", "Revert to Parent", string.Empty).SetUsage());
                }

                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new TextTaskItem("Manage Server Variables", string.Empty, true));
                result.Add(new MethodTaskItem("ViewServerVariables", "View Server Variables...", string.Empty).SetUsage());
                result.Add(MethodTaskItem.CreateSeparator().SetUsage());
                result.Add(new TextTaskItem("Manage Providers", string.Empty, true));
                result.Add(new MethodTaskItem("ViewMaps", "View Rewrite Maps...", string.Empty).SetUsage());
                result.Add(new MethodTaskItem("ViewProviders", "View Providers...", string.Empty).SetUsage());

                if (_owner.Inbound.SelectedItem != null)
                {
                    var groupTaskItem = new GroupTaskItem("Conditions", "Conditions", string.Empty, true);
                    groupTaskItem.Items.Add(new MethodTaskItem("AddConditions", "Add...", string.Empty).SetUsage());
                    result.Add(groupTaskItem);
                }

                var inboundGroup = new GroupTaskItem("InboundRules", "Inbound Rules", string.Empty, true);

                result.Add(inboundGroup);
                if (_owner.Inbound.SelectedItem != null)
                {
                    inboundGroup.Items.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage());
                    inboundGroup.Items.Add(new MethodTaskItem("Rename", "Rename", string.Empty).SetUsage());
                    inboundGroup.Items.Add(RemoveTaskItem);
                    if (!_owner.Inbound.SelectedItem.Enabled)
                    {
                        inboundGroup.Items.Add(new MethodTaskItem("Enable", "Enable Rule", string.Empty).SetUsage());
                    }

                    if (_owner.Inbound.SelectedItem.Enabled)
                    {
                        inboundGroup.Items.Add(new MethodTaskItem("Disable", "Disable Rule", string.Empty).SetUsage());
                    }

                    inboundGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    inboundGroup.Items.Add(GetMoveUpTaskItem(_owner.Inbound.CanMoveUp));
                    inboundGroup.Items.Add(GetMoveDownTaskItem(_owner.Inbound.CanMoveDown));
                    inboundGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                }

                inboundGroup.Items.Add(new MethodTaskItem("Import", "Import Rules...", string.Empty).SetUsage());

                var outboundGroup = new GroupTaskItem("OutboundRules", "Outbound Rules", string.Empty, true);

                result.Add(outboundGroup);
                if (_owner.Outbound.SelectedItem != null)
                {
                    outboundGroup.Items.Add(new MethodTaskItem("EditOut", "Edit...", string.Empty).SetUsage());
                    outboundGroup.Items.Add(new MethodTaskItem("RenameOut", "Rename", string.Empty).SetUsage());
                    outboundGroup.Items.Add(GetRemoveTaskItem("Remove2"));
                    if (!_owner.Outbound.SelectedItem.Enabled)
                    {
                        outboundGroup.Items.Add(new MethodTaskItem("EnableOut", "Enable Rule", string.Empty).SetUsage());
                    }

                    if (_owner.Outbound.SelectedItem.Enabled)
                    {
                        outboundGroup.Items.Add(new MethodTaskItem("DisableOut", "Disable Rule", string.Empty).SetUsage());
                    }

                    outboundGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                    outboundGroup.Items.Add(GetMoveUpTaskItem("MoveUpOut", _owner.Outbound.CanMoveUp));
                    outboundGroup.Items.Add(GetMoveDownTaskItem("MoveDownOut", _owner.Outbound.CanMoveDown));
                    outboundGroup.Items.Add(MethodTaskItem.CreateSeparator().SetUsage());
                }

                outboundGroup.Items.Add(new MethodTaskItem("ViewPreconditions", "View Preconditions...", string.Empty).SetUsage());
                outboundGroup.Items.Add(new MethodTaskItem("ViewTags", "View Custom Tags...", string.Empty).SetUsage());
                return(result.ToArray(typeof(TaskItem)) as TaskItem[]);
            }