示例#1
0
        private TikSession(ITikConnector connector, TikConnectorType connectorType)
        {
            if ((connectorType == TikConnectorType.Custom))
            {
                if (connector == null)
                {
                    throw new ArgumentException("Use constructor with connector instance for custom connectors.", "connectorType");
                }
                else
                {
                    this.connector = connector;
                }
            }
            else
            {
                switch (connectorType)
                {
                case TikConnectorType.Api:
                    this.connector = new Tik4Net.Connector.Api.ApiConnector();
                    break;

                case TikConnectorType.Ssh:
                    throw new NotImplementedException();

                case TikConnectorType.Telnet:
                    throw new NotImplementedException();

                default:
                    throw new NotImplementedException(string.Format(CultureInfo.CurrentCulture, "Not supported TikConnectorType '{0}'.", connectorType));
                }
            }

            this.connectorType = connectorType;

            if (activeSessions == null)
            {
                activeSessions = new Stack <TikSession>();
            }
            activeSessions.Push(this);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TikSession"/> class with one of
 /// predefined <see cref="TikConnectorType"/> <see cref="Connector"/> types.
 /// </summary>
 /// <param name="connectorType">Type of the connector.</param>
 public TikSession(TikConnectorType connectorType)
     : this(null, connectorType)
 {
 }