コード例 #1
0
        public static Connection[] Create(ConnectorProtocol protocol, int portRangeStart, int portRangeEnd, string target)
        {
            var c = new List <Connection>();

            for (int p = portRangeStart; p <= portRangeEnd; ++p)
            {
                c.Add(new Connection(protocol, p, target));
            }
            return(c.ToArray());
        }
コード例 #2
0
 public Connection(ConnectorProtocol protocol, int port, string target)
 {
     if (protocol == ConnectorProtocol.Unknown)
     {
         throw new WrongProtocolException();
     }
     Protocol = protocol;
     Port     = port;
     Target   = target;
 }
コード例 #3
0
 public void SetProtocol(ConnectorProtocol protocol, bool removeWrongConnections)
 {
     if (!CanChangeProtocol)
     {
         throw new FieldAccessException();
     }
     mainProtocol = ConnectorProtocol.Unknown;
     if (protocol == ConnectorProtocol.Unknown)
     {
         return;
     }
     if (removeWrongConnections)
     {
         for (int i = 0; i < Count; ++i)
         {
             if (connections.ElementAt(i).Key.Protocol != protocol)
             {
                 Remove(connections.ElementAt(i));
                 --i;
             }
         }
     }
 }
コード例 #4
0
 public void Add(ConnectorProtocol protocol, int portRangeStart, int portRangeEnd)
 {
     Add(Connection.Create(protocol, portRangeStart, portRangeEnd));
 }
コード例 #5
0
 public void Add(ConnectorProtocol protocol, int port)
 {
     Add(new Connection(protocol, port));
 }
コード例 #6
0
 public static Connection Create(ConnectorProtocol protocol, int port, string target)
 {
     return(new Connection(protocol, port, target));
 }