Exemple #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.TcpOpenStreamServer.ClientSocketSender _socket_  = _TcpClient_.Sender;
                if (_socket_ != null)
                {
                    TcpOpenStreamServer._p1 _inputParameter_ = new TcpOpenStreamServer._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 <TcpOpenStreamServer._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_);
            }
Exemple #2
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 <TcpOpenStreamServer._p2> _wait_ = AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenStreamServer._p2> .Pop();

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

                            right = right,
                        };
                        TcpOpenStreamServer._p2 _outputParameter_ = new TcpOpenStreamServer._p2
                        {
                        };
                        AutoCSer.Net.TcpServer.ReturnType _returnType_ = _socket_.WaitGet <TcpOpenStreamServer._p1, TcpOpenStreamServer._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 <TcpOpenStreamServer._p2> .PushNotNull(_wait_);
                    }
                }
                return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                    Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                });
            }
 /// <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.TcpOpenStreamServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
     if (_socket_ != null)
     {
         AutoCSer.Net.TcpServer.TaskAsyncReturnValue<TcpOpenStreamServer._p2> _wait_ = new AutoCSer.Net.TcpServer.TaskAsyncReturnValue<TcpOpenStreamServer._p2>();
         TcpOpenStreamServer._p1 _inputParameter_ = new TcpOpenStreamServer._p1
         {
             
             left = left,
             
             right = right,
         };
         AutoCSer.Net.TcpServer.ReturnType _returnType_;
         TcpOpenStreamServer._p2 _outputParameter_ = new TcpOpenStreamServer._p2
         {
         };
         if ((_returnType_ = _socket_.GetAsync<TcpOpenStreamServer._p1, TcpOpenStreamServer._p2>(_a0, _wait_, ref _inputParameter_, ref _outputParameter_)) == AutoCSer.Net.TcpServer.ReturnType.Success)
         {
             AutoCSer.Net.TcpServer.ReturnValue<TcpOpenStreamServer._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 <TcpOpenStreamServer._p2> > _onOutput_ = _TcpClient_.GetCallback <int, TcpOpenStreamServer._p2>(_onReturn_);
                try
                {
                    AutoCSer.Net.TcpOpenStreamServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
                    if (_socket_ != null)
                    {
                        TcpOpenStreamServer._p1 _inputParameter_ = new TcpOpenStreamServer._p1
                        {
                            left = left,

                            right = right,
                        };
                        _socket_.Get <TcpOpenStreamServer._p1, TcpOpenStreamServer._p2>(_ac0, ref _onOutput_, ref _inputParameter_);
                    }
                }
                finally
                {
                    if (_onOutput_ != null)
                    {
                        AutoCSer.Net.TcpServer.ReturnValue <TcpOpenStreamServer._p2> _outputParameter_ = new AutoCSer.Net.TcpServer.ReturnValue <TcpOpenStreamServer._p2> {
                            Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                        };
                        _onOutput_.Call(ref _outputParameter_);
                    }
                }
            }
Exemple #5
0
            public AutoCSer.Net.TcpServer.ReturnValue <int> this[int index]
            {
                get
                {
                    AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenStreamServer._p1> _wait_ = AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenStreamServer._p1> .Pop();

                    try
                    {
                        AutoCSer.Net.TcpOpenStreamServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
                        if (_socket_ != null)
                        {
                            TcpOpenStreamServer._p2 _inputParameter_ = new TcpOpenStreamServer._p2
                            {
                                index = index,
                            };
                            AutoCSer.Net.TcpServer.ReturnValue <TcpOpenStreamServer._p1> _outputParameter_ = _socket_.WaitGet <TcpOpenStreamServer._p2, TcpOpenStreamServer._p1>(_c1, ref _wait_, ref _inputParameter_);
                            return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                                Type = _outputParameter_.Type, Value = _outputParameter_.Value.Return
                            });
                        }
                    }
                    finally
                    {
                        if (_wait_ != null)
                        {
                            AutoCSer.Net.TcpServer.AutoWaitReturnValue <TcpOpenStreamServer._p1> .PushNotNull(_wait_);
                        }
                    }
                    return(new AutoCSer.Net.TcpServer.ReturnValue <int> {
                        Type = AutoCSer.Net.TcpServer.ReturnType.ClientException
                    });
                }
                set
                {
                    AutoCSer.Net.TcpServer.AutoWaitReturnValue _wait_ = AutoCSer.Net.TcpServer.AutoWaitReturnValue.Pop();
                    try
                    {
                        AutoCSer.Net.TcpOpenStreamServer.ClientSocketSender _socket_ = _TcpClient_.Sender;
                        if (_socket_ != null)
                        {
                            TcpOpenStreamServer._p3 _inputParameter_ = new TcpOpenStreamServer._p3
                            {
                                index = index,

                                value = value,
                            };
                            AutoCSer.Net.TcpServer.ReturnType _returnType_ = _socket_.WaitCall(_c2, ref _wait_, ref _inputParameter_);
                            if (_returnType_ == AutoCSer.Net.TcpServer.ReturnType.Success)
                            {
                                return;
                            }
                            throw new Exception(_returnType_.ToString());
                        }
                    }
                    finally
                    {
                        if (_wait_ != null)
                        {
                            AutoCSer.Net.TcpServer.AutoWaitReturnValue.PushNotNull(_wait_);
                        }
                    }
                    throw new Exception(AutoCSer.Net.TcpServer.ReturnType.ClientException.ToString());
                }
            }
Exemple #6
0
 /// <summary>
 /// 客户端验证
 /// </summary>
 /// <param name="client"></param>
 /// <param name="sender"></param>
 /// <returns></returns>
 public bool Verify(Session.TcpOpenStreamClient client, AutoCSer.Net.TcpOpenStreamServer.ClientSocketSender sender)
 {
     return(client.login(sender, user, password).Value);
 }