public double UnpackDouble() { byte markerByte = _in.ReadByte(); if (markerByte == FLOAT_64) { return(_in.ReadDouble()); } throw new ArgumentOutOfRangeException(nameof(markerByte), markerByte, $"Expected a double, but got: 0x{markerByte.ToString("X2")}"); }
public double UnpackDouble() { byte markerByte = _in.ReadByte(); if (markerByte == FLOAT_64) { return(_in.ReadDouble()); } throw new ProtocolException( $"Expected a double, but got: 0x{markerByte.ToString("X2")}"); }
void IMessage.ReadFrom(IInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch (tag) { case 9: _fdouble = input.ReadDouble(); break; case 21: _ffloat = input.ReadFloat(); break; case 24: _fint32 = input.ReadInt32(); break; case 32: _fint64 = input.ReadInt64(); break; case 40: _fuint32 = input.ReadUInt32(); break; case 48: _fuint64 = input.ReadUInt64(); break; case 56: _fsint32 = input.ReadSInt32(); break; case 64: _fsint64 = input.ReadSInt64(); break; case 77: _ffixed32 = input.ReadFixed32(); break; case 81: _ffixed64 = input.ReadFixed64(); break; case 93: _fsfixed32 = input.ReadSFixed32(); break; case 97: _fsfixed64 = input.ReadSFixed64(); break; case 104: _fbool = input.ReadBool(); break; case 114: _fstring = input.ReadString(); break; case 122: _fbytes = input.ReadBytes(); break; case 128: _fenum = (SomeEnum)input.ReadEnum(); break; case 138: if (_finner == null) { _finner = new InnerMessage(); } input.ReadMessage(_finner); break; case 146: if (_frep == null) { _frep = new global::System.Collections.Generic.List <InnerMessage>(); } input.ReadRepeated(_frep.Add, _tinyRepeatedTypeTestroot_Classes_InnerMessage, x => _frep.Capacity = _frep.Count + x); break; case 152: if (_frepEnum == null) { _frepEnum = new global::System.Collections.Generic.List <SomeEnum>(); } input.ReadRepeated(_frepEnum.Add, _tinyRepeatedTypeTestroot_Classes_TestEnum, x => _frepEnum.Capacity = _frepEnum.Count + x); break; case 162: if (_frepString == null) { _frepString = new global::System.Collections.Generic.List <string>(); } input.ReadRepeated(_frepString.Add, RepeatedTypes.String, x => _frepString.Capacity = _frepString.Count + x); break; case 173: if (_frepFixed32 == null) { _frepFixed32 = new global::System.Collections.Generic.List <uint>(); } input.ReadRepeated(_frepFixed32.Add, RepeatedTypes.Fixed32, x => _frepFixed32.Capacity = _frepFixed32.Count + x); break; case 176: if (_frepUint32 == null) { _frepUint32 = new global::System.Collections.Generic.List <uint>(); } input.ReadRepeated(_frepUint32.Add, RepeatedTypes.UInt32, x => _frepUint32.Capacity = _frepUint32.Count + x); break; default: input.SkipField(); break; } } }