/// <summary>
            /// 命令处理
            /// </summary>
            /// <param name="index">命令序号</param>
            /// <param name="socket">TCP 内部服务套接字数据发送</param>
            /// <param name="data">命令数据</param>
            /// <returns>是否成功</returns>
            public override bool DoCommand(int index, AutoCSer.Net.TcpOpenSimpleServer.ServerSocket socket, ref SubArray <byte> data)
            {
                AutoCSer.Net.TcpServer.ReturnType returnType;
                switch (index - 128)
                {
                case 0:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p1 inputParameter = new _p1();
                        if (socket.DeSerialize(ref data, ref inputParameter))
                        {
                            _p2 outputParameter = new _p2();

                            Value.Add(inputParameter.left, inputParameter.right, socket.GetCallback <_p2, int>(_c0, ref outputParameter));
                            return(true);
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

                default: return(false);
                }
            }
示例#2
0
 public override void Call()
 {
     AutoCSer.Net.TcpOpenSimpleServer.ServerSocket socket = Socket;
     AutoCSer.Net.TcpServer.ReturnValue <_p2>      value  = new AutoCSer.Net.TcpServer.ReturnValue <_p2>();
     get(ref value);
     push(this);
     socket.SendAsync(_c5, ref value);
 }
示例#3
0
            /// <summary>
            /// 命令处理
            /// </summary>
            /// <param name="index">命令序号</param>
            /// <param name="socket">TCP 内部服务套接字数据发送</param>
            /// <param name="data">命令数据</param>
            /// <returns>是否成功</returns>
            public override bool DoCommand(int index, AutoCSer.Net.TcpOpenSimpleServer.ServerSocket socket, ref SubArray <byte> data)
            {
                AutoCSer.Net.TcpServer.ReturnType returnType;
                switch (index - 128)
                {
                case 0:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p1 inputParameter = new _p1();
                        if (socket.DeSerialize(ref data, ref inputParameter))
                        {
                            _p2 outputParameter = new _p2();

                            Value.addAsynchronous(inputParameter.left, inputParameter.right, socket.GetCallback <_p2, int>(_c0, ref outputParameter));
                            return(true);
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

                case 1:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p1 inputParameter = new _p1();
                        if (socket.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s1 /**/.Pop() ?? new _s1()).Set(socket, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpQueue, ref inputParameter);
                            return(true);
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

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

                            int Return;

                            Return = Value.addSynchronous(inputParameter.left, inputParameter.right);
                            _outputParameter_.Return = Return;
                            return(socket.Send(_c2, ref _outputParameter_));
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

                case 3:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p1 inputParameter = new _p1();
                        if (socket.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s3 /**/.Pop() ?? new _s3()).Set(socket, Value, AutoCSer.Net.TcpServer.ServerTaskType.TcpTask, ref inputParameter);
                            return(true);
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

                case 4:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p1 inputParameter = new _p1();
                        if (socket.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s4 /**/.Pop() ?? new _s4()).Set(socket, Value, AutoCSer.Net.TcpServer.ServerTaskType.ThreadPool, ref inputParameter);
                            return(true);
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

                case 5:
                    returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown;
                    try
                    {
                        _p1 inputParameter = new _p1();
                        if (socket.DeSerialize(ref data, ref inputParameter))
                        {
                            (_s5 /**/.Pop() ?? new _s5()).Set(socket, Value, AutoCSer.Net.TcpServer.ServerTaskType.Timeout, ref inputParameter);
                            return(true);
                        }
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError;
                    }
                    catch (Exception error)
                    {
                        returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException;
                        socket.Log(error);
                    }
                    return(socket.SendOutput(returnType));

                default: return(false);
                }
            }
示例#4
0
 private string myName(AutoCSer.Net.TcpOpenSimpleServer.ServerSocket client)
 {
     return(TcpStaticSimpleServer.GetSession.MyName(client));
 }
示例#5
0
 private bool login(AutoCSer.Net.TcpOpenSimpleServer.ServerSocket client, string user, string password)
 {
     return(TcpStaticSimpleServer.Session.Login(client, user, password));
 }