Exemple #1
0
        private JObject New(string name, JArray arr)
        {
            Type @class = memory.GetClassByName(name);

            object[]        args = serializer.Serialize(arr);
            Type[]          cons = serializer.TypesOf(args);
            ConstructorInfo c    = memory.Constructor(@class, cons);
            var             obj  = c.Invoke(args);
            int             id   = memory.AddRef(obj);

            return(QueryMaker.Return(name, id));
        }
Exemple #2
0
        /*
         * public JArray Deserialize(object[] objs)
         * {
         *
         * }
         */

        public JObject MethodReturn(Type x, object ret)
        {
            if (ret == null)
            {
                return(null);
            }
            if (Array.IndexOf(new Type[] { typeof(int), typeof(float), typeof(string), typeof(bool),
                                           typeof(int[]), typeof(float[]), typeof(string[]), typeof(bool[]) }, x) >= 0)
            {
                return(QueryMaker.Return(ret));
            }
            else
            {
                if (Array.IndexOf(memory.SharedClasses, x) > 0)
                {
                    return(QueryMaker.Return(memory.SharedClassInfo(Array.IndexOf(memory.SharedClasses, x)).Name,
                                             Array.IndexOf(memory.SharedClasses, x)));
                }
                else
                {
                    throw new Exception("That type is not shared");
                }
            }
        }