Ejemplo n.º 1
0
                /// <summary>
                /// 添加方法索引信息
                /// </summary>
                /// <param name="method">方法索引信息</param>
                public void Add(AjaxMethod method)
                {
                    MethodParameter[]        inputParameters = method.MethodParameters, outputParameters = method.Method.OutputParameters;
                    MethodParameterTypeNames inputParameterTypeNames = new MethodParameterTypeNames(inputParameters, false, method.Attribute.IsInputSerializeBox);
                    MethodParameterTypeNames outputParameterTypeNames = method.MethodIsReturn ? new MethodParameterTypeNames(outputParameters, method.MethodReturnType, false, method.Attribute.IsOutputSerializeBox) : new MethodParameterTypeNames(outputParameters, false, method.Attribute.IsOutputSerializeBox);
                    MethodParameterTypeNames historyInputJsonParameterIndex = default(MethodParameterTypeNames), historyOutputJsonParameterIndex = default(MethodParameterTypeNames);

                    if (inputParameterTypeNames.IsParameter)
                    {
                        if (!ParameterIndexs.TryGetValue(ref inputParameterTypeNames, out historyInputJsonParameterIndex))
                        {
                            inputParameterTypeNames.Copy(++ParameterIndex);
                            ParameterIndexs.Set(ref inputParameterTypeNames, historyInputJsonParameterIndex = inputParameterTypeNames);
                        }
                        method.InputParameterIndex = historyInputJsonParameterIndex.Index;
                    }
                    if (outputParameterTypeNames.IsParameter)
                    {
                        if (!ParameterIndexs.TryGetValue(ref outputParameterTypeNames, out historyOutputJsonParameterIndex))
                        {
                            outputParameterTypeNames.Copy(++ParameterIndex);
                            ParameterIndexs.Set(ref outputParameterTypeNames, historyOutputJsonParameterIndex = outputParameterTypeNames);
                        }
                        method.OutputParameterIndex = historyOutputJsonParameterIndex.Index;
                    }
                    method.InputParameters  = MethodParameterPair.Get(inputParameters, historyInputJsonParameterIndex);
                    method.OutputParameters = MethodParameterPair.Get(outputParameters, historyOutputJsonParameterIndex);
                    MethodParameterPair.SetInputParameter(method.OutputParameters, method.InputParameters);
                }
Ejemplo n.º 2
0
                /// <summary>
                /// 添加方法索引信息
                /// </summary>
                /// <param name="method">方法索引信息</param>
                public void Add(CallMethod method)
                {
                    MethodParameter[]        parameters                = method.MethodParameters;
                    MethodParameterTypeNames parameterTypeNames        = new MethodParameterTypeNames(parameters, false, false);
                    MethodParameterTypeNames historyJsonParameterIndex = default(MethodParameterTypeNames);

                    if (parameterTypeNames.IsParameter)
                    {
                        if (!ParameterIndexs.TryGetValue(ref parameterTypeNames, out historyJsonParameterIndex))
                        {
                            parameterTypeNames.Copy(++ParameterIndex);
                            ParameterIndexs.Set(ref parameterTypeNames, historyJsonParameterIndex = parameterTypeNames);
                        }
                        method.ParameterIndex = historyJsonParameterIndex.Index;
                    }
                    //method.Parameters = MethodParameterPair.Get(parameters, historyJsonParameterIndex);
                }
Ejemplo n.º 3
0
 /// <summary>
 /// 添加方法索引信息
 /// </summary>
 /// <param name="method">方法索引信息</param>
 public void Add(TcpMethod method)
 {
     MethodParameter[] inputParameters = method.MethodParameters, outputParameters = method.Method.OutputParameters;
     if (method.IsJsonSerialize)
     {
         MethodParameterTypeNames inputParameterTypeNames = new MethodParameterTypeNames(inputParameters, method.Attribute.IsInputSerializeReferenceMember, method.Attribute.IsInputSerializeBox);
         MethodParameterTypeNames outputParameterTypeNames = method.MethodIsReturn ? new MethodParameterTypeNames(outputParameters, method.MethodReturnType, method.Attribute.IsOutputSerializeReferenceMember, method.Attribute.IsOutputSerializeBox) : new MethodParameterTypeNames(outputParameters, method.Attribute.IsOutputSerializeReferenceMember, method.Attribute.IsOutputSerializeBox);
         MethodParameterTypeNames historyInputJsonParameterIndex = default(MethodParameterTypeNames), historyOutputJsonParameterIndex = default(MethodParameterTypeNames);
         if (inputParameterTypeNames.IsParameter)
         {
             if (!JsonParameterIndexs.TryGetValue(inputParameterTypeNames, out historyInputJsonParameterIndex))
             {
                 inputParameterTypeNames.Copy(++ParameterIndex);
                 JsonParameterIndexs.Add(inputParameterTypeNames, historyInputJsonParameterIndex = inputParameterTypeNames);
             }
             method.InputParameterIndex = historyInputJsonParameterIndex.Index;
         }
         if (outputParameterTypeNames.IsParameter)
         {
             if (!JsonParameterIndexs.TryGetValue(outputParameterTypeNames, out historyOutputJsonParameterIndex))
             {
                 outputParameterTypeNames.Copy(++ParameterIndex);
                 JsonParameterIndexs.Add(outputParameterTypeNames, historyOutputJsonParameterIndex = outputParameterTypeNames);
             }
             method.OutputParameterIndex = historyOutputJsonParameterIndex.Index;
         }
         method.InputParameters  = MethodParameterPair.Get(inputParameters, historyInputJsonParameterIndex);
         method.OutputParameters = MethodParameterPair.Get(outputParameters, historyOutputJsonParameterIndex);
     }
     else
     {
         MethodParameterTypes inputParameterTypes = new MethodParameterTypes(inputParameters, method.Attribute.IsInputSerializeReferenceMember, method.Attribute.IsInputSerializeBox);
         MethodParameterTypes outputParameterTypes = method.MethodIsReturn ? new MethodParameterTypes(outputParameters, method.MethodReturnType, method.Attribute.IsOutputSerializeReferenceMember, method.Attribute.IsOutputSerializeBox) : new MethodParameterTypes(outputParameters, method.Attribute.IsOutputSerializeReferenceMember, method.Attribute.IsOutputSerializeBox);
         MethodParameterTypes historyInputParameterIndex = default(MethodParameterTypes), historyOutputParameterIndex = default(MethodParameterTypes);
         if (inputParameterTypes.IsParameter)
         {
             if (!ParameterIndexs.TryGetValue(inputParameterTypes, out historyInputParameterIndex))
             {
                 inputParameterTypes.Copy(++ParameterIndex);
                 ParameterIndexs.Add(inputParameterTypes, historyInputParameterIndex = inputParameterTypes);
             }
             method.InputParameterIndex = historyInputParameterIndex.Index;
             if (IsSimpleSerialize)
             {
                 method.IsSimpleSerializeInputParamter = historyInputParameterIndex.IsSimpleSerialize;
             }
         }
         if (outputParameterTypes.IsParameter)
         {
             if (!ParameterIndexs.TryGetValue(outputParameterTypes, out historyOutputParameterIndex))
             {
                 outputParameterTypes.Copy(++ParameterIndex);
                 ParameterIndexs.Add(outputParameterTypes, historyOutputParameterIndex = outputParameterTypes);
             }
             method.OutputParameterIndex = historyOutputParameterIndex.Index;
             if (IsSimpleSerialize)
             {
                 method.IsSimpleSerializeOutputParamter = historyOutputParameterIndex.IsSimpleSerialize;
             }
         }
         method.InputParameters  = MethodParameterPair.Get(inputParameters, historyInputParameterIndex);
         method.OutputParameters = MethodParameterPair.Get(outputParameters, historyOutputParameterIndex);
     }
     MethodParameterPair.SetInputParameter(method.OutputParameters, method.InputParameters);
 }