public static ArcadeGame DeserializeLength(Stream stream, int length) { ArcadeGame arcadeGame = Pool.Get <ArcadeGame>(); ArcadeGame.DeserializeLength(stream, length, arcadeGame, false); return(arcadeGame); }
public static ArcadeGame DeserializeLength(Stream stream, int length, ArcadeGame instance, bool isDelta) { if (!isDelta && instance.arcadeEnts == null) { instance.arcadeEnts = Pool.Get <List <ArcadeGame.arcadeEnt> >(); } long position = stream.Position + (long)length; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num != 10) { 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); } else { instance.arcadeEnts.Add(ArcadeGame.arcadeEnt.DeserializeLengthDelimited(stream)); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
public ArcadeGame Copy() { ArcadeGame arcadeGame = Pool.Get <ArcadeGame>(); this.CopyTo(arcadeGame); return(arcadeGame); }
public static ArcadeGame Deserialize(Stream stream) { ArcadeGame arcadeGame = Pool.Get <ArcadeGame>(); ArcadeGame.Deserialize(stream, arcadeGame, false); return(arcadeGame); }
public static ArcadeGame Deserialize(Stream stream, ArcadeGame instance, bool isDelta) { if (!isDelta && instance.arcadeEnts == null) { instance.arcadeEnts = Pool.Get <List <ArcadeGame.arcadeEnt> >(); } while (true) { int num = stream.ReadByte(); if (num == -1) { break; } if (num != 10) { 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); } else { instance.arcadeEnts.Add(ArcadeGame.arcadeEnt.DeserializeLengthDelimited(stream)); } } return(instance); }
public static ArcadeGame Deserialize(byte[] buffer, ArcadeGame instance, bool isDelta = false) { using (MemoryStream memoryStream = new MemoryStream(buffer)) { ArcadeGame.Deserialize(memoryStream, instance, isDelta); } return(instance); }
public virtual void WriteToStreamDelta(Stream stream, ArcadeGame previous) { if (previous == null) { ArcadeGame.Serialize(stream, this); return; } ArcadeGame.SerializeDelta(stream, this, previous); }
public static ArcadeGame Deserialize(byte[] buffer) { ArcadeGame arcadeGame = Pool.Get <ArcadeGame>(); using (MemoryStream memoryStream = new MemoryStream(buffer)) { ArcadeGame.Deserialize(memoryStream, arcadeGame, false); } return(arcadeGame); }
public static byte[] SerializeToBytes(ArcadeGame instance) { byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { ArcadeGame.Serialize(memoryStream, instance); array = memoryStream.ToArray(); } return(array); }
public static void SerializeDelta(Stream stream, ArcadeGame instance, ArcadeGame previous) { MemoryStream memoryStream = Pool.Get <MemoryStream>(); if (instance.arcadeEnts != null) { for (int i = 0; i < instance.arcadeEnts.Count; i++) { ArcadeGame.arcadeEnt item = instance.arcadeEnts[i]; stream.WriteByte(10); memoryStream.SetLength((long)0); ArcadeGame.arcadeEnt.SerializeDelta(memoryStream, item, item); uint length = (uint)memoryStream.Length; ProtocolParser.WriteUInt32(stream, length); stream.Write(memoryStream.GetBuffer(), 0, (int)length); } } Pool.FreeMemoryStream(ref memoryStream); }
public static void ResetToPool(ArcadeGame instance) { if (!instance.ShouldPool) { return; } if (instance.arcadeEnts != null) { for (int i = 0; i < instance.arcadeEnts.Count; i++) { if (instance.arcadeEnts[i] != null) { instance.arcadeEnts[i].ResetToPool(); instance.arcadeEnts[i] = null; } } List <ArcadeGame.arcadeEnt> arcadeEnts = instance.arcadeEnts; Pool.FreeList <ArcadeGame.arcadeEnt>(ref arcadeEnts); instance.arcadeEnts = arcadeEnts; } Pool.Free <ArcadeGame>(ref instance); }
public virtual void WriteToStream(Stream stream) { ArcadeGame.Serialize(stream, this); }
public byte[] ToProtoBytes() { return(ArcadeGame.SerializeToBytes(this)); }
public void FromProto(Stream stream, bool isDelta = false) { ArcadeGame.Deserialize(stream, this, isDelta); }
public static void SerializeLengthDelimited(Stream stream, ArcadeGame instance) { byte[] bytes = ArcadeGame.SerializeToBytes(instance); ProtocolParser.WriteUInt32(stream, (uint)bytes.Length); stream.Write(bytes, 0, (int)bytes.Length); }
public void ResetToPool() { ArcadeGame.ResetToPool(this); }
public void CopyTo(ArcadeGame instance) { throw new NotImplementedException(); }
public void ToProto(Stream stream) { ArcadeGame.Serialize(stream, this); }
public virtual void ReadFromStream(Stream stream, int size, bool isDelta = false) { ArcadeGame.DeserializeLength(stream, size, this, isDelta); }