Beispiel #1
0
        public virtual int GetInMarshallingSize(IRpcMethod method, object[] parameterValues)
        {
            int num = 0;
            RpcMethodParameterCollection parameters = null;
            IList <IDataType>            types      = null;

            this.GetInParameters(method, out parameters, out types);
            for (int i = 0; i < parameters.Count; i++)
            {
                num += this.OnGetParameterSize(i, parameters, parameterValues);
            }
            return(num);
        }
Beispiel #2
0
        public virtual int GetOutMarshallingSize(IRpcMethod method, object[] outValues)
        {
            int num = 0;
            RpcMethodParameterCollection parameters = null;
            IList <IDataType>            types      = null;

            this.GetOutParameters(method, out parameters, out types);
            for (int i = 0; i < parameters.Count; i++)
            {
                num += this.OnGetParameterSize(i, parameters, outValues);
            }
            if (!string.IsNullOrEmpty(method.ReturnType))
            {
                num += this.OnGetMarshallingSize(method.ReturnType);
            }
            return(num);
        }
Beispiel #3
0
        protected virtual int OnMarshalOut(IRpcMethod method, byte[] data, int offset, out object[] values)
        {
            RpcMethodParameterCollection parameters = null;
            IList <IDataType>            types      = null;

            this.GetOutParameters(method, out parameters, out types);
            int num  = 0;
            int num2 = offset;

            values = new object[method.Parameters.Count];
            for (int i = 0; i < parameters.Count; i++)
            {
                num += this.OnUnmarshalParameter(i, parameters, types, data, num2, ref values);
                num2 = offset + num;
            }
            return(num);
        }
Beispiel #4
0
 protected int GetParameters(IRpcMethod method, MethodParamFlags mask, out RpcMethodParameterCollection parameters, out IList <IDataType> types)
 {
     types      = new List <IDataType>();
     parameters = new RpcMethodParameterCollection();
     for (int i = 0; i < method.Parameters.Count; i++)
     {
         if ((method.Parameters[i].ParameterFlags & mask) > ((MethodParamFlags)0))
         {
             IDataType type = null;
             if (!this._resolver.TryResolveType(method.Parameters[i].TypeName, out type))
             {
                 throw new ArgumentOutOfRangeException("parameters");
             }
             types.Add(type);
             parameters.Add(method.Parameters[i]);
         }
     }
     return(types.Count);
 }
Beispiel #5
0
        protected virtual int OnMarshalIn(IRpcMethod method, object[] parameterValues, byte[] buffer, int offset)
        {
            int num = 0;

            if (method.Parameters.Count > 0)
            {
                RpcMethodParameterCollection parameters = null;
                IList <IDataType>            types      = null;
                this.GetInParameters(method, out parameters, out types);
                if (parameters.Count != parameterValues.Length)
                {
                    throw new ArgumentOutOfRangeException("parameterValues");
                }
                for (int i = 0; i < parameters.Count; i++)
                {
                    num += this.OnMarshalParameter(i, parameters, types, parameterValues, buffer, offset + num);
                }
            }
            return(num);
        }
Beispiel #6
0
 protected int GetOutParameters(IRpcMethod method, out RpcMethodParameterCollection parameters, out IList <IDataType> types) =>
 this.GetParameters(method, MethodParamFlags.ByReference | MethodParamFlags.Out, out parameters, out types);
Beispiel #7
0
 protected abstract int OnUnmarshalParameter(int i, RpcMethodParameterCollection outParameters, IList <IDataType> outParameterTypes, byte[] buffer, int offset, ref object[] outValues);
Beispiel #8
0
 protected abstract int OnMarshalParameter(int i, RpcMethodParameterCollection inParameters, IList <IDataType> inParameterTypes, object[] parameterValues, byte[] buffer, int offset);
Beispiel #9
0
 protected virtual int OnGetParameterSize(int parameterIndex, RpcMethodParameterCollection parameters, object[] parameterValues) =>
 parameters[parameterIndex].Size;
 internal ReadOnlyMethodParameterCollection(RpcMethodParameterCollection coll) : base(coll)
 {
 }