/// <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.TcpInternalSimpleServer.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, true)) { _p2 outputParameter = new _p2(); Value.addAsynchronous(inputParameter.p0, inputParameter.p1, 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, true)) { _p2 _outputParameter_ = new _p2(); int Return; Return = Value.addSynchronous(inputParameter.p0, inputParameter.p1); _outputParameter_.Return = Return; return(socket.Send(_c1, ref _outputParameter_)); } 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); } }
/// <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.TcpInternalSimpleServer.ServerSocket socket, ref SubArray <byte> data) { AutoCSer.Net.TcpServer.ReturnType returnType; switch (index - @CommandStartIndex) { #region LOOP MethodIndexs #region NOT IsNullMethod case @MethodIndex: #region IF Attribute.IsExpired #region IF OutputParameterIndex return(socket.SendOutput(AutoCSer.Net.TcpServer.ReturnType.VersionExpired)); #endregion IF OutputParameterIndex #region NOT OutputParameterIndex return(socket.Send(AutoCSer.Net.TcpServer.ReturnType.VersionExpired)); #endregion NOT OutputParameterIndex #endregion IF Attribute.IsExpired #region NOT Attribute.IsExpired returnType = AutoCSer.Net.TcpServer.ReturnType.Unknown; try { #region IF InputParameterIndex @InputParameterTypeName inputParameter = new @InputParameterTypeName(); if (socket.DeSerialize(ref data, ref inputParameter /*IF:IsSimpleSerializeInputParamter*/, true /*IF:IsSimpleSerializeInputParamter*/)) #endregion IF InputParameterIndex { #region IF IsAsynchronousCallback #region IF MethodIsReturn @OutputParameterTypeName outputParameter = new @OutputParameterTypeName(); @MethodType.FullName /**/.TcpStaticSimpleServer.@StaticMethodIndexName(/*IF:ClientParameterName*/ socket, /*IF:ClientParameterName*//*LOOP:InputParameters*//*AT:ParameterRef*//*PUSH:Parameter*/ inputParameter.@ParameterName, /*PUSH:Parameter*//*LOOP:InputParameters*//*NOTE*/ (Func <AutoCSer.Net.TcpServer.ReturnValue <MethodReturnType.FullName>, bool>)(object)(Func <AutoCSer.Net.TcpServer.ReturnValue <@MethodReturnType.FullName>, bool>) /*NOTE*/ socket.GetCallback <@OutputParameterTypeName /*NOT:IsVerifyMethod*/, @MethodReturnType.FullName /*NOT:IsVerifyMethod*/>(@StaticMethodIdentityCommand, ref outputParameter)); #endregion IF MethodIsReturn #region NOT MethodIsReturn @MethodType.FullName /**/.TcpStaticSimpleServer.@StaticMethodIndexName(/*IF:ClientParameterName*/ socket, /*IF:ClientParameterName*//*LOOP:InputParameters*//*AT:ParameterRef*//*PUSH:Parameter*/ inputParameter.@ParameterName, /*PUSH:Parameter*//*LOOP:InputParameters*//*NOTE*/ (Func <AutoCSer.Net.TcpServer.ReturnValue <MethodReturnType.FullName>, bool>)(object)(Func <AutoCSer.Net.TcpServer.ReturnValue, bool>) /*NOTE*/ socket.GetCallback()); #endregion NOT MethodIsReturn return(true); #endregion IF IsAsynchronousCallback #region NOT IsAsynchronousCallback #region IF IsMethodServerCall (@MethodStreamName /**/.Pop() ?? new @MethodStreamName()).Set(socket, @ServerTask /*IF:InputParameterIndex*/, ref inputParameter /*IF:InputParameterIndex*/); return(true); #endregion IF IsMethodServerCall #region NOT IsMethodServerCall #region IF OutputParameterIndex @OutputParameterTypeName _outputParameter_ = new @OutputParameterTypeName(); #endregion IF OutputParameterIndex /*IF:MethodIsReturn*/ @MethodReturnType.FullName @ReturnName; /*IF:MethodIsReturn*/ #region IF MemberIndex #region IF Method.IsGetMember @ReturnName = /*NOTE*/ (MethodReturnType.FullName) /*NOTE*/ @MethodType.FullName /**/.TcpStaticSimpleServer.@StaticMethodIndexName(); #endregion IF Method.IsGetMember #region NOT Method.IsGetMember @MethodType.FullName /**/.TcpStaticSimpleServer.@StaticMethodIndexName(/*LOOP:InputParameters*/ inputParameter./*PUSH:Parameter*/ @ParameterName /*PUSH:Parameter*//*LOOP:InputParameters*/); #endregion NOT Method.IsGetMember #endregion IF MemberIndex #region NOT MemberIndex /*IF:MethodIsReturn*/ @ReturnName = /*NOTE*/ (MethodReturnType.FullName) /*NOTE*//*IF:MethodIsReturn*//*PUSH:Method*/ @MethodType.FullName /**/.TcpStaticSimpleServer.@StaticMethodIndexName/*PUSH:Method*/ (/*IF:ClientParameterName*/ socket /*IF:InputParameters.Length*/, /*IF:InputParameters.Length*//*IF:ClientParameterName*//*LOOP:InputParameters*//*AT:ParameterRef*//*IF:MethodParameter.IsOut*//*PUSH:InputParameter*/ _outputParameter_.@ParameterName /*PUSH:InputParameter*//*IF:MethodParameter.IsOut*//*NOTE*/, /*NOTE*//*NOT:MethodParameter.IsOut*//*PUSH:Parameter*/ inputParameter.@ParameterName /*PUSH:Parameter*//*NOT:MethodParameter.IsOut*//*PUSH:Parameter*//*AT:ParameterJoin*//*PUSH:Parameter*//*LOOP:InputParameters*/); #endregion NOT MemberIndex #region IF OutputParameterIndex #region IF IsVerifyMethod if (/*NOTE*/ (bool)(object)/*NOTE*/ @ReturnName) { socket.SetVerifyMethod(); } #endregion IF IsVerifyMethod #region LOOP OutputParameters #region NOT InputMethodParameter.IsOut /*PUSH:Parameter*/ _outputParameter_.@ParameterName /*PUSH:Parameter*/ = inputParameter./*PUSH:InputParameter*/ @ParameterName /*PUSH:InputParameter*/; #endregion NOT InputMethodParameter.IsOut #endregion LOOP OutputParameters #region IF MethodIsReturn _outputParameter_.@ReturnName = @ReturnName; #endregion IF MethodIsReturn return(socket.Send(@StaticMethodIdentityCommand, ref _outputParameter_)); #endregion IF OutputParameterIndex #region NOT OutputParameterIndex return(socket.Send()); #endregion NOT OutputParameterIndex #endregion NOT IsMethodServerCall #endregion NOT IsAsynchronousCallback } #region IF InputParameterIndex returnType = AutoCSer.Net.TcpServer.ReturnType.ServerDeSerializeError; #endregion IF InputParameterIndex } catch (Exception error) { returnType = AutoCSer.Net.TcpServer.ReturnType.ServerException; socket.Log(error); } #region IF OutputParameterIndex return(socket.SendOutput(returnType)); #endregion IF OutputParameterIndex #region NOT OutputParameterIndex return(socket.Send(returnType)); #endregion NOT OutputParameterIndex #endregion NOT Attribute.IsExpired #endregion NOT IsNullMethod #endregion LOOP MethodIndexs default: return(false); } }