예제 #1
0
        public static T DeserializeProtoBuf3 <T>(byte[] bytes) where T : Google.Protobuf.IMessage, new()
        {
            if (bytes == null)
            {
                return(default(T));
            }
            Google.Protobuf.CodedInputStream stream = new Google.Protobuf.CodedInputStream(bytes);
            T msg = new T();

            stream.ReadMessage(msg);
            //msg= (T)msg.Descriptor.Parser.ParseFrom(dataBytes);
            return(msg);
        }
        static StackObject *ReadMessage_7(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            Google.Protobuf.IMessage @builder = (Google.Protobuf.IMessage) typeof(Google.Protobuf.IMessage).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            Google.Protobuf.CodedInputStream instance_of_this_method = (Google.Protobuf.CodedInputStream) typeof(Google.Protobuf.CodedInputStream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ReadMessage(@builder);

            return(__ret);
        }
예제 #3
0
        static int _m_ReadMessage(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Google.Protobuf.CodedInputStream gen_to_be_invoked = (Google.Protobuf.CodedInputStream)translator.FastGetCSObj(L, 1);



                {
                    Google.Protobuf.IMessage _builder = (Google.Protobuf.IMessage)translator.GetObject(L, 2, typeof(Google.Protobuf.IMessage));

                    gen_to_be_invoked.ReadMessage(_builder);



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