internal static Config.Location Deserialize(Stream stream, Config.Location instance) { BinaryReader binaryReader = new BinaryReader(stream); while (true) { int num = stream.ReadByte(); switch (num) { case -1: goto label_7; case 9: instance.Lat = binaryReader.ReadDouble(); continue; case 17: instance.Lon = binaryReader.ReadDouble(); continue; default: Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field != 0U) { ProtocolParser.SkipKey(stream, key); continue; } goto label_5; } } label_5: throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); label_7: return(instance); }
internal static Config.Location Deserialize(byte[] buffer) { Config.Location instance = new Config.Location(); using (MemoryStream memoryStream = new MemoryStream(buffer)) Config.Location.Deserialize((Stream)memoryStream, instance); return(instance); }
internal static byte[] SerializeToBytes(Config.Location instance) { using (MemoryStream memoryStream = new MemoryStream()) { Config.Location.Serialize((Stream)memoryStream, instance); return(memoryStream.ToArray()); } }
internal static void Serialize(Stream stream, Config.Location instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); MemoryStream stream1 = ProtocolParser.Stack.Pop(); stream.WriteByte((byte)9); binaryWriter.Write(instance.Lat); stream.WriteByte((byte)17); binaryWriter.Write(instance.Lon); ProtocolParser.Stack.Push(stream1); }
internal static Config.Location DeserializeLength( Stream stream, int length, Config.Location instance) { BinaryReader binaryReader = new BinaryReader(stream); long num1 = stream.Position + (long)length; while (stream.Position < num1) { int num2 = stream.ReadByte(); switch (num2) { case -1: throw new EndOfStreamException(); case 9: instance.Lat = binaryReader.ReadDouble(); continue; case 17: instance.Lon = binaryReader.ReadDouble(); continue; default: Key key = ProtocolParser.ReadKey((byte)num2, stream); if (key.Field == 0U) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); continue; } } if (stream.Position != num1) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
internal static void SerializeLengthDelimited(Stream stream, Config.Location instance) { byte[] bytes = Config.Location.SerializeToBytes(instance); ProtocolParser.WriteUInt32(stream, (uint)bytes.Length); stream.Write(bytes, 0, bytes.Length); }
internal static Config.Location DeserializeLength(Stream stream, int length) { Config.Location instance = new Config.Location(); Config.Location.DeserializeLength(stream, length, instance); return(instance); }
internal static Config.Location DeserializeLengthDelimited(Stream stream) { Config.Location instance = new Config.Location(); Config.Location.DeserializeLengthDelimited(stream, instance); return(instance); }