/// <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 - @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(); /*PUSH:Method*/ Value.@MethodName/*PUSH:Method*/ (/*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*/>(@MethodIdentityCommand, ref outputParameter)); #endregion IF MethodIsReturn #region NOT MethodIsReturn /*PUSH:Method*/ Value.@MethodName/*PUSH:Method*/ (/*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, Value, @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 #region IF Method.PropertyParameter @ReturnName = /*NOTE*/ (MethodReturnType.FullName) /*NOTE*/ Value[/*IF:ClientParameterName*/ socket /*IF:InputParameters.Length*/, /*IF:InputParameters.Length*//*IF:ClientParameterName*//*LOOP:InputParameters*//*AT:ParameterRef*//*PUSH:Parameter*/ inputParameter.@ParameterName /*AT:ParameterJoin*//*PUSH:Parameter*//*LOOP:InputParameters*/]; #endregion IF Method.PropertyParameter #region NOT Method.PropertyParameter @ReturnName = /*NOTE*/ (MethodReturnType.FullName) /*NOTE*/ Value.@PropertyName; #endregion NOT Method.PropertyParameter #endregion IF Method.IsGetMember #region NOT Method.IsGetMember #region IF Method.PropertyParameter Value[/*IF:ClientParameterName*/ socket, /*IF:ClientParameterName*//*LOOP:InputParameters*//*NOT:MethodParameter.IsPropertyValue*//*AT:ParameterRef*//*PUSH:Parameter*/ inputParameter.@ParameterName /*AT:ParameterJoin*//*PUSH:Parameter*//*NOT:MethodParameter.IsPropertyValue*//*LOOP:InputParameters*/] = /*LOOP:InputParameters*//*IF:MethodParameter.IsPropertyValue*//*PUSH:Parameter*/ inputParameter.@ParameterName /*PUSH:Parameter*//*IF:MethodParameter.IsPropertyValue*//*LOOP:InputParameters*/; #endregion IF Method.PropertyParameter #region NOT Method.PropertyParameter Value.@PropertyName = /*LOOP:InputParameters*/ inputParameter./*PUSH:Parameter*/ @ParameterName /*PUSH:Parameter*//*LOOP:InputParameters*/; #endregion NOT Method.PropertyParameter #endregion NOT Method.IsGetMember #endregion IF MemberIndex #region NOT MemberIndex /*IF:MethodIsReturn*/ @ReturnName = /*NOTE*/ (MethodReturnType.FullName) /*NOTE*//*IF:MethodIsReturn*//*PUSH:Method*/ Value.@MethodName/*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(@MethodIdentityCommand, 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); } }
protected override bool callAjax(int callIndex, AutoCSer.WebView.AjaxBase page) { switch (callIndex) { #region LOOP Methods case @MethodIndex: { #region IF InputParameterIndex @InputParameterTypeName inputParameter = new @InputParameterTypeName(); if (page.ParseParameter(ref inputParameter)) #endregion IF InputParameterIndex { @WebAjaxMethodType.FullName ajax = (@WebAjaxMethodType.FullName)page; #region IF OutputParameterIndex @OutputParameterTypeName outputParameter = new @OutputParameterTypeName { /*LOOP:MethodParameters*//*IF:IsRef*/ @ParameterName = inputParameter.@ParameterName, /*IF:IsRef*//*LOOP:MethodParameters*/ }; #endregion IF OutputParameterIndex #region IF IsAsynchronousCallback #region IF MethodIsReturn @AsyncIndexName returnCallbak = new @AsyncIndexName { Ajax = ajax, Parameter = outputParameter }; ajax./*PUSH:Method*/ @MethodName/*PUSH:Method*/ (/*LOOP:MethodParameters*//*AT:ParameterRef*/ inputParameter.@ParameterName, /*LOOP:MethodParameters*//*NOTE*/ (Action <AutoCSer.Net.TcpServer.ReturnValue <@MethodReturnType.FullName> >) /*NOTE*/ returnCallbak.Callback); #endregion IF MethodIsReturn #region NOT MethodIsReturn #region IF IsPoolType AjaxCallbackPool <@WebAjaxMethodType.FullName /*IF:OutputParameterIndex*/, @OutputParameterTypeName /*IF:OutputParameterIndex*/> callbackPool = new AjaxCallbackPool <@WebAjaxMethodType.FullName /*IF:OutputParameterIndex*/, @OutputParameterTypeName /*IF:OutputParameterIndex*/> { Ajax = ajax /*IF:OutputParameterIndex*/, Parameter = outputParameter /*IF:OutputParameterIndex*/ }; ajax./*PUSH:Method*/ @MethodName/*PUSH:Method*/ (/*LOOP:MethodParameters*//*AT:ParameterRef*/ inputParameter.@ParameterName, /*LOOP:MethodParameters*//*NOTE*/ (Action <AutoCSer.Net.TcpServer.ReturnValue>) /*NOTE*/ callbackPool.Callback); #endregion IF IsPoolType #region NOT IsPoolType AjaxCallback /*IF:OutputParameterIndex*/ <@OutputParameterTypeName> /*IF:OutputParameterIndex*/ callback = new AjaxCallback /*IF:OutputParameterIndex*/ <@OutputParameterTypeName> /*IF:OutputParameterIndex*/ { Ajax = /*NOTE*/ (AutoCSer.WebView.Ajax)(object) /*NOTE*/ ajax /*IF:OutputParameterIndex*/, Parameter = outputParameter /*IF:OutputParameterIndex*/ }; ajax./*PUSH:Method*/ @MethodName/*PUSH:Method*/ (/*LOOP:MethodParameters*//*AT:ParameterRef*/ inputParameter.@ParameterName, /*LOOP:MethodParameters*//*NOTE*/ (Action <AutoCSer.Net.TcpServer.ReturnValue>) /*NOTE*/ callback.Callback); #endregion NOT IsPoolType #endregion NOT MethodIsReturn #endregion IF IsAsynchronousCallback #region NOT IsAsynchronousCallback try { /*IF:MethodIsReturn*/ outputParameter.Return = /*NOTE*/ (@MethodReturnType.FullName) /*NOTE*//*IF:MethodIsReturn*/ ajax./*PUSH:Method*/ @MethodName/*PUSH:Method*/ (/*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*/); #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 } finally { responseAjax(ajax /*IF:OutputParameterIndex*/, ref outputParameter /*IF:OutputParameterIndex*/); } #endregion NOT IsAsynchronousCallback return(true); } } return(false); #endregion LOOP Methods default: return(false); } }