コード例 #1
0
            /// <summary>
            /// 命令处理
            /// </summary>
            /// <param name="index">命令序号</param>
            /// <param name="sender">TCP 内部服务套接字数据发送</param>
            /// <param name="data">命令数据</param>
            public override void DoCommand(int index, AutoCSer.Net.TcpOpenServer.ServerSocketSender sender, ref SubArray <byte> data)
            {
                AutoCSer.Net.TcpServer.ReturnType returnType;
                switch (index - 128)
                {
                case 0:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        {
                            _p1 outputParameter = new _p1();
                            _s0 serverCall      = _s0 /**/.Pop() ?? new _s0();
                            serverCall.AsynchronousCallback = sender.GetCallback <_p1, AutoCSer.TestCase.ChatData.Message>(_c0, ref outputParameter);
                            serverCall.Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue);
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 1:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        {
                            _p2 outputParameter = new _p2();
                            _s1 serverCall      = _s1 /**/.Pop() ?? new _s1();
                            serverCall.AsynchronousCallback = sender.GetCallback <_p2, AutoCSer.TestCase.ChatData.UserLogin>(_c1, ref outputParameter);
                            serverCall.Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue);
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 2:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p3 inputParameter = new _p3();
                        if (sender.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s2 /**/.Pop() ?? new _s2()).Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue, ref inputParameter);
                            return;
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 3:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        {
                            (_s3 /**/.Pop() ?? new _s3()).Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue);
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 4:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p5 inputParameter = new _p5();
                        if (sender.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s4 /**/.Pop() ?? new _s4()).Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue, ref inputParameter);
                            return;
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                default: return;
                }
            }
コード例 #2
0
            /// <summary>
            /// 命令处理
            /// </summary>
            /// <param name="index">命令序号</param>
            /// <param name="sender">TCP 内部服务套接字数据发送</param>
            /// <param name="data">命令数据</param>
            public override void DoCommand(int index, AutoCSer.Net.TcpOpenServer.ServerSocketSender sender, ref SubArray <byte> data)
            {
                AutoCSer.Net.TcpServer.ReturnType returnType;
                switch (index - 128)
                {
                case 0:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        {
                            _p1 outputParameter = new _p1();

                            Value.getMessage(sender, sender.GetCallback <_p1, AutoCSer.TestCase.ChatData.Message>(_c0, ref outputParameter));
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 1:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        {
                            _p2 outputParameter = new _p2();

                            Value.getUser(sender, sender.GetCallback <_p2, AutoCSer.TestCase.ChatData.UserLogin>(_c1, ref outputParameter));
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 2:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p3 inputParameter = new _p3();
                        if (sender.DeSerialize(ref data, ref inputParameter))
                        {
                            _p4 _outputParameter_ = new _p4();

                            bool Return;

                            Return = Value.login(sender, inputParameter.userName);
                            if (Return)
                            {
                                sender.SetVerifyMethod();
                            }
                            _outputParameter_.Return = Return;
                            sender.Push(_c2, ref _outputParameter_);
                            return;
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 3:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        {
                            (_s3 /**/.Pop() ?? new _s3()).Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue);
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                case 4:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p5 inputParameter = new _p5();
                        if (sender.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s4 /**/.Pop() ?? new _s4()).Set(sender, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue, ref inputParameter);
                            return;
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        sender.AddLog(error);
                    }
                    sender.Push(returnType);
                    return;

                default: return;
                }
            }