示例#1
0
            /// <summary>
            /// 支持公共函数
            /// </summary>
            /// <param name="left">加法左值</param>
            /// <param name="right">加法右值</param>
            public AutoCSer.Net.TcpServer.AwaiterBoxReference <int> AddAwaiter(int left, int right)
            {
                AutoCSer.Net.TcpServer.AwaiterBoxReference <int> _awaiter_ = new AutoCSer.Net.TcpServer.AwaiterBoxReference <int>();
                AutoCSer.Net.TcpOpenServer.ClientSocketSender    _socket_  = _TcpClient_.Sender;
                if (_socket_ != null)
                {
                    TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                    {
                        left = left,

                        right = right,
                    };
                    AutoCSer.Net.TcpServer.ReturnType _returnType_;
                    AutoCSer.Net.TcpServer.AwaiterReturnValueBoxReference <int> _outputParameter_ = default(AutoCSer.Net.TcpServer.AwaiterReturnValueBoxReference <int>);
                    _returnType_ = _socket_.GetAwaiter <TcpOpenServer._p1, AutoCSer.Net.TcpServer.AwaiterReturnValueBoxReference <int> >(_a0, _awaiter_, ref _inputParameter_, ref _outputParameter_);
                    if (_returnType_ != AutoCSer.Net.TcpServer.ReturnType.Success)
                    {
                        _awaiter_.Call(_returnType_);
                    }
                }
                else
                {
                    _awaiter_.Call(AutoCSer.Net.TcpServer.ReturnType.ClientException);
                }
                return(_awaiter_);
            }
示例#2
0
            /// <summary>
            /// 异步回调注册测试
            /// </summary>
            /// <param name="left">加法左值</param>
            /// <param name="right">加法右值</param>
            /// <param name="count">回调次数</param>
            /// <returns>保持异步回调</returns>
            public AutoCSer.Net.TcpServer.KeepCallback Add(int left, int right, int count, Action <AutoCSer.Net.TcpServer.ReturnValue <int> > _onReturn_)
            {
                AutoCSer.Net.Callback <AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> > _onOutput_ = _TcpClient_.GetCallback <int, TcpOpenServer._p2>(_onReturn_);
                try
                {
                    AutoCSer.Net.TcpOpenServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
                    if (_socket_ != null)
                    {
                        TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                        {
                            left = left,

                            right = right,

                            count = count,
                        };
                        return(_socket_.GetKeep <TcpOpenServer._p1, TcpOpenServer._p2>(_ac0, ref _onOutput_, ref _inputParameter_));
                    }
                }
                finally
                {
                    if (_onOutput_ != null)
                    {
                        AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> _outputParameter_ = new AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> {
                            Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                        };
                        _onOutput_.Call(ref _outputParameter_);
                    }
                }
                return(null);
            }
示例#3
0
            /// <summary>
            /// 支持公共函数
            /// </summary>
            /// <param name="left">加法左值</param>
            /// <param name="right">加法右值</param>
            public AutoCSer.Net.TcpServer.ReturnValue <int> Add(int left, int right)
            {
                AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenServer._p2> _wait_ = AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenServer._p2> .Pop();

                try
                {
                    AutoCSer.Net.TcpOpenServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
                    if (_socket_ != null)
                    {
                        TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                        {
                            left = left,

                            right = right,
                        };
                        TcpOpenServer._p2 _outputParameter_ = new TcpOpenServer._p2
                        {
                        };
                        AutoCSer.Net.TcpServer.ReturnType _returnType_ = _socket_.WaitGet <TcpOpenServer._p1, TcpOpenServer._p2>(_c0, ref _wait_, ref _inputParameter_, ref _outputParameter_);
                        return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                            Type = _returnType_, Value = _outputParameter_.Return
                        });
                    }
                }
                finally
                {
                    if (_wait_ != null)
                    {
                        AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenServer._p2> .PushNotNull(_wait_);
                    }
                }
                return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                    Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                });
            }
示例#4
0
            /// <summary>
            /// 同步函数客户端 async / await 测试
            /// </summary>
            /// <param name="left">加法左值</param>
            /// <param name="right">加法右值</param>
            public async System.Threading.Tasks.Task <AutoCSer.Net.TcpServer.ReturnValue <int> > AddAsync(int left, int right)
            {
                AutoCSer.Net.TcpOpenServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
                if (_socket_ != null)
                {
                    AutoCSer.Net.TcpServer.TaskAsyncReturnValue <TcpOpenServer._p2> _wait_ = new AutoCSer.Net.TcpServer.TaskAsyncReturnValue <TcpOpenServer._p2>();
                    TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                    {
                        left = left,

                        right = right,
                    };
                    AutoCSer.Net.TcpServer.ReturnType _returnType_;
                    TcpOpenServer._p2 _outputParameter_ = new TcpOpenServer._p2
                    {
                    };
                    if ((_returnType_ = _socket_.GetAsync <TcpOpenServer._p1, TcpOpenServer._p2>(_a0, _wait_, ref _inputParameter_, ref _outputParameter_)) == AutoCSer.Net.TcpServer.ReturnType.Success)
                    {
                        AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> _returnOutputParameter_ = await _wait_;
                        return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                            Type = _returnOutputParameter_.Type, Value = _returnOutputParameter_.Value.Return
                        });
                    }
                    return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                        Type = _returnType_
                    });
                }
                return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                    Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                });
            }
            /// <summary>
            /// 同步函数客户端异步测试
            /// </summary>
            /// <param name="left">加法左值</param>
            /// <param name="right">加法右值</param>
            public void Add(int left, int right, Action <AutoCSer.Net.TcpServer.ReturnValue <int> > _onReturn_)
            {
                AutoCSer.Net.Callback <AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> > _onOutput_ = _TcpClient_.GetCallback <int, TcpOpenServer._p2>(_onReturn_);
                AutoCSer.Net.TcpOpenServer.ClientSocketSender _socket_ = null;
                try
                {
                    _socket_ = _TcpClient_.Sender;
                    if (_socket_ != null)
                    {
                        TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                        {
                            left = left,

                            right = right,
                        };
                        _socket_.Get <TcpOpenServer._p1, TcpOpenServer._p2>(_ac0, ref _onOutput_, ref _inputParameter_);
                    }
                }
                finally
                {
                    if (_onOutput_ != null)
                    {
                        AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> _outputParameter_ = new AutoCSer.Net.TcpServer.ReturnValue <TcpOpenServer._p2> {
                            Type = _socket_ == null ? AutoCSer.Net.TcpServer.ReturnType.ClientSocketNull : AutoCSer.Net.TcpServer.ReturnType.ClientException
                        };
                        _onOutput_.Call(ref _outputParameter_);
                    }
                }
            }
            /// <summary>
            /// 用户登录
            /// </summary>
            /// <param name="userName">用户名称</param>
            /// <returns>是否成功</returns>
            public AutoCSer.Net.TcpServer.ReturnValue <bool> login(AutoCSer.Net.TcpOpenServer.ClientSocketSender _sender_, string userName)
            {
                AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenServer._p2> _wait_ = AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenServer._p2> .Pop();

                try
                {
                    AutoCSer.Net.TcpOpenServer.ClientSocketSender _socket_ = _sender_;
                    if (_socket_ != null)
                    {
                        TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                        {
                            userName = userName,
                        };
                        TcpOpenServer._p2 _outputParameter_ = new TcpOpenServer._p2
                        {
                        };
                        AutoCSer.Net.TcpServer.ReturnType _returnType_ = _socket_.WaitGet <TcpOpenServer._p1, TcpOpenServer._p2>(_c0, ref _wait_, ref _inputParameter_, ref _outputParameter_);
                        return(new AutoCSer.Net.TcpServer.ReturnValue <bool> {
                            Type = _returnType_, Value = _outputParameter_.Return
                        });
                    }
                }
                finally
                {
                    if (_wait_ != null)
                    {
                        AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenServer._p2> .PushNotNull(_wait_);
                    }
                }
                return(new AutoCSer.Net.TcpServer.ReturnValue <bool> {
                    Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                });
            }
示例#7
0
            public void SetSum(int left, int right)
            {
                TcpOpenServer._p1 _inputParameter_ = new TcpOpenServer._p1
                {
                    left = left,

                    right = right,
                };
                _TcpClient_.Sender.CallOnly(_c0, ref _inputParameter_);
            }