public override object Read(object value, ProtoReader source) { Helpers.DebugAssert(fieldNumber == source.FieldNumber); if (strict) { source.Assert(wireType); } else if (NeedsHint) { source.Hint(wireType); } return Tail.Read(value, source); }
// Token: 0x0600027E RID: 638 RVA: 0x000038AE File Offset: 0x00001AAE public override object Read(object value, ProtoReader source) { if (this.strict) { source.Assert(this.wireType); } else if (this.NeedsHint) { source.Hint(this.wireType); } return(this.Tail.Read(value, source)); }
public override object Read(object value, ProtoReader source) { Helpers.DebugAssert(fieldNumber == source.FieldNumber); if (strict) { source.Assert(wireType); } else if (NeedsHint) { source.Hint(wireType); } return(Tail.Read(value, source)); }
public override object Read(ProtoReader source, ref ProtoReader.State state, object value) { Helpers.DebugAssert(fieldNumber == source.FieldNumber); if (strict) { source.Assert(ref state, wireType); } else if (NeedsHint) { source.Hint(wireType); } return(Tail.Read(source, ref state, value)); }
public override object Read(object value, ProtoReader source) { // ReadFieldHeader called outside // so wireType is read already too! if (_strict) { source.Assert(_wireType); } else if (NeedsHint) { source.Hint(_wireType); } return(Tail.Read(value, source)); }
public override object Read(object value, ProtoReader source) { if (this.strict) { source.Assert(this.wireType); } else if (this.NeedsHint) { source.Hint(this.wireType); } return this.Tail.Read(value, source); }
private static long ReadTimeSpanTicks(ProtoReader source, out DateTimeKind kind) { kind = DateTimeKind.Unspecified; switch (source.WireType) { case WireType.String: case WireType.StartGroup: SubItemToken token = ProtoReader.StartSubItem(source); int fieldNumber; TimeSpanScale scale = TimeSpanScale.Days; long value = 0; while ((fieldNumber = source.ReadFieldHeader()) > 0) { switch (fieldNumber) { case FieldTimeSpanScale: scale = (TimeSpanScale)source.ReadInt32(); break; case FieldTimeSpanValue: source.Assert(WireType.SignedVariant); value = source.ReadInt64(); break; case FieldTimeSpanKind: kind = (DateTimeKind)source.ReadInt32(); switch (kind) { case DateTimeKind.Unspecified: case DateTimeKind.Utc: case DateTimeKind.Local: break; // fine default: throw new ProtoException("Invalid date/time kind: " + kind.ToString()); } break; default: source.SkipField(); break; } } ProtoReader.EndSubItem(token, source); switch (scale) { case TimeSpanScale.Days: return(value * TimeSpan.TicksPerDay); case TimeSpanScale.Hours: return(value * TimeSpan.TicksPerHour); case TimeSpanScale.Minutes: return(value * TimeSpan.TicksPerMinute); case TimeSpanScale.Seconds: return(value * TimeSpan.TicksPerSecond); case TimeSpanScale.Milliseconds: return(value * TimeSpan.TicksPerMillisecond); case TimeSpanScale.Ticks: return(value); case TimeSpanScale.MinMax: switch (value) { case 1: return(long.MaxValue); case -1: return(long.MinValue); default: throw new ProtoException("Unknown min/max value: " + value.ToString()); } default: throw new ProtoException("Unknown timescale: " + scale.ToString()); } case WireType.Fixed64: return(source.ReadInt64()); default: throw new ProtoException("Unexpected wire-type: " + source.WireType.ToString()); } }