public static void SerializeDelta(Stream stream, EggHunt.EggHunter instance, EggHunt.EggHunter previous) { MemoryStream memoryStream = Pool.Get <MemoryStream>(); if (instance.displayName != null && instance.displayName != previous.displayName) { stream.WriteByte(10); ProtocolParser.WriteString(stream, instance.displayName); } if (instance.numEggs != previous.numEggs) { stream.WriteByte(16); ProtocolParser.WriteUInt64(stream, (ulong)instance.numEggs); } Pool.FreeMemoryStream(ref memoryStream); }
public static EggHunt.EggHunter DeserializeLengthDelimited(Stream stream, EggHunt.EggHunter instance, bool isDelta) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num == 10) { instance.displayName = ProtocolParser.ReadString(stream); } else if (num == 16) { instance.numEggs = (int)ProtocolParser.ReadUInt64(stream); } 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 EggHunt.EggHunter DeserializeLengthDelimited(Stream stream) { EggHunt.EggHunter eggHunter = Pool.Get <EggHunt.EggHunter>(); EggHunt.EggHunter.DeserializeLengthDelimited(stream, eggHunter, false); return(eggHunter); }
public static EggHunt.EggHunter DeserializeLength(Stream stream, int length) { EggHunt.EggHunter eggHunter = Pool.Get <EggHunt.EggHunter>(); EggHunt.EggHunter.DeserializeLength(stream, length, eggHunter, false); return(eggHunter); }
public void CopyTo(EggHunt.EggHunter instance) { instance.displayName = this.displayName; instance.numEggs = this.numEggs; }
public EggHunt.EggHunter Copy() { EggHunt.EggHunter eggHunter = Pool.Get <EggHunt.EggHunter>(); this.CopyTo(eggHunter); return(eggHunter); }