protected override void AppendMessageHeaderCore(
			ILGenerator generator, ForEachLoop loop, MessageField field)
		{
			LocalBuilder length = generator.DeclareLocal(typeof(int));
			loop.Create(body => {
				body.Emit(OpCodes.Ldarg_1);
				loop.LoadCurrentAs(FieldType);
				field.AppendFieldLength(generator);
				body.Emit(OpCodes.Ldloc, length.LocalIndex);
				body.Emit(OpCodes.Add);
				body.Emit(OpCodes.Stloc, length.LocalIndex);
			});

			generator.Emit(OpCodes.Ldloc, length.LocalIndex);
			Label done = generator.DefineLabel();
			generator.Emit(OpCodes.Brfalse, done);

			generator.Emit(OpCodes.Ldarg_1);
			generator.Emit(OpCodes.Ldc_I4, MessageTag.AsInt(field.Number, WireType.String));
			generator.Call<MessageWriter>("WriteVarint", typeof(uint));
			generator.Emit(OpCodes.Ldloc, length.LocalIndex);
			generator.Call<MessageWriter>("WriteVarint", typeof(uint)).Pop();
			generator.MarkLabel(done);
		}
Example #2
0
 public override void AppendWriteField(ILGenerator il)
 {
     il.Call<MessageWriter>("WriteBytes", typeof(byte[]));
 }
 public override void AppendWriteField(ILGenerator il)
 {
     il.Call<MessageWriter>("WriteZigZag", FieldType);
 }
		public override void AppendWriteField(ILGenerator generator)
		{
			generator.Call<MessageWriter>("WriteZigZag", typeof(int));
		}
		public override void AppendReadField(ILGenerator generator)
		{
			generator.Call<MessageReader>("ReadZigZag32");
		}
 public override void AppendWriteField(ILGenerator il)
 {
     il.Emit(OpCodes.Conv_I4);
     il.Call<MessageWriter>("WriteZigZag", typeof(int));
 }
Example #7
0
 public override void AppendWriteField(ILGenerator il)
 {
     il.Call<MessageWriter>("WriteVarint", typeof(int));
 }
		public override void AppendWriteField(ILGenerator generator)
		{
			generator.Call<MessageWriter>("WriteFixed", FieldType);
		}
		public override void AppendReadField(ILGenerator generator)
		{
			generator.Call<MessageReader>("ReadFixed" + FieldType.Name);
		}
Example #10
0
 public void SaveFromWillLoad(ILGenerator ilGenerator, Action<ILGenerator> pushWriter, Action<ILGenerator> pushValue)
 {
     pushWriter(ilGenerator);
     pushValue(ilGenerator);
     ilGenerator.Call(_saver);
 }
Example #11
0
 public void SkipLoad(ILGenerator ilGenerator, Action<ILGenerator> pushReader)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(_skipper);
 }
Example #12
0
 public void LoadToWillLoad(ILGenerator ilGenerator, Action<ILGenerator> pushReader)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(_loader);
 }
Example #13
0
 public bool LoadToSameHandler(ILGenerator ilGenerator, Action<ILGenerator> pushReader, Action<ILGenerator> pushThis, Type implType, string destFieldName)
 {
     pushThis(ilGenerator);
     pushReader(ilGenerator);
     ilGenerator.Call(() => ((AbstractBufferedReader)null).ReadVUInt64());
     var fieldInfo = implType.GetField("_FieldStorage_" + destFieldName);
     ilGenerator.Stfld(fieldInfo);
     return true;
 }
Example #14
0
 public void SkipLoad(ILGenerator ilGenerator, Action<ILGenerator> pushReader)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(() => ((AbstractBufferedReader)null).SkipVUInt64());
 }
Example #15
0
 public override void AppendReadField(ILGenerator il)
 {
     il.Call<MessageReader>("ReadString");
 }
Example #16
0
 public override void AppendReadField(ILGenerator il)
 {
     il.Emit(OpCodes.Ldtoken, FieldType);
     il.Emit(OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"));
     il.Call<MessageReader>("ReadEnum", typeof(Type));
 }
Example #17
0
 public override void AppendWriteField(ILGenerator il)
 {
     il.Call<MessageWriter>("WriteString", typeof(string));
 }
		public override void AppendWriteField(ILGenerator generator)
		{
			generator.Emit(OpCodes.Conv_I4);
			generator.Call<MessageWriter>("WriteVarint", typeof(int));
		}