Beispiel #1
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    DCET.Model.ProtobufPacker gen_ret = new DCET.Model.ProtobufPacker();
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to DCET.Model.ProtobufPacker constructor!"));
        }
Beispiel #2
0
        static int _m_SerializeTo(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                DCET.Model.ProtobufPacker gen_to_be_invoked = (DCET.Model.ProtobufPacker)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <object>(L, 2))
                {
                    object _obj = translator.GetObject(L, 2, typeof(object));

                    byte[] gen_ret = gen_to_be_invoked.SerializeTo(_obj);
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && translator.Assignable <object>(L, 2) && translator.Assignable <System.IO.MemoryStream>(L, 3))
                {
                    object _obj = translator.GetObject(L, 2, typeof(object));
                    System.IO.MemoryStream _stream = (System.IO.MemoryStream)translator.GetObject(L, 3, typeof(System.IO.MemoryStream));

                    gen_to_be_invoked.SerializeTo(_obj, _stream);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to DCET.Model.ProtobufPacker.SerializeTo!"));
        }
Beispiel #3
0
        static int _m_DeserializeFrom(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                DCET.Model.ProtobufPacker gen_to_be_invoked = (DCET.Model.ProtobufPacker)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 3 && translator.Assignable <System.Type>(L, 2) && translator.Assignable <System.IO.MemoryStream>(L, 3))
                {
                    System.Type            _type   = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
                    System.IO.MemoryStream _stream = (System.IO.MemoryStream)translator.GetObject(L, 3, typeof(System.IO.MemoryStream));

                    object gen_ret = gen_to_be_invoked.DeserializeFrom(_type, _stream);
                    translator.PushAny(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && translator.Assignable <object>(L, 2) && translator.Assignable <System.IO.MemoryStream>(L, 3))
                {
                    object _instance = translator.GetObject(L, 2, typeof(object));
                    System.IO.MemoryStream _stream = (System.IO.MemoryStream)translator.GetObject(L, 3, typeof(System.IO.MemoryStream));

                    object gen_ret = gen_to_be_invoked.DeserializeFrom(_instance, _stream);
                    translator.PushAny(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 5 && translator.Assignable <System.Type>(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    System.Type _type  = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
                    byte[]      _bytes = LuaAPI.lua_tobytes(L, 3);
                    int         _index = LuaAPI.xlua_tointeger(L, 4);
                    int         _count = LuaAPI.xlua_tointeger(L, 5);

                    object gen_ret = gen_to_be_invoked.DeserializeFrom(_type, _bytes, _index, _count);
                    translator.PushAny(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 5 && translator.Assignable <object>(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    object _instance = translator.GetObject(L, 2, typeof(object));
                    byte[] _bytes    = LuaAPI.lua_tobytes(L, 3);
                    int    _index    = LuaAPI.xlua_tointeger(L, 4);
                    int    _count    = LuaAPI.xlua_tointeger(L, 5);

                    object gen_ret = gen_to_be_invoked.DeserializeFrom(_instance, _bytes, _index, _count);
                    translator.PushAny(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to DCET.Model.ProtobufPacker.DeserializeFrom!"));
        }