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);
        }
Beispiel #2
0
        public static string GetMetadata()
        {
            try
            {
                var classes = _gameLogicAssembly.GetTypes();
                var asmName = _gameLogicAssembly.GetName().Name;

                return(JsonConvert.SerializeObject(
                           new
                {
                    Types = classes.Select(t => new
                    {
                        Name = t.FullName.Substring(asmName.Length + 1),
                        Base = t.BaseType.Name,
                        IsManage = t.GetCustomAttribute <ManageTypeAttribute>() != null,
                        ManageClassName = t.GetCustomAttribute <ManageTypeAttribute>()?.CppTypeName ?? "",
                        Propertys = t.GetProperties().Where(PropertyConvert.FilterPropertyForEditor).Select(p => new
                        {
                            Name = p.Name,
                            Type = p.PropertyType.FullName,
                            CanEdit = PropertyConvert.CanEditPropertyInEditor(p),
                            Default = p.GetDefaultValue <object>()?.ToString() ?? ""
                        })
                    })
                }));
            }
            catch (Exception e)
            {
                Ue.LogError($"Exception:{e}\n{e.StackTrace}");
                return("");
            }
        }
Beispiel #3
0
        public static string GetMetadata()
        {
            try
            {
                var classes = _gameLogicAssembly.GetTypes().Where(t => t.IsSubclassOf(typeof(UObject)));

                return(JsonConvert.SerializeObject(
                           new
                {
                    Types = classes.Select(t => new
                    {
                        Name = t.FullName,
                        Base = t.BaseType.Name,
                        Propertys = t.GetProperties().Where(PropertyConvert.FilterPropertyForEditor).Select(p => new
                        {
                            Name = p.Name,
                            Type = p.PropertyType.FullName,
                            CanEdit = PropertyConvert.CanEditPropertyInEditor(p),
                            Default = p.GetDefaultValue <object>()?.ToString() ?? ""
                        })
                    })
                }));
            }
            catch (Exception e)
            {
                Ue.LogError($"Exception:{e}\n{e.StackTrace}");
                return("");
            }
        }