Beispiel #1
0
        private static object[] ParceParams(MethodBase method, IntPtr arguments, int size, out bool isSuccess)
        {
            var spec   = method.GetParameters();
            var Params = spec.Length == 0 ? null : new object[spec.Length];

            if (Params != null)
            {
                var buff = new byte[size];
                Marshal.Copy(arguments, buff, 0, size);

                using (var br = new BinaryReader(new MemoryStream(buff)))
                {
                    try
                    {
                        for (var i = 0; i < spec.Length; i++)
                        {
                            Params[i] = PropertyConvert.ParceObjectFromByteStream(spec[i].ParameterType, br);
                        }
                    }
                    catch (EndOfStreamException)
                    {
                        isSuccess = false;
                        return(null);
                    }
                }
            }

            isSuccess = true;
            return(Params);
        }