public void MergeFrom(CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { KeyData = input.ReadBytes(); break; } case 16: { RollingStartIntervalNumber = input.ReadUInt32(); break; } case 24: { RollingPeriod = input.ReadUInt32(); break; } case 32: { TransmissionRiskLevel = input.ReadInt32(); break; } case 42: { visitedCountries_.AddEntriesFrom(input, _repeated_visitedCountries_codec); break; } case 50: { Origin = input.ReadString(); break; } case 56: { ReportType = (global::Iks.Protobuf.EfgsReportType) input.ReadEnum(); break; } case 64: { DaysSinceOnsetOfSymptoms = input.ReadSInt32(); break; } } } #endif }
public void AddEntriesFrom(CodedInputStream input, FieldCodec <T> codec) { _internal.AddEntriesFrom(input, codec); if (_isMessageType) { for (int i = 0; i < _internal.Count; i++) { SetParent(i, _internal[i]); } } }
public void MergeFrom(CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch (tag) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { keys_.AddEntriesFrom(input, _repeated_keys_codec); break; } } } #endif }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10u: { int?num2 = _single_id_codec.Read(input); if (!id_.HasValue || num2 != 0) { Id = num2; } break; } case 18u: Name = input.ReadString(); break; case 24u: God = input.ReadInt32(); break; case 32u: Weapon = input.ReadInt32(); break; case 40u: case 42u: companions_.AddEntriesFrom(input, _repeated_companions_codec); break; case 48u: case 50u: spells_.AddEntriesFrom(input, _repeated_spells_codec); break; case 56u: case 58u: summonings_.AddEntriesFrom(input, _repeated_summonings_codec); break; } } }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { if (num != 10) { _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); } else { playerStats_.AddEntriesFrom(input, _repeated_playerStats_codec); } } }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0u) { uint num2 = num; if (num2 != 10u) { input.SkipLastField(); } else { items_.AddEntriesFrom(input, _repeated_items_codec); } } }
public void MergeFrom(CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch (tag) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { signatures_.AddEntriesFrom(input, _repeated_signatures_codec); break; } } } }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: FightDefId = input.ReadInt32(); break; case 16u: FightMapId = input.ReadInt32(); break; case 24u: FightType = input.ReadInt32(); break; case 32u: ConcurrentFightsCount = input.ReadInt32(); break; case 40u: OwnFightId = input.ReadInt32(); break; case 48u: OwnTeamIndex = input.ReadInt32(); break; case 58u: teams_.AddEntriesFrom(input, _repeated_teams_codec); break; } } }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: FightId = input.ReadInt32(); break; case 18u: events_.AddEntriesFrom(input, _repeated_events_codec); break; } } }
public void AddEntriesFrom_Message() { var message1 = new ForeignMessage { C = 2000 }; var message2 = new ForeignMessage { C = -250 }; uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); var stream = new MemoryStream(); var output = new CodedOutputStream(stream); output.WriteTag(tag); output.WriteMessage(message1); output.WriteTag(tag); output.WriteMessage(message2); output.Flush(); stream.Position = 0; var field = new RepeatedField<ForeignMessage>(); var input = new CodedInputStream(stream); input.AssertNextTag(tag); field.AddEntriesFrom(input, FieldCodec.ForMessage(tag, ForeignMessage.Parser)); CollectionAssert.AreEqual(new[] { message1, message2}, field); Assert.IsTrue(input.IsAtEnd); }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: GroupRemoved = input.ReadBool(); break; case 18u: members_.AddEntriesFrom(input, _repeated_members_codec); break; } } }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: FightId = input.ReadInt32(); break; case 18u: entities_.AddEntriesFrom(input, _repeated_entities_codec); break; case 24u: TurnIndex = input.ReadInt32(); break; case 32u: TurnRemainingTimeSec = input.ReadInt32(); break; case 42u: playersCompanions_.AddEntriesFrom(input, _map_playersCompanions_codec); break; case 50u: playersCardsCount_.AddEntriesFrom(input, _map_playersCardsCount_codec); break; } } }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: case 10u: allDefIds_.AddEntriesFrom(input, _repeated_allDefIds_codec); break; case 16u: case 18u: availableIds_.AddEntriesFrom(input, _repeated_availableIds_codec); break; } } }
public void MergeFrom(ref ParseContext ctx) { field.AddEntriesFrom(ref ctx, codec); }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: EntityId = input.ReadInt32(); break; case 16u: EntityType = input.ReadInt32(); break; case 26u: { string text2 = _single_name_codec.Read(input); if (name_ == null || text2 != "") { Name = text2; } break; } case 34u: { int?num6 = _single_defId_codec.Read(input); if (!defId_.HasValue || num6 != 0) { DefId = num6; } break; } case 42u: { int?num5 = _single_weaponId_codec.Read(input); if (!weaponId_.HasValue || num5 != 0) { WeaponId = num5; } break; } case 50u: { int?num9 = _single_genderId_codec.Read(input); if (!genderId_.HasValue || num9 != 0) { GenderId = num9; } break; } case 58u: { int?num7 = _single_playerIndexInFight_codec.Read(input); if (!playerIndexInFight_.HasValue || num7 != 0) { PlayerIndexInFight = num7; } break; } case 66u: { int?num3 = _single_ownerId_codec.Read(input); if (!ownerId_.HasValue || num3 != 0) { OwnerId = num3; } break; } case 74u: { int?num2 = _single_teamId_codec.Read(input); if (!teamId_.HasValue || num2 != 0) { TeamId = num2; } break; } case 82u: { int?num8 = _single_level_codec.Read(input); if (!level_.HasValue || num8 != 0) { Level = num8; } break; } case 88u: case 90u: properties_.AddEntriesFrom(input, _repeated_properties_codec); break; case 98u: if (position_ == null) { position_ = new CellCoord(); } input.ReadMessage(position_); break; case 106u: { int?num4 = _single_direction_codec.Read(input); if (!direction_.HasValue || num4 != 0) { Direction = num4; } break; } case 114u: caracs_.AddEntriesFrom(input, _map_caracs_codec); break; case 122u: { string text = _single_customSkin_codec.Read(input); if (customSkin_ == null || text != "") { CustomSkin = text; } break; } case 130u: { bool?flag = _single_actionDoneThisTurn_codec.Read(input); if (!actionDoneThisTurn_.HasValue || flag != false) { ActionDoneThisTurn = flag; } break; } } } }
public void TestNegativeEnumPackedArray() { int arraySize = 1 + (10 * 5); int msgSize = 1 + 1 + arraySize; byte[] bytes = new byte[msgSize]; CodedOutputStream output = new CodedOutputStream(bytes); // Length-delimited to show we want the packed representation uint tag = WireFormat.MakeTag(8, WireFormat.WireType.LengthDelimited); output.WriteTag(tag); int size = 0; for (int i = 0; i >= -5; i--) { size += CodedOutputStream.ComputeEnumSize(i); } output.WriteRawVarint32((uint)size); for (int i = 0; i >= -5; i--) { output.WriteEnum(i); } Assert.AreEqual(0, output.SpaceLeft); CodedInputStream input = new CodedInputStream(bytes); tag = input.ReadTag(); RepeatedField<SampleEnum> values = new RepeatedField<SampleEnum>(); values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x)); Assert.AreEqual(6, values.Count); Assert.AreEqual(SampleEnum.None, values[0]); Assert.AreEqual(((SampleEnum)(-1)), values[1]); Assert.AreEqual(SampleEnum.NegativeValue, values[2]); Assert.AreEqual(((SampleEnum)(-3)), values[3]); Assert.AreEqual(((SampleEnum)(-4)), values[4]); Assert.AreEqual(((SampleEnum)(-5)), values[5]); }
public void TestNegativeEnumArray() { int arraySize = 1 + 1 + (11 * 5); int msgSize = arraySize; byte[] bytes = new byte[msgSize]; CodedOutputStream output = new CodedOutputStream(bytes); uint tag = WireFormat.MakeTag(8, WireFormat.WireType.Varint); for (int i = 0; i >= -5; i--) { output.WriteTag(tag); output.WriteEnum(i); } Assert.AreEqual(0, output.SpaceLeft); CodedInputStream input = new CodedInputStream(bytes); tag = input.ReadTag(); RepeatedField<SampleEnum> values = new RepeatedField<SampleEnum>(); values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x)); Assert.AreEqual(6, values.Count); Assert.AreEqual(SampleEnum.None, values[0]); Assert.AreEqual(((SampleEnum)(-1)), values[1]); Assert.AreEqual(SampleEnum.NegativeValue, values[2]); Assert.AreEqual(((SampleEnum)(-3)), values[3]); Assert.AreEqual(((SampleEnum)(-4)), values[4]); Assert.AreEqual(((SampleEnum)(-5)), values[5]); }
public void AddEntriesFrom_String() { uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); var stream = new MemoryStream(); var output = new CodedOutputStream(stream); output.WriteTag(tag); output.WriteString("Foo"); output.WriteTag(tag); output.WriteString(""); output.WriteTag(tag); output.WriteString("Bar"); output.Flush(); stream.Position = 0; var field = new RepeatedField<string>(); var input = new CodedInputStream(stream); input.AssertNextTag(tag); field.AddEntriesFrom(input, FieldCodec.ForString(tag)); CollectionAssert.AreEqual(new[] { "Foo", "", "Bar" }, field); Assert.IsTrue(input.IsAtEnd); }
public void AddEntriesFrom_NonPackedInt32() { uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.Varint); var stream = new MemoryStream(); var output = new CodedOutputStream(stream); output.WriteTag(nonPackedTag); output.WriteInt32(10); output.WriteTag(nonPackedTag); output.WriteInt32(999); output.WriteTag(nonPackedTag); output.WriteInt32(-1000); // Just for variety... output.Flush(); stream.Position = 0; // Deliberately "expecting" a packed tag, but we detect that the data is // actually not packed. uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); var field = new RepeatedField<int>(); var input = new CodedInputStream(stream); input.AssertNextTag(nonPackedTag); field.AddEntriesFrom(input, FieldCodec.ForInt32(packedTag)); CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field); Assert.IsTrue(input.IsAtEnd); }
public void MergeFrom(CodedInputStream input) { field.AddEntriesFrom(input, codec); }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: eventType_ = (Types.EventType)input.ReadEnum(); break; case 16u: EventId = input.ReadSInt32(); break; case 26u: { int?num6 = _single_parentEventId_codec.Read(input); if (!parentEventId_.HasValue || num6 != 0) { ParentEventId = num6; } break; } case 32u: Int1 = input.ReadInt32(); break; case 40u: Int2 = input.ReadInt32(); break; case 48u: Int3 = input.ReadInt32(); break; case 56u: Int4 = input.ReadInt32(); break; case 64u: Int5 = input.ReadInt32(); break; case 72u: Int6 = input.ReadInt32(); break; case 80u: Int7 = input.ReadInt32(); break; case 90u: String1 = input.ReadString(); break; case 96u: Bool1 = input.ReadBool(); break; case 106u: if (cellCoord1_ == null) { cellCoord1_ = new CellCoord(); } input.ReadMessage(cellCoord1_); break; case 114u: if (cellCoord2_ == null) { cellCoord2_ = new CellCoord(); } input.ReadMessage(cellCoord2_); break; case 120u: companionReserveState1_ = (CompanionReserveState)input.ReadEnum(); break; case 128u: companionReserveState2_ = (CompanionReserveState)input.ReadEnum(); break; case 136u: damageReductionType1_ = (DamageReductionType)input.ReadEnum(); break; case 144u: fightResult1_ = (FightResult)input.ReadEnum(); break; case 154u: if (gameStatistics1_ == null) { gameStatistics1_ = new GameStatistics(); } input.ReadMessage(gameStatistics1_); break; case 160u: teamsScoreModificationReason1_ = (TeamsScoreModificationReason)input.ReadEnum(); break; case 170u: { int?num5 = _single_optInt1_codec.Read(input); if (!optInt1_.HasValue || num5 != 0) { OptInt1 = num5; } break; } case 178u: { int?num4 = _single_optInt2_codec.Read(input); if (!optInt2_.HasValue || num4 != 0) { OptInt2 = num4; } break; } case 186u: { int?num3 = _single_optInt3_codec.Read(input); if (!optInt3_.HasValue || num3 != 0) { OptInt3 = num3; } break; } case 194u: { int?num2 = _single_optInt4_codec.Read(input); if (!optInt4_.HasValue || num2 != 0) { OptInt4 = num2; } break; } case 202u: cellCoordList1_.AddEntriesFrom(input, _repeated_cellCoordList1_codec); break; case 210u: spellMovementList1_.AddEntriesFrom(input, _repeated_spellMovementList1_codec); break; case 218u: castTargetList1_.AddEntriesFrom(input, _repeated_castTargetList1_codec); break; case 224u: case 226u: intList1_.AddEntriesFrom(input, _repeated_intList1_codec); break; case 232u: case 234u: intList2_.AddEntriesFrom(input, _repeated_intList2_codec); break; } } }