Пример #1
0
        /// <summary>
        /// Handles SSH messages.
        /// </summary>
        /// <param name="message">The message.</param>
        partial void HandleMessageCore(Message message)
        {
            Debug.Assert(message != null);

            MethodInfo method;

            if (_handlers.TryGetValue(message.GetType(), out method))
            {
                try
                {
                    method.Invoke(this, new object[] { message });
                }
                catch (TargetInvocationException ex)
                {
                    throw ex.InnerException ?? ex;
                }
            }
            else
            {
                HandleMessage(message);
            }
        }
Пример #2
0
        partial void HandleMessageCore(Message message)
        {
            if (message == null)
                throw new ArgumentNullException("message");
            else if (message is DisconnectMessage)
                this.HandleMessage((DisconnectMessage)message);
            else if (message is IgnoreMessage)
                this.HandleMessage((IgnoreMessage)message);
            else if (message is UnimplementedMessage)
                this.HandleMessage((UnimplementedMessage)message);
            else if (message is DebugMessage)
                this.HandleMessage((DebugMessage)message);
            else if (message is ServiceRequestMessage)
                this.HandleMessage((ServiceRequestMessage)message);
            else if (message is ServiceAcceptMessage)
                this.HandleMessage((ServiceAcceptMessage)message);
            else if (message is KeyExchangeInitMessage)
                this.HandleMessage((KeyExchangeInitMessage)message);
            else if (message is NewKeysMessage)
                this.HandleMessage((NewKeysMessage)message);
            else if (message is RequestMessage)
                this.HandleMessage((RequestMessage)message);
            else if (message is FailureMessage)
                this.HandleMessage((FailureMessage)message);
            else if (message is SuccessMessage)
                this.HandleMessage((SuccessMessage)message);
            else if (message is BannerMessage)
                this.HandleMessage((BannerMessage)message);
            else if (message is GlobalRequestMessage)
                this.HandleMessage((GlobalRequestMessage)message);
            else if (message is RequestSuccessMessage)
                this.HandleMessage((RequestSuccessMessage)message);
            else if (message is RequestFailureMessage)
                this.HandleMessage((RequestFailureMessage)message);
            else if (message is ChannelOpenMessage)
                this.HandleMessage((ChannelOpenMessage)message);
            else if (message is ChannelOpenConfirmationMessage)
                this.HandleMessage((ChannelOpenConfirmationMessage)message);
            else if (message is ChannelOpenFailureMessage)
                this.HandleMessage((ChannelOpenFailureMessage)message);
            else if (message is ChannelWindowAdjustMessage)
                this.HandleMessage((ChannelWindowAdjustMessage)message);
            else if (message is ChannelDataMessage)
                this.HandleMessage((ChannelDataMessage)message);
            else if (message is ChannelExtendedDataMessage)
                this.HandleMessage((ChannelExtendedDataMessage)message);
            else if (message is ChannelEofMessage)
                this.HandleMessage((ChannelEofMessage)message);
            else if (message is ChannelCloseMessage)
                this.HandleMessage((ChannelCloseMessage)message);
            else if (message is ChannelRequestMessage)
                this.HandleMessage((ChannelRequestMessage)message);
            else if (message is ChannelSuccessMessage)
                this.HandleMessage((ChannelSuccessMessage)message);
            else if (message is ChannelFailureMessage)
                this.HandleMessage((ChannelFailureMessage)message);
            else
            {
                Debug.WriteLine("SSH.NET WARNING: unknown message type {0} - may need to add new type to Session.WP.cs, HandleMessageCore method",
                    message.GetType().FullName);

                this.HandleMessage(message);
            }
        }
Пример #3
0
        partial void HandleMessageCore(Message message)
        {
            if (message == null)
                throw new ArgumentNullException("message");

            var disconnectMessage = message as DisconnectMessage;
            if (disconnectMessage != null)
            {
                HandleMessage(disconnectMessage);
                return;
            }

            var serviceRequestMessage = message as ServiceRequestMessage;
            if (serviceRequestMessage != null)
            {
                HandleMessage(serviceRequestMessage);
                return;
            }

            var serviceAcceptMessage = message as ServiceAcceptMessage;
            if (serviceAcceptMessage != null)
            {
                HandleMessage(serviceAcceptMessage);
                return;
            }

            var keyExchangeInitMessage = message as KeyExchangeInitMessage;
            if (keyExchangeInitMessage != null)
            {
                HandleMessage(keyExchangeInitMessage);
                return;
            }

            var newKeysMessage = message as NewKeysMessage;
            if (newKeysMessage != null)
            {
                HandleMessage(newKeysMessage);
                return;
            }

            var requestMessage = message as RequestMessage;
            if (requestMessage != null)
            {
                HandleMessage(requestMessage);
                return;
            }

            var failureMessage = message as FailureMessage;
            if (failureMessage != null)
            {
                HandleMessage(failureMessage);
                return;
            }

            var successMessage = message as SuccessMessage;
            if (successMessage != null)
            {
                HandleMessage(successMessage);
                return;
            }

            var bannerMessage = message as BannerMessage;
            if (bannerMessage != null)
            {
                HandleMessage(bannerMessage);
                return;
            }

            var globalRequestMessage = message as GlobalRequestMessage;
            if (globalRequestMessage != null)
            {
                HandleMessage(globalRequestMessage);
                return;
            }

            var requestSuccessMessage = message as RequestSuccessMessage;
            if (requestSuccessMessage != null)
            {
                HandleMessage(requestSuccessMessage);
                return;
            }

            var requestFailureMessage = message as RequestFailureMessage;
            if (requestFailureMessage != null)
            {
                HandleMessage(requestFailureMessage);
                return;
            }

            var channelOpenMessage = message as ChannelOpenMessage;
            if (channelOpenMessage != null)
            {
                HandleMessage(channelOpenMessage);
                return;
            }

            var channelOpenConfirmationMessage = message as ChannelOpenConfirmationMessage;
            if (channelOpenConfirmationMessage != null)
            {
                HandleMessage(channelOpenConfirmationMessage);
                return;
            }

            var channelOpenFailureMessage = message as ChannelOpenFailureMessage;
            if (channelOpenFailureMessage != null)
            {
                HandleMessage(channelOpenFailureMessage);
                return;
            }

            var channelWindowAdjustMessage = message as ChannelWindowAdjustMessage;
            if (channelWindowAdjustMessage != null)
            {
                HandleMessage(channelWindowAdjustMessage);
                return;
            }

            var channelDataMessage = message as ChannelDataMessage;
            if (channelDataMessage != null)
            {
                HandleMessage(channelDataMessage);
                return;
            }

            var channelExtendedDataMessage = message as ChannelExtendedDataMessage;
            if (channelExtendedDataMessage != null)
            {
                HandleMessage(channelExtendedDataMessage);
                return;
            }

            var channelEofMessage = message as ChannelEofMessage;
            if (channelEofMessage != null)
            {
                HandleMessage(channelEofMessage);
                return;
            }

            var channelCloseMessage = message as ChannelCloseMessage;
            if (channelCloseMessage != null)
            {
                HandleMessage(channelCloseMessage);
                return;
            }

            var channelRequestMessage = message as ChannelRequestMessage;
            if (channelRequestMessage != null)
            {
                HandleMessage(channelRequestMessage);
                return;
            }

            var channelSuccessMessage = message as ChannelSuccessMessage;
            if (channelSuccessMessage != null)
            {
                HandleMessage(channelSuccessMessage);
                return;
            }

            var channelFailureMessage = message as ChannelFailureMessage;
            if (channelFailureMessage != null)
            {
                HandleMessage(channelFailureMessage);
                return;
            }

            var ignoreMessage = message as IgnoreMessage;
            if (ignoreMessage != null)
            {
                HandleMessage(ignoreMessage);
                return;
            }

            var unimplementedMessage = message as UnimplementedMessage;
            if (unimplementedMessage != null)
            {
                HandleMessage(unimplementedMessage);
                return;
            }

            var debugMessage = message as DebugMessage;
            if (debugMessage != null)
            {
                HandleMessage(debugMessage);
                return;
            }

            Debug.WriteLine(
                "SSH.NET WARNING: unknown message type {0} - may need to add new type to Session.WP.cs, HandleMessageCore method",
                message.GetType().FullName);

            HandleMessage(message);
        }