private void btnRemove_Click(object sender, EventArgs e) { if (slvPortMappings.SelectedItems.Count < 1) { return; } PortMappingEntry entry = (PortMappingEntry)slvPortMappings.SelectedItems[0].Tag; entry.RemoveFromMapping(); }
public static void Forward(PortMappingEntry fwi) { try { _lastInstance.Add(fwi); } catch (Exception ex) { Logger.Log(LogLevel.Warning, "PortForwarder", "Error while loading mapping: " + ex.Message); } if (PortForwardApplied != null) { PortForwardApplied(); } }
private void btnRemove_Click(object sender, EventArgs e) { if (slvPortMappings.SelectedItems.Count < 1) { return; } PortMappingEntry entry = (PortMappingEntry)slvPortMappings.SelectedItems[0].Tag; try { entry.RemoveFromMapping(); } catch { MetroMessageBox.Show(this, "Error during rule removal", "This rule couldn't be removed. Try removing it from the router's webinterface."); } }
/// <summary> /// Adds a port mapping to the UPnP enabled device. /// </summary> /// <param name="entry">The PortMappingEntry to add</param> /// <exception cref="ApplicationException">This exception is thrown when UPnP is disabled.</exception> /// <exception cref="ObjectDisposedException">This exception is thrown when this class has been disposed.</exception> /// <exception cref="ArgumentException">This exception is thrown when any of the supplied arguments are invalid.</exception> /// <remarks></remarks> public void Add(PortMappingEntry entry) { Add(entry.Ip, entry.Port, entry.Protocol, entry.Name); }