Ejemplo n.º 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();
        }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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.");
            }
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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);
 }