/// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary> public static global::cs.CSQueryLatestVersionRes Deserialize(Stream stream, global::cs.CSQueryLatestVersionRes instance) { if (instance.patchInfoList == null) { instance.patchInfoList = new List <global::cs.PatchInfo>(); } while (true) { int keyByte = stream.ReadByte(); if (keyByte == -1) { break; } // Optimized reading of known fields with field ID < 16 switch (keyByte) { // Field 1 Varint case 8: instance.RetCode = (int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream); continue; // Field 2 Varint case 16: instance.packageType = (int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream); continue; // Field 3 LengthDelimited case 26: instance.channelUrl = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream); continue; // Field 4 LengthDelimited case 34: // repeated global::cs.PatchInfo patchInfoListElement = instance.GetFreepatchInfoListElement(); instance.patchInfoList.Add(global::cs.PatchInfo.DeserializeLengthDelimited(stream, patchInfoListElement)); continue; } var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream); // Reading field ID > 16 and unknown field ID/wire type combinations switch (key.Field) { case 0: throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); default: global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key); break; } } return(instance); }
/// <summary>get a free element from patchInfoListCacheList</summary> public global::cs.PatchInfo GetFreepatchInfoListElement() { global::cs.PatchInfo ret = null; if (patchInfoListCacheList.Count > 0) { ret = patchInfoListCacheList[0]; patchInfoListCacheList.RemoveAt(0); } else { ret = new global::cs.PatchInfo(); } return(ret); }
/// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary> public static global::cs.PatchInfo Deserialize(Stream stream, global::cs.PatchInfo instance) { while (true) { int keyByte = stream.ReadByte(); if (keyByte == -1) { break; } // Optimized reading of known fields with field ID < 16 switch (keyByte) { // Field 1 LengthDelimited case 10: instance.patchNo = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream); continue; // Field 2 LengthDelimited case 18: instance.patchURL = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream); continue; // Field 3 Varint case 24: instance.patchSIZE = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream); continue; // Field 4 LengthDelimited case 34: instance.patchMD5 = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream); continue; } var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream); // Reading field ID > 16 and unknown field ID/wire type combinations switch (key.Field) { case 0: throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); default: global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key); break; } } return(instance); }
/// <summary>return a free element to patchInfoListCacheList</summary> public void ReturnpatchInfoListElement(global::cs.PatchInfo element) { bool alreadyInList = false; for (int i = 0; i < patchInfoListCacheList.Count; ++i) { if (patchInfoListCacheList[i] == element) { alreadyInList = true; break; } } if (!alreadyInList) { element.Clear(); patchInfoListCacheList.Add(element); } }
/// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary> public static global::cs.PatchInfo Deserialize(byte[] buffer, global::cs.PatchInfo instance) { using (var ms = new MemoryStream(buffer)) Deserialize(ms, instance); return(instance); }