示例#1
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (slvPortMappings.SelectedItems.Count < 1)
            {
                return;
            }
            PortMappingEntry entry = (PortMappingEntry)slvPortMappings.SelectedItems[0].Tag;

            entry.RemoveFromMapping();
        }
示例#2
0
 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();
     }
 }
示例#3
0
        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.");
            }
        }
示例#4
0
 /// <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);
 }
示例#5
0
 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();
     }
 }
示例#6
0
 /// <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);
 }