static StackObject *ReadTag_16(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, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Google.Protobuf.CodedInputStream instance_of_this_method = (Google.Protobuf.CodedInputStream) typeof(Google.Protobuf.CodedInputStream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.ReadTag(); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = (int)result_of_this_method; return(__ret + 1); }
static StackObject *ReadInt64_4(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, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); 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); var result_of_this_method = instance_of_this_method.ReadInt64(); __ret->ObjectType = ObjectTypes.Long; *(long *)&__ret->Value = result_of_this_method; return(__ret + 1); }
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); }
static void Main(string[] args) { var m1 = new Winner3Way( new Outcome.Priced(1.85m), new Outcome.PricedWithProb(3.3m, 0.33f), new Outcome.Resulted(OutcomeResult.Canceled)); Console.WriteLine($"Orig: {m1}"); using var outputStream = new MemoryStream(); using var output = new Google.Protobuf.CodedOutputStream(outputStream); m1.FromDomain().WriteTo(output); output.Flush(); var bytes = outputStream.ToArray(); Console.WriteLine($"Protobuf Bytes Length={bytes.Length}, {BitConverter.ToString(bytes)}"); using var inputStream = new MemoryStream(bytes); using var input = new Google.Protobuf.CodedInputStream(inputStream); var protoCopy = new Domain.Protobuf.Winner3Way(); protoCopy.MergeFrom(input); var copy = protoCopy.ToDomain(); Console.WriteLine($"Copy: {copy}"); using var jsonStream = new MemoryStream(); using var jsonWriter = new System.Text.Json.Utf8JsonWriter(jsonStream); m1.WriteJson(jsonWriter); jsonWriter.Flush(); var jsonString = Encoding.UTF8.GetString(jsonStream.ToArray()); Console.WriteLine($"Json {jsonString}"); var jsonDoc = System.Text.Json.JsonDocument.Parse(jsonString); var jsonCopy = Json.ReadWinner3Way(jsonDoc.RootElement); Console.WriteLine($"Json Copy: {jsonCopy}"); ComplexDomainDemo.Run(); }
static StackObject *MergeFieldFrom_3(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.CodedInputStream @input = (Google.Protobuf.CodedInputStream) typeof(Google.Protobuf.CodedInputStream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Google.Protobuf.UnknownFieldSet @unknownFields = (Google.Protobuf.UnknownFieldSet) typeof(Google.Protobuf.UnknownFieldSet).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(@unknownFields, @input); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *AddEntriesFrom_2(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, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Google.Protobuf.FieldCodec <System.Int32> codec = (Google.Protobuf.FieldCodec <System.Int32>) typeof(Google.Protobuf.FieldCodec <System.Int32>).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 input = (Google.Protobuf.CodedInputStream) typeof(Google.Protobuf.CodedInputStream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); Google.Protobuf.Collections.RepeatedField <System.Int32> instance_of_this_method; instance_of_this_method = (Google.Protobuf.Collections.RepeatedField <System.Int32>) typeof(Google.Protobuf.Collections.RepeatedField <System.Int32>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.AddEntriesFrom(input, codec); return(__ret); }
static int _m_SkipLastField(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Google.Protobuf.CodedInputStream gen_to_be_invoked = (Google.Protobuf.CodedInputStream)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.SkipLastField( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static StackObject *AddEntriesFrom_4(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, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Google.Protobuf.FieldCodec <Google.Protobuf.ProtobufIMessageAdaptor.Adaptor> @codec = (Google.Protobuf.FieldCodec <Google.Protobuf.ProtobufIMessageAdaptor.Adaptor>) typeof(Google.Protobuf.FieldCodec <Google.Protobuf.ProtobufIMessageAdaptor.Adaptor>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Google.Protobuf.CodedInputStream @input = (Google.Protobuf.CodedInputStream) typeof(Google.Protobuf.CodedInputStream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); Google.Protobuf.Collections.RepeatedField <Google.Protobuf.ProtobufIMessageAdaptor.Adaptor> instance_of_this_method = (Google.Protobuf.Collections.RepeatedField <Google.Protobuf.ProtobufIMessageAdaptor.Adaptor>) typeof(Google.Protobuf.Collections.RepeatedField <Google.Protobuf.ProtobufIMessageAdaptor.Adaptor>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); instance_of_this_method.AddEntriesFrom(@input, @codec); return(__ret); }
static int _m_CreateCodedInput(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Google.Protobuf.ByteString gen_to_be_invoked = (Google.Protobuf.ByteString)translator.FastGetCSObj(L, 1); { Google.Protobuf.CodedInputStream gen_ret = gen_to_be_invoked.CreateCodedInput( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_ReadLength(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Google.Protobuf.CodedInputStream gen_to_be_invoked = (Google.Protobuf.CodedInputStream)translator.FastGetCSObj(L, 1); { int gen_ret = gen_to_be_invoked.ReadLength( ); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_MergeFrom(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Google.Protobuf.IMessage gen_to_be_invoked = (Google.Protobuf.IMessage)translator.FastGetCSObj(L, 1); { Google.Protobuf.CodedInputStream _input = (Google.Protobuf.CodedInputStream)translator.GetObject(L, 2, typeof(Google.Protobuf.CodedInputStream)); gen_to_be_invoked.MergeFrom(_input); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_CreateWithLimits_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { System.IO.Stream _input = (System.IO.Stream)translator.GetObject(L, 1, typeof(System.IO.Stream)); int _sizeLimit = LuaAPI.xlua_tointeger(L, 2); int _recursionLimit = LuaAPI.xlua_tointeger(L, 3); Google.Protobuf.CodedInputStream gen_ret = Google.Protobuf.CodedInputStream.CreateWithLimits(_input, _sizeLimit, _recursionLimit); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
private void DecodeSnapshot(Google.Protobuf.ByteString data) { Google.Protobuf.CodedInputStream reader = new Google.Protobuf.CodedInputStream(data.ToByteArray()); reader.ReadInt32(); //frame reader.ReadBool(); //marktoend reader.ReadDouble(); //seed int count = reader.ReadInt32(); //champions for (int i = 0; i < count; i++) { int id = reader.ReadInt32(); Team team = this.GetTeam(i); team.DecodeSnapshot(id, reader); } count = reader.ReadInt32(); //champions for (int i = 0; i < count; i++) { ulong rid = reader.ReadUInt64(); Champion champion = this.GetChampion(rid); champion.DecodeSnapshot(rid, false, reader); } }
public void Receiver(string routeKey, Action <CatMessage> action = null, string queueName = "Cat.IM.Chat") { _channel.QueueDeclare(queueName, true, false, false, null); _channel.QueueBind(queueName, ExchangeName, routeKey); EventingBasicConsumer consumer = new EventingBasicConsumer(_channel); consumer.Received += (ch, ea) => { using (Google.Protobuf.CodedInputStream input = new Google.Protobuf.CodedInputStream(ea.Body)) { var message = new CatMessage(); message.MergeFrom(input); action?.Invoke(message); } _channel.BasicAck(ea.DeliveryTag, false); }; _channel.BasicConsume(queueName, false, consumer); }
static int _m_MaybeConsumeTag(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Google.Protobuf.CodedInputStream gen_to_be_invoked = (Google.Protobuf.CodedInputStream)translator.FastGetCSObj(L, 1); { uint _tag = LuaAPI.xlua_touint(L, 2); bool gen_ret = gen_to_be_invoked.MaybeConsumeTag(_tag); LuaAPI.lua_pushboolean(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_ParseFrom(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Google.Protobuf.MessageParser gen_to_be_invoked = (Google.Protobuf.MessageParser)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { byte[] _data = LuaAPI.lua_tobytes(L, 2); Google.Protobuf.IMessage gen_ret = gen_to_be_invoked.ParseFrom(_data); translator.PushAny(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <Google.Protobuf.ByteString>(L, 2)) { Google.Protobuf.ByteString _data = (Google.Protobuf.ByteString)translator.GetObject(L, 2, typeof(Google.Protobuf.ByteString)); Google.Protobuf.IMessage gen_ret = gen_to_be_invoked.ParseFrom(_data); translator.PushAny(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.IO.Stream>(L, 2)) { System.IO.Stream _input = (System.IO.Stream)translator.GetObject(L, 2, typeof(System.IO.Stream)); Google.Protobuf.IMessage gen_ret = gen_to_be_invoked.ParseFrom(_input); translator.PushAny(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <Google.Protobuf.CodedInputStream>(L, 2)) { Google.Protobuf.CodedInputStream _input = (Google.Protobuf.CodedInputStream)translator.GetObject(L, 2, typeof(Google.Protobuf.CodedInputStream)); Google.Protobuf.IMessage gen_ret = gen_to_be_invoked.ParseFrom(_input); 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 Google.Protobuf.MessageParser.ParseFrom!")); }
public void MergeFrom(Google.Protobuf.CodedInputStream input) => throw new NotImplementedException();
public ProtobufSplitter(Stream inputstream) { _CodedInputStream = new Google.Protobuf.CodedInputStream(inputstream, true); _BufferedStream = inputstream as IBuffered; }
public void MergeFrom(Google.Protobuf.CodedInputStream input) { mMergeFrom_0.Invoke(this.instance, input); }