public static TransactionProposal createInvokerProposal(TransRequest request, TransactionHeader transactionHeader) { var args = new RepeatedField <ByteString>(); args.Add(Util.ConvertToByteString(request.Fcn)); foreach (var item in request.Args) { args.Add(Util.ConvertToByteString(item)); } var ccis = new ChaincodeSpec() { Type = ChaincodeSpec.Types.Type.Undefined, ChaincodeId = new ChaincodeID() { Name = request.ChaincodeId }, Input = new ChaincodeInput() { Args = args, } }; var proposal = CreateChaincodeProposalWithTxIDNonceAndTransient(ccis, transactionHeader, request.TransientMap); var tp = new TransactionProposal() { TxnID = transactionHeader.Id, Proposal = proposal }; return(tp); }
private TensorProto GetTensorProto(byte[] byteArray) { ByteString imageData = ByteString.CopyFrom(byteArray); TensorProto tensorProto = new TensorProto(); Dim dimBatch = new Dim() { Name = "batch", Size = 1 }; Dim dimData = new Dim() { Name = "data", Size = 1 }; RepeatedField <Dim> repeatedField = new RepeatedField <Dim>(); repeatedField.Add(dimBatch); repeatedField.Add(dimData); TensorShapeProto tensorShape = new TensorShapeProto(); tensorShape.Dim = repeatedField; tensorProto.TensorShape = tensorShape; tensorProto.Dtype = DataType.DtString; tensorProto.StringVal.Add(imageData); return(tensorProto); }
//录像摸牌 public virtual void Video_MoCard(int card) { ShowWinCard(card); //显示普通赢的牌 _VideoHands.Add(card); _VideoMoCardSize = card; //记录摸的那张牌 出牌的时候要 CardFiveStarSoundMgr.Ins.PlaySound(SexType.None, FiveStarOperateType.MoCard); //摸牌 音效 TurntableTimeMgr.Ins.ShowLightAndResetTime(ClientSeatIndex, FiveStarOverTime.CanPlayCardOverTime); //亮起可出牌操作 }
private void SetNotSupportData(Transform tran, EncourageActRuleVo encouragevo, UserEncourageActVo uservo) { var nametran = tran.Find("SupporterActivityName/Text"); nametran.gameObject.Show(); var name = nametran.GetComponent <Text>(); var timetran = tran.Find("SandGlasss/TimeLabel"); timetran.gameObject.Show(); var timeLabel = timetran.GetComponent <Text>(); name.text = encouragevo.Title; timeLabel.text = I18NManager.Get("SupporterActivity_Time", encouragevo.NeedTime / 60);//"时间:" + + "小时"; var rewardList = tran.Find("RewardList"); var changeBtn = tran.Find("ChangeBtn").GetButton(); var costText = tran.Find("Icon/Num").GetText(); costText.text = lastcost.ToString(); changeBtn.onClick.RemoveAllListeners(); changeBtn.onClick.AddListener(() => { //FlowText.ShowMessage("更换活动协议!"); _curChooseTransform = tran; if (uservo.StartState == 0) { SendMessage(new Message(MessageConst.CMD_SUPPORTERACTIVITY_REFRESH, Message.MessageReciverType.CONTROLLER, uservo)); } }); //可能三种情况:1.只出现粉丝2.只出现钻石。3.只出现道具。 for (int i = 0; i < rewardList.childCount; i++) { rewardList.GetChild(i).gameObject.Hide(); } //刷新的时候就会出现BUG了 RepeatedField <AwardPB> enactaward = new RepeatedField <AwardPB>(); enactaward.Clear(); if (encouragevo.RandomFansNum > 0) { enactaward.Add(new AwardPB() { Num = encouragevo.RandomFansNum, Resource = ResourcePB.Fans, ResourceId = 1 }); } enactaward.Add(encouragevo.Awards); for (int i = 0; i < enactaward.Count; i++) { rewardList.GetChild(i).gameObject.Show(); SetPropData(rewardList.GetChild(i), enactaward[i]); } }
public void NullValuesRejected() { var list = new RepeatedField<string>(); Assert.Throws<ArgumentNullException>(() => list.Add((string)null)); Assert.Throws<ArgumentNullException>(() => list.Add((IEnumerable<string>)null)); Assert.Throws<ArgumentNullException>(() => list.Add((RepeatedField<string>)null)); Assert.Throws<ArgumentNullException>(() => list.Contains(null)); Assert.Throws<ArgumentNullException>(() => list.IndexOf(null)); }
//根据牌的类型得到胡牌类型 public static RepeatedField <int> GetHuPaiTypes(IList <int> cards, IList <int> pengGangs, int winCard, bool isGangHu = false) { RepeatedField <int> huPaiTypes = new RepeatedField <int>(); GetPaiInNum(cards, _HuPaiScorePaiInNum); //判断碰碰胡 if (IsPengPengHu(_HuPaiScorePaiInNum)) { huPaiTypes.Add(CardFiveStarHuPaiType.PengPengHu); } //判断卡五星 if (IsCardFiveStar(cards, winCard)) { huPaiTypes.Add(CardFiveStarHuPaiType.CardFiveStar); } //判断明四归 if (IsMingSiGui(cards, pengGangs)) { huPaiTypes.Add(CardFiveStarHuPaiType.MingSiGui); } //判断暗四归 if (IsAnSiGui(_HuPaiScorePaiInNum)) { huPaiTypes.Add(CardFiveStarHuPaiType.AnSiGui); } //判断清一色 if (IsQingYiSe(cards, _HuPaiScorePaiInNum, pengGangs)) { huPaiTypes.Add(CardFiveStarHuPaiType.QingYiSe); } //判断七对和猛七对 int QiDuiType = IsQiDuiAndMeng(cards, _HuPaiScorePaiInNum); if (QiDuiType != 0) { huPaiTypes.Add(QiDuiType); } //判断大三元和小三元 int SanYuanType = IsSanYuan(_HuPaiScorePaiInNum, pengGangs); if (SanYuanType != 0) { huPaiTypes.Add(SanYuanType); } //判断是不是平胡 if (huPaiTypes.Count <= 0) { huPaiTypes.Add(CardFiveStarHuPaiType.PingHu); } //是不是杠上胡 if (isGangHu) { huPaiTypes.Add(CardFiveStarHuPaiType.GangShangHu); } return(huPaiTypes); }
//如果是匹配模式 并且有AI参与 public static RepeatedField <RepeatedField <int> > AIDealCards(int number) { RepeatedField <RepeatedField <int> > distrbuteCards = new RepeatedField <RepeatedField <int> >(); RepeatedField <int> initCards = new RepeatedField <int>() { mInitCards }; //获取必赢的牌 RepeatedField <int> sureWinCards = new RepeatedField <int>(); for (int i = 0; i < 4; i++) { int shunZiStart = RandomTool.Random(1, 17); while (shunZiStart == 8 || shunZiStart == 9) { shunZiStart = RandomTool.Random(1, 17); } for (int j = 0; j < 3; j++) { sureWinCards.Add(shunZiStart + j); initCards.Remove(shunZiStart + j); } } int jiangNum = RandomTool.Random(1, 22); while (sureWinCards.Contains(jiangNum)) { jiangNum = RandomTool.Random(1, 22); } sureWinCards.Add(jiangNum); sureWinCards.Add(jiangNum); initCards.Remove(jiangNum); initCards.Remove(jiangNum); int winCardIndex = RandomTool.Random(0, sureWinCards.Count); int winCard = sureWinCards[winCardIndex]; sureWinCards.Remove(winCard); sureWinCards.Add(winCard); //将牌打乱获取正常玩家的牌 initCards.RandomBrakRank(); for (int i = 0; i < number; i++) { distrbuteCards.Add(initCards.TakeOutCards(DealCardCount)); } initCards.AddRange(sureWinCards); distrbuteCards.Add(initCards); return(distrbuteCards); }
/// <summary> /// 取得使用者所有道具資料 /// </summary> /// <param name="uid"></param> /// <returns></returns> public static async ETTask <RepeatedField <EquipmentInfo> > GetUserAllEquipmentInfo(long uid) { var list = new RepeatedField <EquipmentInfo>(); var listEq = new List <Equipment>(); var result = await dbProxy.Query <Equipment>(entity => entity.uid == uid); for (int i = 0; i < result.Count; i++) { var equipment = (Equipment)result[i]; if (TryGetEquipmentConfig(equipment.configId, out CharacterConfig config)) { if (config.IsStackEquipment()) { var obj = OtherHelper.Search(listEq, entity => entity.configId == equipment.configId); if (obj != null) { await _MergeEquipment(uid, obj, equipment); continue; } } list.Add(equipment.ToEquipmentInfo()); listEq.Add(equipment); } } return(list); }
private void FlushRecordsToPublish() { if (recordsToPublish.IsEmpty) { return; } RepeatedField <TopicDataRecord> repeatedField = new RepeatedField <TopicDataRecord>(); while (!recordsToPublish.IsEmpty) { if (recordsToPublish.TryTake(out TopicDataRecord record)) { repeatedField.Add(record); } } TopicDataRecordList recordList = new TopicDataRecordList() { Elements = { repeatedField }, }; TopicData topicData = new TopicData() { TopicDataRecordList = recordList }; SendTopicDataImmediately(topicData); }
public void MergeFrom(DeckInfo other) { if (other != null) { if (other.id_.HasValue && (!id_.HasValue || other.Id != 0)) { Id = other.Id; } if (other.Name.Length != 0) { Name = other.Name; } if (other.God != 0) { God = other.God; } if (other.Weapon != 0) { Weapon = other.Weapon; } companions_.Add((IEnumerable <int>)other.companions_); spells_.Add((IEnumerable <int>)other.spells_); summonings_.Add((IEnumerable <int>)other.summonings_); _unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } }
// Topic subscription, called from upper layer (i.e. some MonoBahavior public async Task <ServiceReply> Subscribe(string topic, Action <TopicDataRecord> function) { // Repeated fields cannot be instantiated in SerivceRequest creation RepeatedField <string> subscribeTopics = new RepeatedField <string>(); subscribeTopics.Add(topic); Debug.Log("Subscribing to topic: " + topic + " (backend), subscribeRepeatedField: " + subscribeTopics.Count); ServiceRequest topicSubscription = new ServiceRequest { Topic = DEFAULT_TOPICS.SERVICES.TOPIC_SUBSCRIPTION, TopicSubscription = new TopicSubscription { ClientId = clientSpecification.Id, SubscribeTopics = { subscribeTopics } } }; var task = CallService(topicSubscription); ServiceReply subReply = await task; if (subReply.Error != null) { Debug.LogError("subReply Error! Error msg: " + subReply.Error.ToString()); return(null); } // adding callback function to dictionary netmqTopicDataClient.AddTopicDataCallback(topic, function); return(subReply); }
public async Task <ServiceReply> Unsubscribe(string topic) { // Repeated fields cannot be instantiated in SerivceRequest creation; adding topic to unsubscribeTopics which is later sent to server with clientID RepeatedField <string> unsubscribeTopics = new RepeatedField <string>(); unsubscribeTopics.Add(topic); Debug.Log("Unsubscribe from topic: " + topic + " (backend) + unsubscribeRepeatedField: " + unsubscribeTopics.Count); ServiceRequest topicUnsubscription = new ServiceRequest { Topic = DEFAULT_TOPICS.SERVICES.TOPIC_SUBSCRIPTION, TopicSubscription = new TopicSubscription { ClientId = clientSpecification.Id, UnsubscribeTopics = { unsubscribeTopics } } }; var task = CallService(topicUnsubscription); ServiceReply subReply = await task; if (subReply.Error != null) { Debug.LogError("subReply Error! Error msg: " + subReply.Error.ToString()); return(null); } // removing callback function from dictionary netmqTopicDataClient.RemoveTopicDataCallback(topic); return(subReply); }
/// <summary> /// Convert from <see cref="Dolittle.Runtime.Events.Relativity.TenantOffset"/> to collection of <see cref="TenantOffset"/> /// </summary> /// <param name="offsets"><see cref="Dolittle.Runtime.Events.Relativity.TenantOffset">Offsets</see> to convert from</param> /// <returns>Converted <see cref="TenantOffset">offsets</see></returns> public static RepeatedField <TenantOffset> ToProtobuf(this IEnumerable <Dolittle.Runtime.Events.Relativity.TenantOffset> offsets) { var protobuf = new RepeatedField <TenantOffset>(); protobuf.Add(offsets.Select(_ => _.ToProtobuf())); return(protobuf); }
public static RepeatedField <string> SetRepeated <T>(this RepeatedField <string> x, string[] y) { x.Clear(); for (int i = 0; i < y.Length; i++) { if (y[i] == null) { x.Add(String.Empty); } else { x.Add(y[i]); } } return(x); }
public async Task <long> AddDeck(string userId, Data.Deck deck, long lastModificationTimestamp) { RepeatedField <CardCollection> cards = new RepeatedField <CardCollection>(); for (int i = 0; i < deck.Cards.Count; i++) { CardCollection cardInCollection = new CardCollection { CardName = deck.Cards[i].CardName, Amount = deck.Cards[i].Amount }; Debug.Log("Card in collection = " + cardInCollection.CardName + " , " + cardInCollection.Amount); cards.Add(cardInCollection); } CreateDeckRequest request = new CreateDeckRequest { UserId = userId, Deck = new Deck { Name = deck.Name, HeroId = deck.HeroId, Cards = { cards } }, LastModificationTimestamp = lastModificationTimestamp }; CreateDeckResponse createDeckResponse = await Contract.CallAsync <CreateDeckResponse>(AddDeckMethod, request); return(createDeckResponse.DeckId); }
private static EditDeckRequest EditDeckRequest(string userId, Data.Deck deck, long lastModificationTimestamp) { RepeatedField <CardCollection> cards = new RepeatedField <CardCollection>(); for (int i = 0; i < deck.Cards.Count; i++) { CardCollection cardInCollection = new CardCollection { CardName = deck.Cards[i].CardName, Amount = deck.Cards[i].Amount }; Debug.Log("Card in collection = " + cardInCollection.CardName + " , " + cardInCollection.Amount); cards.Add(cardInCollection); } EditDeckRequest request = new EditDeckRequest { UserId = userId, Deck = new Deck { Id = deck.Id, Name = deck.Name, HeroId = deck.HeroId, Cards = { cards } }, LastModificationTimestamp = lastModificationTimestamp }; return(request); }
public ExportMeshRequestManager(BackendRouter backend, ElementMeshReader meshReader) { _backend = backend; _meshReader = meshReader; const int defaultCapacity = 1000; _elementIdExportQueue = new string[defaultCapacity]; _elementIdExportQueuePosition = 0; _elementIdExportQueueCount = 0; _filteredElementIdBuffer = new string[defaultCapacity]; _filteredElementIdCount = 0; _alreadyRequestedElements = new Dictionary <string, bool>(defaultCapacity); // Fill cached RequestWrapper with dummy entries so we can replace entries by index _cachedRequestWrapper = new RequestWrapper { ExportMeshesRequest = new ExportMeshesRequest { ChordTol = ChordTol } }; RepeatedField <string> elementIds = _cachedRequestWrapper.ExportMeshesRequest.ElementIds; for (int i = 0; i < BatchSize; ++i) { elementIds.Add(""); } }
public static void Reserve <T>(this RepeatedField <T> field, int count) where T : new() { while (field.Count < count) { field.Add(new T()); } }
private async ETTask RunAsync(Player player, C2L_RefreshStranger message, Action <L2C_RefreshStranger> reply) { L2C_RefreshStranger response = new L2C_RefreshStranger(); try { long uid = player.uid; Tuple <List <RelationshipSimpleInfo>, long> tuple = await RelationshipDataHelper.GetStrangers(uid, message.Skip, message.Limit); List <RelationshipSimpleInfo> relationships = tuple.Item1; long totalCount = tuple.Item2; RepeatedField <RelationshipSimpleInfo> list = new RepeatedField <RelationshipSimpleInfo>(); foreach (var info in relationships) { list.Add(info); } response.TotalCount = totalCount; response.RelationshipList = list; response.Error = ErrorCode.ERR_Success; reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public void MergeFrom(IExtensionValue value) { if (value is RepeatedExtensionValue <T> ) { field.Add((value as RepeatedExtensionValue <T>).field); } }
private async void RunAsync(Session session, L2M_RunRoomOnTeam message, Action <M2L_RunRoomOnTeam> reply) { M2L_RunRoomOnTeam response = new M2L_RunRoomOnTeam(); try { var roomComponent = Game.Scene.GetComponent <RoomComponent>(); var room = roomComponent.Get(message.RoomId); if (room == null) { response.Error = ErrorCode.ERR_RoomIdNotFound; reply(response); return; } var roomTeamComponent = room.GetComponent <RoomTeamComponent>(); if (roomTeamComponent == null) { response.Error = ErrorCode.ERR_RoomTeamComponentNull; reply(response); return; } roomTeamComponent.TeamLeaderRun(); await roomComponent.Update(room); RepeatedField <MapUnitInfo> mapUnitInfos = new RepeatedField <MapUnitInfo>(); List <MapUnit> mapUnits = room.GetAll(); for (int i = 0; i < mapUnits.Count; i++) { mapUnits[i].Info.PathId = i % 4; mapUnitInfos.Add(mapUnits[i].Info); } ActorMessageSenderComponent actorLocationSenderComponent = Game.Scene.GetComponent <ActorMessageSenderComponent>(); for (int i = 0; i < mapUnits.Count; i++) { if (mapUnits[i].MapUnitType == MapUnitType.Npc) { continue; } if (mapUnits[i].GetComponent <MapUnitGateComponent>().IsDisconnect) { continue; } M2C_TeamGoBattle m2c_TeamGoBattle = new M2C_TeamGoBattle(); m2c_TeamGoBattle.MapUnitInfos = mapUnitInfos; m2c_TeamGoBattle.MapUnitId = mapUnits[i].Id; ActorMessageSender actorMessageSender = actorLocationSenderComponent.Get(mapUnits[i].GetComponent <MapUnitGateComponent>().GateSessionActorId); actorMessageSender.Send(m2c_TeamGoBattle); } reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
private async Task <CancellationToken> FlushRecordsToPublish() { if (recordsToPublish.IsEmpty) { return(new CancellationToken(true)); } RepeatedField <TopicDataRecord> repeatedField = new RepeatedField <TopicDataRecord>(); while (!recordsToPublish.IsEmpty) { if (recordsToPublish.TryTake(out TopicDataRecord record)) { repeatedField.Add(record); } } TopicDataRecordList recordList = new TopicDataRecordList() { Elements = { repeatedField }, }; TopicData topicData = new TopicData() { TopicDataRecordList = recordList }; return(await SendTopicDataImmediately(topicData)); }
//刷新手牌UI 只管手牌UI public void RefreshHandUI(RepeatedField <int> hands) { //先直接清除所有手牌 ClearHands(); _HandPatent.GetComponent <HorizontalLayoutGroup>().enabled = true;//刷新牌之前启用网格 int moreCard = -1; if (hands.Count % 3 == 2) //如果是 碰杠之后刷新 手牌 会多一张 移到新手牌那 { if (_IsCanChuCard && hands.Contains(_NewHand.CardSize)) //若果当前 是自己出牌 尽量摸牌 位置放原有牌 { moreCard = _NewHand.CardSize; } else { moreCard = hands[hands.Count - 1]; } hands.Remove(moreCard); } //更新手牌UI 刷新牌 for (int i = 0; i < hands.Count; i++) { _HandLists.Add(CardFiveStarCardPool.Ins.CreateHand(hands[i], i, _HandPatent)); } _NewHand.SetActive(false); if (moreCard > 0)//如果多的牌 就放在 摸的牌的显示 { _NewHand.SetCardUI(moreCard); hands.Add(moreCard); } }
/// <summary> /// Adds an ascending ordering by property name. The ordering is implicitly ascending. /// </summary> /// <param name="orderings">The ordering field to add the ordering to. Must not be null.</param> /// <param name="propertyName">The name of the property to order by. Must not be null.</param> public static void Add(this RepeatedField <PropertyOrder> orderings, string propertyName) { GaxPreconditions.CheckNotNull(orderings, nameof(orderings)); orderings.Add(new PropertyOrder { Direction = Direction.Ascending, Property = new PropertyReference(propertyName) }); }
private void SetCommentRes(bool comtype, string comment, int star) { var buffer = NetWorkManager.GetByteData(new CommentReq { Comment = comment, Star = star, Type = comtype ? 1 : 0 }); NetWorkManager.Instance.Send <CommentRes>(CMD.STORESCORE_Comment, buffer, res => { GlobalData.PlayerModel.UpdateUserMoney(res.UserMoney); _storeScoreWindow.Close(); if (_awardWindow == null) { _awardWindow = PopupManager.ShowWindow <AwardWindow>("GameMain/Prefabs/AwardWindow/AwardWindow"); } RepeatedField <AwardPB> gemAward = new RepeatedField <AwardPB>(); AwardPB awardPb = new AwardPB() { Num = 10, Resource = ResourcePB.Gem, ResourceId = 30001 }; gemAward.Add(awardPb); _awardWindow.SetData(gemAward); //评分完成且拿完奖励后去商店评分! if (comtype) { Debug.LogError("COMMENT URL" + GlobalData.VersionData.ForceUpdateAddr); Application.OpenURL(GlobalData.VersionData.ForceUpdateAddr); } }); }
private void RunAsync(Session session, L2M_GetAllMapUnitInfoOnRoom message, Action <M2L_GetAllMapUnitInfoOnRoom> reply) { M2L_GetAllMapUnitInfoOnRoom response = new M2L_GetAllMapUnitInfoOnRoom(); try { var roomComponent = Game.Scene.GetComponent <RoomComponent>(); var room = roomComponent.Get(message.RoomId); if (room == null) { response.Error = ErrorCode.ERR_RoomIdNotFound; reply(response); return; } RepeatedField <MapUnitInfo> mapUnitInfos = new RepeatedField <MapUnitInfo>(); List <MapUnit> mapUnits = room.GetAll(); for (int i = 0; i < mapUnits.Count; i++) { mapUnitInfos.Add(mapUnits[i].Info); } response.Data = mapUnitInfos; reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public void Delete(RepeatedField <long> arr) { if (_oldGift == null) { return; } RepeatedField <UserTriggerGiftPB> triggerGiftList = new RepeatedField <UserTriggerGiftPB>(); foreach (var giftPb in _oldGift) { bool isAdd = true; foreach (var id in arr) { if (giftPb.Id == id) { isAdd = false; break; } } if (isAdd) { triggerGiftList.Add(giftPb); } } FilterNewGift(_oldGift, triggerGiftList, false); }
/// <summary> /// Convert from collection of <see cref="TenantOffset"/> to collection of <see cref="Runtime.Grpc.Interaction.TenantOffset"/> /// </summary> /// <param name="offsets">Collection of <see cref="TenantOffset">Offsets</see> to convert from</param> /// <returns>Collection of <see cref="Runtime.Grpc.Interaction.TenantOffset"/></returns> public static RepeatedField <Runtime.Grpc.Interaction.TenantOffset> ToProtobuf(this IEnumerable <TenantOffset> offsets) { var protobuf = new RepeatedField <Runtime.Grpc.Interaction.TenantOffset>(); protobuf.Add(offsets.Select(_ => _.ToProtobuf())); return(protobuf); }
/// <summary> /// Convert from <see cref="Dolittle.Security.Claims"/> to <see cref="RepeatedField{Claim}"/> /// </summary> /// <param name="claims"><see cref="Dolittle.Security.Claims"/> to convert from</param> /// <returns>Converted <see cref="RepeatedField{Claim}"/></returns> public static RepeatedField <Claim> ToProtobuf(this Dolittle.Security.Claims claims) { var protobufClaims = new RepeatedField <Claim>(); protobufClaims.Add(claims.Select(_ => _.ToProtobuf())); return(protobufClaims); }
private async Task <bool> UnsubscribeTopic(List <string> topics) { // Repeated fields cannot be instantiated in SerivceRequest creation; adding topic to unsubscribeTopics which is later sent to server with clientID RepeatedField <string> unsubscribeTopics = new RepeatedField <string>(); unsubscribeTopics.Add(topics); ServiceRequest topicUnsubscription = new ServiceRequest { Topic = UbiiConstants.Instance.DEFAULT_TOPICS.SERVICES.TOPIC_SUBSCRIPTION, TopicSubscription = new TopicSubscription { ClientId = clientSpecification.Id, UnsubscribeTopics = { unsubscribeTopics } } }; ServiceReply subReply = await CallService(topicUnsubscription); if (subReply.Error != null) { Debug.LogError("subReply Error! Error msg: " + subReply.Error.ToString()); return(false); } foreach (string topic in topics) { topicDataClient.RemoveAllTopicCallbacks(topic); } return(true); }
public void MergeFrom(DiagnosisKey other) { if (other == null) { return; } if (other.KeyData.Length != 0) { KeyData = other.KeyData; } if (other.RollingStartIntervalNumber != 0) { RollingStartIntervalNumber = other.RollingStartIntervalNumber; } if (other.RollingPeriod != 0) { RollingPeriod = other.RollingPeriod; } if (other.TransmissionRiskLevel != 0) { TransmissionRiskLevel = other.TransmissionRiskLevel; } visitedCountries_.Add(other.visitedCountries_); if (other.Origin.Length != 0) { Origin = other.Origin; } if (other.ReportType != global::Iks.Protobuf.EfgsReportType.Unknown) { ReportType = other.ReportType; } if (other.DaysSinceOnsetOfSymptoms != 0) { DaysSinceOnsetOfSymptoms = other.DaysSinceOnsetOfSymptoms; } _unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public void Add_SingleItem() { var list = new RepeatedField<string>(); list.Add("foo"); Assert.AreEqual(1, list.Count); Assert.AreEqual("foo", list[0]); }
public void Add_Sequence() { var list = new RepeatedField<string>(); list.Add(new[] { "foo", "bar" }); Assert.AreEqual(2, list.Count); Assert.AreEqual("foo", list[0]); Assert.AreEqual("bar", list[1]); }
public void Add_RepeatedField() { var list = new RepeatedField<string> { "original" }; list.Add(new RepeatedField<string> { "foo", "bar" }); Assert.AreEqual(3, list.Count); Assert.AreEqual("original", list[0]); Assert.AreEqual("foo", list[1]); Assert.AreEqual("bar", list[2]); }
public void IList_Add() { IList list = new RepeatedField<string> { "first", "second" }; list.Add("third"); CollectionAssert.AreEqual(new[] { "first", "second", "third" }, list); }