Inheritance: ISerializable, IFieldInfo
        public virtual object HeaderHandler(Header[] h)
        {
            SerializationMonkey uninitializedObject = (SerializationMonkey)FormatterServices.GetUninitializedObject(typeof(SerializationMonkey));

            Header[] destinationArray = null;
            if (((h != null) && (h.Length > 0)) && (h[0].Name == "__methodName"))
            {
                this.methodName = (string)h[0].Value;
                if (h.Length > 1)
                {
                    destinationArray = new Header[h.Length - 1];
                    Array.Copy(h, 1, destinationArray, 0, h.Length - 1);
                }
                else
                {
                    destinationArray = null;
                }
            }
            else
            {
                destinationArray = h;
            }
            this.FillHeaders(destinationArray, true);
            this.ResolveMethod(false);
            uninitializedObject._obj = this;
            if (this.MI != null)
            {
                ArgMapper mapper = new ArgMapper(this.MI, false);
                uninitializedObject.fieldNames = mapper.ArgNames;
                uninitializedObject.fieldTypes = mapper.ArgTypes;
            }
            return(uninitializedObject);
        }
        public virtual object HeaderHandler(Header[] h)
        {
            SerializationMonkey serializationMonkey = (SerializationMonkey)FormatterServices.GetUninitializedObject(typeof(SerializationMonkey));

            Header[] array;
            if (h != null && h.Length != 0 && h[0].Name == "__methodName")
            {
                this.methodName = (string)h[0].Value;
                if (h.Length > 1)
                {
                    array = new Header[h.Length - 1];
                    Array.Copy(h, 1, array, 0, h.Length - 1);
                }
                else
                {
                    array = null;
                }
            }
            else
            {
                array = h;
            }
            this.FillHeaders(array, true);
            this.ResolveMethod(false);
            serializationMonkey._obj = this;
            if (this.MI != null)
            {
                ArgMapper argMapper = new ArgMapper(this.MI, false);
                serializationMonkey.fieldNames = argMapper.ArgNames;
                serializationMonkey.fieldTypes = argMapper.ArgTypes;
            }
            return(serializationMonkey);
        }
Esempio n. 3
0
        public virtual object HeaderHandler(Header[] h)
        {
            SerializationMonkey serializationMonkey = (SerializationMonkey)FormatterServices.GetUninitializedObject(typeof(SerializationMonkey));

            Header[] h1;
            if (h != null && h.Length != 0 && h[0].Name == "__methodName")
            {
                if (h.Length > 1)
                {
                    h1 = new Header[h.Length - 1];
                    Array.Copy((Array)h, 1, (Array)h1, 0, h.Length - 1);
                }
                else
                {
                    h1 = (Header[])null;
                }
            }
            else
            {
                h1 = h;
            }
            Type       type       = (Type)null;
            MethodInfo methodInfo = this.MI as MethodInfo;

            if (methodInfo != (MethodInfo)null)
            {
                type = methodInfo.ReturnType;
            }
            ParameterInfo[] parameters = this._methodCache.Parameters;
            int             length     = this._methodCache.MarshalResponseArgMap.Length;

            if (!(type == (Type)null) && !(type == typeof(void)))
            {
                ++length;
            }
            Type[]   typeArray = new Type[length];
            string[] strArray  = new string[length];
            int      index     = 0;

            if (!(type == (Type)null) && !(type == typeof(void)))
            {
                typeArray[index++] = type;
            }
            foreach (int marshalResponseArg in this._methodCache.MarshalResponseArgMap)
            {
                strArray[index]    = parameters[marshalResponseArg].Name;
                typeArray[index++] = !parameters[marshalResponseArg].ParameterType.IsByRef ? parameters[marshalResponseArg].ParameterType : parameters[marshalResponseArg].ParameterType.GetElementType();
            }
            serializationMonkey.FieldTypes = typeArray;
            serializationMonkey.FieldNames = strArray;
            this.FillHeaders(h1, true);
            serializationMonkey._obj = (ISerializationRootObject)this;
            return((object)serializationMonkey);
        }
Esempio n. 4
0
        public virtual object HeaderHandler(Header[] h)
        {
            SerializationMonkey uninitializedObject = (SerializationMonkey)FormatterServices.GetUninitializedObject(typeof(SerializationMonkey));

            Header[] destinationArray = null;
            if (((h != null) && (h.Length > 0)) && (h[0].Name == "__methodName"))
            {
                if (h.Length > 1)
                {
                    destinationArray = new Header[h.Length - 1];
                    Array.Copy(h, 1, destinationArray, 0, h.Length - 1);
                }
                else
                {
                    destinationArray = null;
                }
            }
            else
            {
                destinationArray = h;
            }
            Type       returnType = null;
            MethodInfo mI         = this.MI as MethodInfo;

            if (mI != null)
            {
                returnType = mI.ReturnType;
            }
            ParameterInfo[] parameters = this._methodCache.Parameters;
            int             length     = this._methodCache.MarshalResponseArgMap.Length;

            if ((returnType != null) && !(returnType == typeof(void)))
            {
                length++;
            }
            Type[]   typeArray = new Type[length];
            string[] strArray  = new string[length];
            int      index     = 0;

            if ((returnType != null) && !(returnType == typeof(void)))
            {
                typeArray[index++] = returnType;
            }
            foreach (int num3 in this._methodCache.MarshalResponseArgMap)
            {
                strArray[index] = parameters[num3].Name;
                if (parameters[num3].ParameterType.IsByRef)
                {
                    typeArray[index++] = parameters[num3].ParameterType.GetElementType();
                }
                else
                {
                    typeArray[index++] = parameters[num3].ParameterType;
                }
            }
            uninitializedObject.FieldTypes = typeArray;
            uninitializedObject.FieldNames = strArray;
            this.FillHeaders(destinationArray, true);
            uninitializedObject._obj = this;
            return(uninitializedObject);
        }
        public virtual object HeaderHandler(Header[] h)
        {
            SerializationMonkey serializationMonkey = (SerializationMonkey)FormatterServices.GetUninitializedObject(typeof(SerializationMonkey));

            Header[] array;
            if (h != null && h.Length != 0 && h[0].Name == "__methodName")
            {
                if (h.Length > 1)
                {
                    array = new Header[h.Length - 1];
                    Array.Copy(h, 1, array, 0, h.Length - 1);
                }
                else
                {
                    array = null;
                }
            }
            else
            {
                array = h;
            }
            Type       type       = null;
            MethodInfo methodInfo = this.MI as MethodInfo;

            if (methodInfo != null)
            {
                type = methodInfo.ReturnType;
            }
            ParameterInfo[] parameters = this._methodCache.Parameters;
            int             num        = this._methodCache.MarshalResponseArgMap.Length;

            if (!(type == null) && !(type == typeof(void)))
            {
                num++;
            }
            Type[]   array2 = new Type[num];
            string[] array3 = new string[num];
            int      num2   = 0;

            if (!(type == null) && !(type == typeof(void)))
            {
                array2[num2++] = type;
            }
            foreach (int num3 in this._methodCache.MarshalResponseArgMap)
            {
                array3[num2] = parameters[num3].Name;
                if (parameters[num3].ParameterType.IsByRef)
                {
                    array2[num2++] = parameters[num3].ParameterType.GetElementType();
                }
                else
                {
                    array2[num2++] = parameters[num3].ParameterType;
                }
            }
            ((IFieldInfo)serializationMonkey).FieldTypes = array2;
            ((IFieldInfo)serializationMonkey).FieldNames = array3;
            this.FillHeaders(array, true);
            serializationMonkey._obj = this;
            return(serializationMonkey);
        }