using System; using System.Collections.Generic; namespace Google.Protobuf { // Token: 0x02000006 RID: 6 public static class FieldCodec { // Token: 0x0600009B RID: 155 RVA: 0x00003C14 File Offset: 0x00001E14 public static FieldCodec ForString(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadString(), delegate(CodedOutputStream output, string value) { output.WriteString(value); }, new Func(CodedOutputStream.ComputeStringSize), tag); } // Token: 0x0600009C RID: 156 RVA: 0x00003C74 File Offset: 0x00001E74 public static FieldCodec ForBytes(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadBytes(), delegate(CodedOutputStream output, ByteString value) { output.WriteBytes(value); }, new Func(CodedOutputStream.ComputeBytesSize), tag); } // Token: 0x0600009D RID: 157 RVA: 0x00003CD4 File Offset: 0x00001ED4 public static FieldCodec ForBool(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadBool(), delegate(CodedOutputStream output, bool value) { output.WriteBool(value); }, new Func(CodedOutputStream.ComputeBoolSize), tag); } // Token: 0x0600009E RID: 158 RVA: 0x00003D34 File Offset: 0x00001F34 public static FieldCodec ForInt32(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadInt32(), delegate(CodedOutputStream output, int value) { output.WriteInt32(value); }, new Func(CodedOutputStream.ComputeInt32Size), tag); } // Token: 0x0600009F RID: 159 RVA: 0x00003D94 File Offset: 0x00001F94 public static FieldCodec ForSInt32(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadSInt32(), delegate(CodedOutputStream output, int value) { output.WriteSInt32(value); }, new Func(CodedOutputStream.ComputeSInt32Size), tag); } // Token: 0x060000A0 RID: 160 RVA: 0x00003DF4 File Offset: 0x00001FF4 public static FieldCodec ForFixed32(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadFixed32(), delegate(CodedOutputStream output, uint value) { output.WriteFixed32(value); }, 4, tag); } // Token: 0x060000A1 RID: 161 RVA: 0x00003E48 File Offset: 0x00002048 public static FieldCodec ForSFixed32(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadSFixed32(), delegate(CodedOutputStream output, int value) { output.WriteSFixed32(value); }, 4, tag); } // Token: 0x060000A2 RID: 162 RVA: 0x00003E9C File Offset: 0x0000209C public static FieldCodec ForUInt32(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadUInt32(), delegate(CodedOutputStream output, uint value) { output.WriteUInt32(value); }, new Func(CodedOutputStream.ComputeUInt32Size), tag); } // Token: 0x060000A3 RID: 163 RVA: 0x00003EFC File Offset: 0x000020FC public static FieldCodec ForInt64(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadInt64(), delegate(CodedOutputStream output, long value) { output.WriteInt64(value); }, new Func(CodedOutputStream.ComputeInt64Size), tag); } // Token: 0x060000A4 RID: 164 RVA: 0x00003F5C File Offset: 0x0000215C public static FieldCodec ForSInt64(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadSInt64(), delegate(CodedOutputStream output, long value) { output.WriteSInt64(value); }, new Func(CodedOutputStream.ComputeSInt64Size), tag); } // Token: 0x060000A5 RID: 165 RVA: 0x00003FBC File Offset: 0x000021BC public static FieldCodec ForFixed64(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadFixed64(), delegate(CodedOutputStream output, ulong value) { output.WriteFixed64(value); }, 8, tag); } // Token: 0x060000A6 RID: 166 RVA: 0x00004010 File Offset: 0x00002210 public static FieldCodec ForSFixed64(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadSFixed64(), delegate(CodedOutputStream output, long value) { output.WriteSFixed64(value); }, 8, tag); } // Token: 0x060000A7 RID: 167 RVA: 0x00004064 File Offset: 0x00002264 public static FieldCodec ForUInt64(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadUInt64(), delegate(CodedOutputStream output, ulong value) { output.WriteUInt64(value); }, new Func(CodedOutputStream.ComputeUInt64Size), tag); } // Token: 0x060000A8 RID: 168 RVA: 0x000040C4 File Offset: 0x000022C4 public static FieldCodec ForFloat(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadFloat(), delegate(CodedOutputStream output, float value) { output.WriteFloat(value); }, new Func(CodedOutputStream.ComputeFloatSize), tag); } // Token: 0x060000A9 RID: 169 RVA: 0x00004124 File Offset: 0x00002324 public static FieldCodec ForDouble(uint tag) { return new FieldCodec((CodedInputStream input) => input.ReadDouble(), delegate(CodedOutputStream output, double value) { output.WriteDouble(value); }, new Func(CodedOutputStream.ComputeDoubleSize), tag); } // Token: 0x060000AA RID: 170 RVA: 0x00004184 File Offset: 0x00002384 public static FieldCodec ForEnum(uint tag, Func toInt32, Func fromInt32) { return new FieldCodec((CodedInputStream input) => fromInt32(input.ReadEnum()), delegate(CodedOutputStream output, T value) { output.WriteEnum(toInt32(value)); }, (T value) => CodedOutputStream.ComputeEnumSize(toInt32(value)), tag); } // Token: 0x060000AB RID: 171 RVA: 0x000041D0 File Offset: 0x000023D0 public static FieldCodec ForMessage(uint tag, MessageParser parser) where T : IMessage { return new FieldCodec(delegate(CodedInputStream input) { T t = parser.CreateTemplate(); input.ReadMessage(t); return t; }, delegate(CodedOutputStream output, T value) { output.WriteMessage(value); }, (T message) => CodedOutputStream.ComputeMessageSize(message), tag); } // Token: 0x060000AC RID: 172 RVA: 0x00004238 File Offset: 0x00002438 public static FieldCodec ForClassWrapper(uint tag) where T : class { FieldCodec nestedCodec = FieldCodec.WrapperCodecs.GetCodec(); return new FieldCodec((CodedInputStream input) => FieldCodec.WrapperCodecs.Read(input, nestedCodec), delegate(CodedOutputStream output, T value) { FieldCodec.WrapperCodecs.Write(output, value, nestedCodec); }, (T value) => FieldCodec.WrapperCodecs.CalculateSize(value, nestedCodec), tag, default(T)); } // Token: 0x060000AD RID: 173 RVA: 0x0000428C File Offset: 0x0000248C public static FieldCodec ForStructWrapper(uint tag) where T : struct { FieldCodec nestedCodec = FieldCodec.WrapperCodecs.GetCodec(); return new FieldCodec((CodedInputStream input) => new T?(FieldCodec.WrapperCodecs.Read(input, nestedCodec)), delegate(CodedOutputStream output, T? value) { FieldCodec.WrapperCodecs.Write(output, value.Value, nestedCodec); }, delegate(T? value) { if (value != null) { return FieldCodec.WrapperCodecs.CalculateSize(value.Value, nestedCodec); } return 0; }, tag, null); } // Token: 0x02000075 RID: 117 private static class WrapperCodecs { // Token: 0x06000672 RID: 1650 RVA: 0x00016278 File Offset: 0x00014478 internal static FieldCodec GetCodec() { object obj; if (!FieldCodec.WrapperCodecs.Codecs.TryGetValue(typeof(T), out obj)) { throw new InvalidOperationException("Invalid type argument requested for wrapper codec: " + typeof(T)); } return (FieldCodec)obj; } // Token: 0x06000673 RID: 1651 RVA: 0x000162C0 File Offset: 0x000144C0 internal static T Read(CodedInputStream input, FieldCodec codec) { int num = input.ReadLength(); int num2 = input.PushLimit(num); T t = codec.DefaultValue; uint num3; while ((num3 = input.ReadTag()) != 0U) { if (num3 == codec.Tag) { t = codec.Read(input); } else { input.SkipLastField(); } } input.CheckReadEndOfStreamTag(); input.PopLimit(num2); return t; } // Token: 0x06000674 RID: 1652 RVA: 0x00016316 File Offset: 0x00014516 internal static void Write(CodedOutputStream output, T value, FieldCodec codec) { output.WriteLength(codec.CalculateSizeWithTag(value)); codec.WriteTagAndValue(output, value); } // Token: 0x06000675 RID: 1653 RVA: 0x00016330 File Offset: 0x00014530 internal static int CalculateSize(T value, FieldCodec codec) { int num = codec.CalculateSizeWithTag(value); return CodedOutputStream.ComputeLengthSize(num) + num; } // Token: 0x0400026E RID: 622 private static readonly Dictionary Codecs = new Dictionary { { typeof(bool), FieldCodec.ForBool(WireFormat.MakeTag(1, WireFormat.WireType.Varint)) }, { typeof(int), FieldCodec.ForInt32(WireFormat.MakeTag(1, WireFormat.WireType.Varint)) }, { typeof(long), FieldCodec.ForInt64(WireFormat.MakeTag(1, WireFormat.WireType.Varint)) }, { typeof(uint), FieldCodec.ForUInt32(WireFormat.MakeTag(1, WireFormat.WireType.Varint)) }, { typeof(ulong), FieldCodec.ForUInt64(WireFormat.MakeTag(1, WireFormat.WireType.Varint)) }, { typeof(float), FieldCodec.ForFloat(WireFormat.MakeTag(1, WireFormat.WireType.Fixed32)) }, { typeof(double), FieldCodec.ForDouble(WireFormat.MakeTag(1, WireFormat.WireType.Fixed64)) }, { typeof(string), FieldCodec.ForString(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited)) }, { typeof(ByteString), FieldCodec.ForBytes(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited)) } }; } } }