public HotAirBalloon Copy() { HotAirBalloon hotAirBalloon = Pool.Get <HotAirBalloon>(); this.CopyTo(hotAirBalloon); return(hotAirBalloon); }
public static HotAirBalloon DeserializeLengthDelimited(Stream stream) { HotAirBalloon hotAirBalloon = Pool.Get <HotAirBalloon>(); HotAirBalloon.DeserializeLengthDelimited(stream, hotAirBalloon, false); return(hotAirBalloon); }
public static HotAirBalloon DeserializeLength(Stream stream, int length, HotAirBalloon instance, bool isDelta) { long position = stream.Position + (long)length; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num == 13) { instance.inflationAmount = ProtocolParser.ReadSingle(stream); } else if (num == 18) { Vector3Serialized.DeserializeLengthDelimited(stream, ref instance.velocity, isDelta); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
public static HotAirBalloon Deserialize(byte[] buffer, HotAirBalloon instance, bool isDelta = false) { using (MemoryStream memoryStream = new MemoryStream(buffer)) { HotAirBalloon.Deserialize(memoryStream, instance, isDelta); } return(instance); }
public virtual void WriteToStreamDelta(Stream stream, HotAirBalloon previous) { if (previous == null) { HotAirBalloon.Serialize(stream, this); return; } HotAirBalloon.SerializeDelta(stream, this, previous); }
public static HotAirBalloon Deserialize(byte[] buffer) { HotAirBalloon hotAirBalloon = Pool.Get <HotAirBalloon>(); using (MemoryStream memoryStream = new MemoryStream(buffer)) { HotAirBalloon.Deserialize(memoryStream, hotAirBalloon, false); } return(hotAirBalloon); }
public static byte[] SerializeToBytes(HotAirBalloon instance) { byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { HotAirBalloon.Serialize(memoryStream, instance); array = memoryStream.ToArray(); } return(array); }
public static void ResetToPool(HotAirBalloon instance) { if (!instance.ShouldPool) { return; } instance.inflationAmount = 0f; instance.velocity = new Vector3(); Pool.Free <HotAirBalloon>(ref instance); }
public static void Serialize(Stream stream, HotAirBalloon instance) { MemoryStream memoryStream = Pool.Get <MemoryStream>(); stream.WriteByte(13); ProtocolParser.WriteSingle(stream, instance.inflationAmount); stream.WriteByte(18); memoryStream.SetLength((long)0); Vector3Serialized.Serialize(memoryStream, instance.velocity); uint length = (uint)memoryStream.Length; ProtocolParser.WriteUInt32(stream, length); stream.Write(memoryStream.GetBuffer(), 0, (int)length); Pool.FreeMemoryStream(ref memoryStream); }
public static void SerializeLengthDelimited(Stream stream, HotAirBalloon instance) { byte[] bytes = HotAirBalloon.SerializeToBytes(instance); ProtocolParser.WriteUInt32(stream, (uint)bytes.Length); stream.Write(bytes, 0, (int)bytes.Length); }
public void CopyTo(HotAirBalloon instance) { instance.inflationAmount = this.inflationAmount; instance.velocity = this.velocity; }
public virtual void WriteToStream(Stream stream) { HotAirBalloon.Serialize(stream, this); }
public byte[] ToProtoBytes() { return(HotAirBalloon.SerializeToBytes(this)); }
public void ToProto(Stream stream) { HotAirBalloon.Serialize(stream, this); }
public void FromProto(Stream stream, bool isDelta = false) { HotAirBalloon.Deserialize(stream, this, isDelta); }
public virtual void ReadFromStream(Stream stream, int size, bool isDelta = false) { HotAirBalloon.DeserializeLength(stream, size, this, isDelta); }
public void ResetToPool() { HotAirBalloon.ResetToPool(this); }