public void Clear() { var dict = new OrderedDictionary<int, int> { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 5 } }; dict.Clear(); Assert.AreEqual(0, dict.Count); Assert.AreEqual(0, dict.Values.Count); Assert.IsFalse(dict.ContainsKey(1)); Assert.IsFalse(dict.ContainsValue(2)); }
public void Clear() { OrderedDictionary<string, string> dictionary = new OrderedDictionary<string, string>(); List<KeyValuePair<string, string>> tracking = new List<KeyValuePair<string, string>>(); KeyValuePair<string, string> one = new KeyValuePair<string, string>("1", "one"); KeyValuePair<string, string> two = new KeyValuePair<string, string>("2", "two"); dictionary.Add(one); dictionary.Insert(0, two); Assert.IsTrue(2 == dictionary.Count); dictionary.Clear(); Assert.IsTrue(0 == dictionary.Count); }
public bool Add(T item) { if (dictionary.Contains(item)) { return(false); } if (dictionary.Count >= maxCapacity) { if (removeCount == maxCapacity) { dictionary.Clear(); } else { for (int i = 0; i < removeCount; i++) { dictionary.RemoveAt(0); } } } dictionary.Add(item, null); return(true); }
/// <summary> /// Reset all lists that have to deal with what updates the viewer has /// </summary> public void Close() { if (m_presence == null) { return; } m_SentInitialObjects = false; m_prioritizer = null; m_culler = null; m_inUse = false; m_queueing = false; lock (m_objectUpdatesToSendLock) m_objectUpdatesToSend.Clear(); lock (m_presenceUpdatesToSendLock) m_presenceUpdatesToSend.Clear(); m_presence.OnSignificantClientMovement -= SignificantClientMovement; m_presence.Scene.EventManager.OnMakeChildAgent -= EventManager_OnMakeChildAgent; m_scene.EventManager.OnClosingClient -= EventManager_OnClosingClient; m_presence.Scene.AuroraEventManager.UnregisterEventHandler("DrawDistanceChanged", AuroraEventManager_OnGenericEvent); m_presence.Scene.AuroraEventManager.UnregisterEventHandler("SignficantCameraMovement", AuroraEventManager_OnGenericEvent); m_presence = null; }
public void Clear() { _map.Clear(); }
public void Clear() { dic.Clear(); }
/// <inheritdoc /> public void Clear() => _args.Clear();
public void TestClear() { od.Clear(); od.Count.Should().Be(0); od.TryGetValue("a", out uint i).Should().BeFalse(); }
/// <summary> /// Clears all items from this collection. /// Items in this collection will be destroyed. /// </summary> public void Clear() { items.Clear(); }
/// <summary> /// Clears the history. /// </summary> public void Clear() { _snapshots.Clear(); UndoOperationsStack.Clear(); }
public override void Clear() { _propertyIndex.Clear(); }
public void PlayerConfirm(Player senderPlayer) { switch (_phase) { case TurnPhase.PayRent: { if (!_pendingPlayers.Contains(senderPlayer)) { return; } if (PlayerStates[senderPlayer].BalanceMoney < _rentAmount) { return; } _pendingPlayers.Remove(senderPlayer); var json = new JsonObject(); json.Add("type", "playerDone"); json.Add("username", senderPlayer.Username); _room.BroadcastJson(json); if (_pendingPlayers.Count == 0) { foreach (var card in _marketPile.Values) { _marketDeck.Add(card); } Card.ShuffleCardsList(_marketDeck); _marketPile.Clear(); for (var i = 0; i < MarketPileSize; i++) { DrawMarketPileCard(); } foreach (var player in _room.Players.Values) { var playerState = PlayerStates[player]; playerState.RentPile.Clear(); playerState.BalanceMoney = 0; SendPlayerSelfGame(player); } SetPhase(TurnPhase.MarketFadeIn); } } break; case TurnPhase.Market: { if (!_pendingPlayers.Contains(senderPlayer)) { return; } _pendingPlayers.Remove(senderPlayer); var json = new JsonObject(); json.Add("type", "playerDone"); json.Add("username", senderPlayer.Username); _room.BroadcastJson(json); if (_pendingPlayers.Count == 0) { // TODO: Increase this smartly based on the current deck of the players maybe? _rentAmount = (int)Math.Ceiling(_rentAmount * 1.05); _mood = _temporaryMood; _hygiene = _temporaryHygiene; foreach (var player in _room.Players.Values) { var playerState = PlayerStates[player]; foreach (var card in playerState.Hand.Values) { playerState.DiscardPile.Add(card); } playerState.Hand.Clear(); playerState.BalanceMoney = 0; SendPlayerSelfGame(player); BroadcastPlayerHandCount(player); } SetPhase(TurnPhase.FadeOut); } } break; } }
/// <summary> /// Removes all itmes from the collection. /// </summary> public void Clear() { m_pItems.Clear(); }
internal void Clear() { _map.Clear(); }
public void Clear() { store.Clear(); MarkCollectionChanged(); }
public override Task OnAuthorizeAccount() { //Here we go through the OAuth 1.0a sign-in flow // 1.) Request a token from Twitter // 2.) Have the user authorize NinjaTrader to post on their behalf // 3.) Recieve the authorization token that allows us to actually post on their behalf #region Twitter Request Token string oauth_request_token_url = "https://api.twitter.com/oauth/request_token"; string oauth_callback = "http://www.ninjatrader.com"; string oauth_timestamp = Convert.ToInt64((TimeZoneInfo.ConvertTime(Core.Globals.Now, Core.Globals.GeneralOptions.TimeZoneInfo, TimeZoneInfo.Utc) - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds, CultureInfo.CurrentCulture).ToString(CultureInfo.CurrentCulture); string oauth_nonce = Convert.ToBase64String(new ASCIIEncoding().GetBytes(Core.Globals.Now.Ticks.ToString())); string oauth_signature_method = "HMAC-SHA1"; string oauth_version = "1.0"; OrderedDictionary sigParameters = new OrderedDictionary { { "oauth_callback=", Core.Globals.UrlEncode(oauth_callback) + "&" }, { "oauth_consumer_key=", Core.Globals.UrlEncode(oauth_consumer_key) + "&" }, { "oauth_nonce=", Core.Globals.UrlEncode(oauth_nonce) + "&" }, { "oauth_signature_method=", Core.Globals.UrlEncode(oauth_signature_method) + "&" }, { "oauth_timestamp=", Core.Globals.UrlEncode(oauth_timestamp) + "&" }, { "oauth_version=", Core.Globals.UrlEncode(oauth_version) } }; string oauth_signature = Core.Globals.GetTwitterSignature(oauth_request_token_url, "POST", sigParameters); string header = "OAuth" + " " + "oauth_callback=\"" + Core.Globals.UrlEncode(oauth_callback) + "\"," + "oauth_consumer_key=\"" + Core.Globals.UrlEncode(oauth_consumer_key) + "\"," + "oauth_nonce=\"" + Core.Globals.UrlEncode(oauth_nonce) + "\"," + "oauth_signature_method=\"" + Core.Globals.UrlEncode(oauth_signature_method) + "\"," + "oauth_timestamp=\"" + Core.Globals.UrlEncode(oauth_timestamp) + "\"," + "oauth_version=\"" + Core.Globals.UrlEncode(oauth_version) + "\"," + "oauth_signature=\"" + Core.Globals.UrlEncode(oauth_signature) + "\""; string result = string.Empty; try { HttpWebRequest r = (HttpWebRequest)WebRequest.Create(oauth_request_token_url); r.Method = "POST"; r.ContentLength = 0; r.ContentType = "application/x-www-form-urlencoded"; r.ServicePoint.Expect100Continue = false; r.Headers.Add("Authorization", header); using (HttpWebResponse s = (HttpWebResponse)r.GetResponse()) using (StreamReader reader = new StreamReader(s.GetResponseStream())) result = reader.ReadToEnd(); } catch (WebException ex) { string message = string.Empty; using (StreamReader reader = new StreamReader(ex.Response.GetResponseStream())) message = reader.ReadToEnd(); IsConfigured = false; SetState(State.Finalized); return(Task.FromResult(0)); } string oauth_token = string.Empty; string oauth_token_secret = string.Empty; string oauth_verifier = string.Empty; if (!string.IsNullOrEmpty(result)) { string[] pairs = result.Split('&'); foreach (string pair in pairs) { string[] keyvalue = pair.Split('='); if (keyvalue[0] == "oauth_token") { oauth_token = keyvalue[1]; } else if (keyvalue[0] == "oauth_token_secret") { oauth_token_secret = keyvalue[1]; } } } #endregion #region Twitter Authorize //We're going to display a webpage in an NTWindow so the user can authorize our app to post on their behalf. //Because of WPF/WinForm airspace issues (see http://msdn.microsoft.com/en-us/library/aa970688.aspx for the gory details), // and because we want to have our pretty NT-styled windows, we need to finagle things a bit. // 1.) Create a modal NTWindow that will pop up when the user clicks "Connect" // 2.) Create a borderless window that will actually host the WebBrowser control // 3.) A window can have one Content object, so add a grid to the Window hosting the WebBrowser, and make the WeBrowser a child of the grid // 4.) Add another grid to the modal NTWindow. We'll use this to place where the WebBrowser goes // 5.) Handle the LocationChanged event for the NTWindow and the SizeChanged event for the placement grid. This will take care of making // the hosted WebBrowser control look like it's part of the NTWindow // 6.) Make sure the Window hosting the WebBrowser is set to be TopMost so it appears on top of the NTWindow. NTWindow authWin = new NTWindow() { Caption = Custom.Resource.GuiAuthorize, IsModal = true, Height = 750, Width = 800, }; Window webHost = new Window() { ResizeMode = System.Windows.ResizeMode.NoResize, ShowInTaskbar = false, WindowStyle = System.Windows.WindowStyle.None, }; WebBrowser browser = new WebBrowser() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, VerticalAlignment = System.Windows.VerticalAlignment.Stretch, }; Grid grid = new Grid(); grid.Children.Add(browser); webHost.Content = grid; Grid placementGrid = new Grid(); authWin.Content = placementGrid; authWin.LocationChanged += (o, e) => OnSizeLocationChanged(placementGrid, webHost); placementGrid.SizeChanged += (o, e) => OnSizeLocationChanged(placementGrid, webHost); browser.Navigating += (o, e) => { if (e.Uri.Host == "www.ninjatrader.com") { if (e.Uri.Query.StartsWith("?oauth_token")) { //Successfully authorized! :D string query = e.Uri.Query.TrimStart('?'); string[] pairs = query.Split('&'); foreach (string pair in pairs) { string[] keyvalue = pair.Split('='); if (keyvalue[0] == "oauth_token") { oauth_token = keyvalue[1]; } else if (keyvalue[0] == "oauth_verifier") { oauth_verifier = keyvalue[1]; } } authWin.DialogResult = true; authWin.Close(); } else if (e.Uri.Query.StartsWith("?denied")) { //User denied authorization :'( authWin.DialogResult = false; authWin.Close(); } } }; authWin.Closing += (o, e) => webHost.Close(); browser.Navigate(new Uri("https://api.twitter.com/oauth/authorize?oauth_token=" + oauth_token)); webHost.Visibility = System.Windows.Visibility.Visible; webHost.Topmost = true; authWin.ShowDialog(); #endregion #region Twitter Access Token if (authWin.DialogResult == true) { string oauth_access_token_url = "https://api.twitter.com/oauth/access_token"; oauth_timestamp = Convert.ToInt64((TimeZoneInfo.ConvertTime(Core.Globals.Now, Core.Globals.GeneralOptions.TimeZoneInfo, TimeZoneInfo.Utc) - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds, CultureInfo.CurrentCulture).ToString(CultureInfo.CurrentCulture); oauth_nonce = Convert.ToBase64String(new ASCIIEncoding().GetBytes(Core.Globals.Now.Ticks.ToString())); sigParameters.Clear(); sigParameters.Add("oauth_consumer_key=", Core.Globals.UrlEncode(oauth_consumer_key) + "&"); sigParameters.Add("oauth_nonce=", Core.Globals.UrlEncode(oauth_nonce) + "&"); sigParameters.Add("oauth_signature_method=", Core.Globals.UrlEncode(oauth_signature_method) + "&"); sigParameters.Add("oauth_timestamp=", Core.Globals.UrlEncode(oauth_timestamp) + "&"); sigParameters.Add("oauth_token=", Core.Globals.UrlEncode(oauth_token) + "&"); sigParameters.Add("oauth_verifier=", Core.Globals.UrlEncode(oauth_verifier) + "&"); sigParameters.Add("oauth_version=", Core.Globals.UrlEncode(oauth_version)); oauth_signature = Core.Globals.GetTwitterSignature(oauth_access_token_url, "POST", sigParameters); header = "OAuth" + " " + "oauth_consumer_key=\"" + Core.Globals.UrlEncode(oauth_consumer_key) + "\"," + "oauth_nonce=\"" + Core.Globals.UrlEncode(oauth_nonce) + "\"," + "oauth_signature_method=\"" + Core.Globals.UrlEncode(oauth_signature_method) + "\"," + "oauth_timestamp=\"" + Core.Globals.UrlEncode(oauth_timestamp) + "\"," + "oauth_token=\"" + Core.Globals.UrlEncode(oauth_token) + "\"," + "oauth_verifier=\"" + Core.Globals.UrlEncode(oauth_verifier) + "\"," + "oauth_version=\"" + Core.Globals.UrlEncode(oauth_version) + "\"," + "oauth_signature=\"" + Core.Globals.UrlEncode(oauth_signature) + "\""; try { HttpWebRequest r = (HttpWebRequest)WebRequest.Create(oauth_access_token_url + "?oauth_verifier=" + Core.Globals.UrlEncode(oauth_verifier)); r.Method = "POST"; r.ContentLength = 0; r.ContentType = "application/x-www-form-urlencoded"; r.ServicePoint.Expect100Continue = false; r.Headers.Add("Authorization", header); using (HttpWebResponse s = (HttpWebResponse)r.GetResponse()) using (StreamReader reader = new StreamReader(s.GetResponseStream())) result = reader.ReadToEnd(); if (!string.IsNullOrEmpty(result)) { string[] pairs = result.Split('&'); foreach (string pair in pairs) { string[] keyvalue = pair.Split('='); if (keyvalue[0] == "oauth_token") { OAuth_Token = keyvalue[1]; } else if (keyvalue[0] == "oauth_token_secret") { OAuth_Token_Secret = keyvalue[1]; } else if (keyvalue[0] == "screen_name") { UserName = keyvalue[1]; } } } } catch (WebException ex) { string message = string.Empty; using (StreamReader reader = new StreamReader(ex.Response.GetResponseStream())) message = reader.ReadToEnd(); IsConfigured = false; SetState(State.Finalized); return(Task.FromResult(0)); } IsConfigured = !string.IsNullOrEmpty(OAuth_Token) && !string.IsNullOrEmpty(OAuth_Token_Secret) && !string.IsNullOrEmpty(UserName); } else { IsConfigured = false; } #endregion return(Task.FromResult(0)); }
///// <summary> ///// Returns an enumerator which iterates through values in this instance in order as they were added in it. ///// </summary> ///// <returns>The enumerator.</returns> //IDictionaryEnumerator/*!*/ IDictionary.GetEnumerator() //{ // if (this.Count == 0) // return OrderedDictionary.EmptyEnumerator.SingletonInstance; // return new IDictionaryAdapter(this); // new GenericDictionaryAdapter<object, object>(GetDictionaryEnumerator(), false); //} //private IEnumerator<KeyValuePair<object, object>>/*!*/ GetDictionaryEnumerator() //{ // foreach (KeyValuePair<IntStringKey, object> entry in table) // { // yield return new KeyValuePair<object, object>(entry.Key.Object, entry.Value); // } //} /// <summary> /// Removes all elements from this instance. /// </summary> public virtual void Clear() { this.EnsureWritable(); table.Clear(); }
internal void PrintC(StreamWriterLevel c, string uniqueID) { string star = ""; if (!(m_type is IA5StringType)) star = "*"; c.WriteLine(); c.WriteLine("void {0}_Initialize({0}{1} pVal)", uniqueID, star); c.WriteLine("{"); c.WriteLine(); OrderedDictionary<string, CLocalVariable> localVars = new OrderedDictionary<string, CLocalVariable>(); ((ISCCType)m_type).VarsNeededForPrintCInitialize(1, localVars); CLocalVariable.Print(c, localVars); ((ISCCType)m_type).PrintCInitialize(m_type.PEREffectiveConstraint, m_type.GetOneValidValue(), c, uniqueID, "pVal", 1, 1); c.WriteLine("}"); c.WriteLine(); //print Constraints aux protypes foreach (Asn1Type t in m_type.GetMySelfAndAnyChildren<Asn1Type>()) for (int i = 0; i < t.m_constraints.Count; i++) ((ISCConstraint)t.m_constraints[i]).PrintCIsConstraintValidAux(uniqueID + star + " pVal", c); c.WriteLine(); c.WriteLine("flag {0}_IsConstraintValid(const {0}{1} pVal, int* pErrCode)", uniqueID, star); c.WriteLine("{"); localVars.Clear(); ((ISCCType)m_type).VarsNeededForIsConstraintValid(1, localVars); CLocalVariable.Print(c, localVars); ((ISCCType)m_type).PrintCIsConstraintValid(m_type.PEREffectiveConstraint, c, uniqueID, uniqueID, "pVal", 1, 1); c.P(1); c.WriteLine("(void)pVal; /*Dummy statement, just to hide potential warning*/"); c.P(1); c.WriteLine("(void)pErrCode; /*Dummy statement, just to hide potential warning*/"); c.P(1); c.WriteLine("return TRUE;"); c.WriteLine("}"); c.WriteLine(); //print Constraints aux body functions foreach (Asn1Type t in m_type.GetMySelfAndAnyChildren<Asn1Type>()) for (int i = 0; i < t.m_constraints.Count; i++) ((ISCConstraint)t.m_constraints[i]).PrintCIsConstraintValidAuxBody(c); c.WriteLine("flag {0}_Encode(const {0}{1} pVal, BitStream* pBitStrm, int* pErrCode, flag bCheckConstraints)", uniqueID, star); c.WriteLine("{"); localVars.Clear(); ((ISCCType)m_type).VarsNeededForEncode(m_type.PEREffectiveConstraint, 1, localVars); CLocalVariable.Print(c, localVars); c.P(1); c.WriteLine("if (bCheckConstraints && !{0}_IsConstraintValid(pVal, pErrCode))", uniqueID); c.P(2); c.WriteLine("return FALSE;"); ((ISCCType)m_type).PrintCEncode(m_type.PEREffectiveConstraint, c, uniqueID, "pVal", 1); c.P(1); c.WriteLine("return TRUE;"); c.WriteLine("}"); c.WriteLine(); c.WriteLine("flag {0}_Decode({0}{1} pVal, BitStream* pBitStrm, int* pErrCode)", uniqueID, star); c.WriteLine("{"); localVars.Clear(); ((ISCCType)m_type).VarsNeededForDecode(m_type.PEREffectiveConstraint, 1, localVars); CLocalVariable.Print(c, localVars); ((ISCCType)m_type).PrintCDecode(m_type.PEREffectiveConstraint, c, "pVal", 1); c.P(1); c.WriteLine("return TRUE;"); c.WriteLine("}"); c.WriteLine(); /* c.WriteLine("void {0}_PrintXml({0}{1} pVal, FILE* fp)", uniqueID, star); c.WriteLine("{"); c.P(1); c.Write("fprintf(fp,\"<{0}>\"", m_name); c.P(1); c.Write("fprintf(fp,\"</{0}>\"", m_name); c.WriteLine("}"); c.WriteLine(); */ }
public void Clear() { _delegate.Clear(); }
public void Clear() { _cache.Clear(); _lastCleared = Time.realtimeSinceStartup; _lastCheckedFrame = Time.frameCount; }
public void ReadOnly_Clear() { OrderedDictionary od = new OrderedDictionary().AsReadOnly(); od.Clear(); }
public override void Clear() { _orderedDictionary.Clear(); }
public void Clear() { _options.Clear(); }
private void Clear() { m_tables.Clear(); }
/// <summary> /// Function check in there was any change on table. If there was, send the info to ARBangStateMachine and DrawControl to change state /// and redraw new information to image projected on table. /// </summary> private void Update() { if ((camC.IsCameraCalibrated() && camC.IsCameraChosen() && camC.IsTableCalibrated() && camC.IsProjectorCalibrated()) && IsGameStarted() && LoadingSuccessfull()) { // capture next image by camera camC.PrepareNextImageInDetectionOne(); // check which players are currently active foreach (int plID in _playersIDs) { double intensity = camC.IsPlayerActive(plID); if (intensity > 0.0) { if (plID == 0) { WasCentralAreaActive = true; } else if (intensity > _currentlyMostActivePlayer.Value) { _currentlyMostActivePlayer = new KeyValuePair <int, double>(plID, intensity); } _currentlyActivePlayers.Add(plID, intensity); } } if (_currentlyMostActivePlayer.Key > 0) { // save active player if messed up with central area if (WasCentralAreaActive) { Debug.Log("CENTRAL AREA ACTIVE!"); _bangStateMachine.AddActivePlayer(_currentlyMostActivePlayer.Key, _currentlyMostActivePlayer.Value); } //Debug.Log("Most active player is ID: " + _currentlyMostActivePlayer.Key + "; Saved players: " + _bangStateMachine.GetNumberOfPlayersSaved()); // generate update config to mark his area UpdateInfo up = new UpdateInfo { State = ARBangStateMachine.BangState.BASE, PlayerID = _currentlyMostActivePlayer.Key, }; up.effect = DrawEffectControl.EffectsTypes.BORDER_MARKED; up.CardId = -1; up.CardType = ARBangStateMachine.BangCard.NONE; if (up.CardType == ARBangStateMachine.BangCard.NONE) { up.Appear = false; } else { up.Appear = true; } _updateList.Add(up); // add cards for check foreach (KeyValuePair <int, List <CardInfo> > item in _cardPosIDs) { // check if card has changed for common area -> ID of common area is always zero if ((item.Key == 0 && WasCentralAreaActive) || item.Key == _currentlyMostActivePlayer.Key) { foreach (CardInfo entry in item.Value) { if (cardsToCheck.ContainsKey(entry.CardID)) { // player was active again, reset check cardsToCheck[entry.CardID].MostActivePlayer = _currentlyMostActivePlayer.Key; cardsToCheck[entry.CardID].wasChecked = 0; cardsToCheck[entry.CardID].possibleNewCardTypes.Clear(); } else { // add card for check CardChecker cc = new CardChecker(); cc.cardID = Convert.ToUInt16(entry.CardID); cc.playerID = item.Key; cc.wasChecked = 0; cc.possibleNewCardTypes.Clear(); cc.cardType = (ushort)entry.CardType; cc.MostActivePlayer = _currentlyMostActivePlayer.Key; cardsToCheck.Add((ushort)entry.CardID, cc); } } } } } //Debug.Log("Cards to check: " + cardsToCheck.Count); // get new frame, the player activity covered table in previous one camC.PrepareNextImageInDetection(); List <ushort> itemsToRemove = new List <ushort>(); // check card places which need to be checked foreach (KeyValuePair <ushort, CardChecker> cardPosToCheck in cardsToCheck) { CardChecker currentChecker = cardPosToCheck.Value; ushort cardTypeNew = 0; camC.IsCardChanged(cardPosToCheck.Key, ref cardTypeNew); //Debug.Log("Checking id: " + cardPosToCheck.Key + ", new id: " + cardTypeNew); // some card was detected show, bounding box, the type of card is not certain yet if (cardTypeNew != (ushort)ARBangStateMachine.BangCard.NONE && !currentChecker.wasMarked) { CreateUpdateInfoToMarkArea(currentChecker.MostActivePlayer, currentChecker.cardID, cardTypeNew, false); currentChecker.wasMarked = true; } if (currentChecker.possibleNewCardTypes.ContainsKey(cardTypeNew)) { // possible new card type found again currentChecker.possibleNewCardTypes[cardTypeNew] += 1; } else { // new possible card currentChecker.possibleNewCardTypes.Add(cardTypeNew, 0); } // check is some possible new card type was confirmed enough times foreach (KeyValuePair <ushort, int> item in currentChecker.possibleNewCardTypes) { if (item.Value >= GameConfigDefines.ConfirmationRequired) { if (item.Key != currentChecker.cardType) { Debug.Log("New card detected on id: " + currentChecker.cardID + ", type: " + item.Key); // card changed and confirmed, create update CreateUpdateInfo(currentChecker.cardID, currentChecker.playerID, item.Key, currentChecker.cardType, currentChecker.MostActivePlayer); CreateUpdateInfoToMarkArea(currentChecker.MostActivePlayer, currentChecker.cardID, cardTypeNew); // remove position to check in future itemsToRemove.Add(cardPosToCheck.Key); } // save new detected card to its position List <CardInfo> ci = _cardPosIDs[currentChecker.playerID]; foreach (CardInfo ciOne in ci) { if (ciOne.CardID == currentChecker.cardID) { ciOne.CardType = (ARBangStateMachine.BangCard)item.Key; } } } } // increase number of check performed on this position and check if not too many times already ++currentChecker.wasChecked; // remove the ones which were check too many times without result if (currentChecker.wasChecked >= GameConfigDefines.CheckNumber) { itemsToRemove.Add(cardPosToCheck.Key); // generate update info, to stop blinking and use color red CreateUpdateInfo(currentChecker.cardID, currentChecker.playerID, (ushort)ARBangStateMachine.BangCard.NONE, currentChecker.cardType, currentChecker.MostActivePlayer); } } foreach (var removeItemA in itemsToRemove) { cardsToCheck.Remove(removeItemA); } itemsToRemove.Clear(); if (_updateList.Count > 0) { //Debug.Log("Items needs update: " + _updateList.Count); _updateRedrawReady = true; } _currentlyActivePlayers.Clear(); _currentlyMostActivePlayer = new KeyValuePair <int, double>(-1, 0.0); WasCentralAreaActive = false; } }
public void Clear() { Items.Clear(); }
/// <summary> /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>. /// </summary> /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only. </exception> public void Clear() { dictionary.Clear(); }
public void Clear() { _backing.Clear(); }
public void ItemEnumeration() { OrderedDictionary<string, string> dictionary = new OrderedDictionary<string, string>(); List<KeyValuePair<string, string>> tracking = new List<KeyValuePair<string, string>>(); KeyValuePair<string, string> one = new KeyValuePair<string, string>("1", "one"); KeyValuePair<string, string> two = new KeyValuePair<string, string>("2", "two"); int i = 0; { // round 1 dictionary.Add(one); dictionary.Insert(0, two); // test implicit pairs order foreach (KeyValuePair<string, string> item in dictionary) { switch (i) { case 0: Assert.AreEqual("2", dictionary[i].Key); break; case 1: Assert.AreEqual("1", dictionary[i].Key); break; default: Assert.Fail("unexpected element"); break; } ++i; } // test explicit pairs order i = 0; foreach (KeyValuePair<string, string> item in dictionary.GetOrderedPairs()) { switch (i) { case 0: Assert.AreEqual("2", dictionary[i].Key); break; case 1: Assert.AreEqual("1", dictionary[i].Key); break; default: Assert.Fail("unexpected element"); break; } ++i; } // test keys order i = 0; foreach (string key in dictionary.GetOrderedKeys()) { switch (i) { case 0: Assert.AreEqual("2", key); break; case 1: Assert.AreEqual("1", key); break; default: Assert.Fail("unexpected element"); break; } ++i; } // test values order i = 0; foreach (string key in dictionary.GetOrderedValues()) { switch (i) { case 0: Assert.AreEqual("two", key); break; case 1: Assert.AreEqual("one", key); break; default: Assert.Fail("unexpected element"); break; } ++i; } } dictionary.Clear(); Assert.AreEqual(0, dictionary.Count); i = 0; { // round 2 dictionary.Add(one); dictionary.Add(two); foreach (KeyValuePair<string, string> item in dictionary) { switch (i) { case 0: Assert.AreEqual("1", dictionary[i].Key); break; case 1: Assert.AreEqual("2", dictionary[i].Key); break; default: Assert.Fail("unexpected element"); break; } ++i; } } }
public void Clear() { parameters.Clear(); this.VistaDbParameterCollection.Clear(); }
private void monitorQueue() { Console.WriteLine("Monitor starting"); initialiseBackgroundPlayer(); DateTime nextQueueCheck = DateTime.Now; while (monitorRunning) { if (channelOpen && (!holdChannelOpen || DateTime.Now > timeOfLastMessageEnd + maxTimeToHoldEmptyChannelOpen)) { if (!queueHasDueMessages(queuedClips, false) && !queueHasDueMessages(immediateClips, true)) { holdChannelOpen = false; closeRadioInternalChannel(); } } if (immediateClips.Count > 0) { try { playQueueContents(immediateClips, true); } catch (Exception e) { Console.WriteLine("Exception processing immediate clips: " + e.Message); lock (immediateClips) { immediateClips.Clear(); } } } else if (DateTime.Now > nextQueueCheck) { nextQueueCheck = nextQueueCheck.Add(queueMonitorInterval); try { if (DateTime.Now > unpauseTime) { playQueueContents(queuedClips, false); allowPearlsOnNextPlay = true; } } catch (Exception e) { Console.WriteLine("Exception processing queued clips: " + e.Message); lock (queuedClips) { queuedClips.Clear(); } } } else { Thread.Sleep(immediateMessagesMonitorInterval); continue; } } //writeMessagePlayedStats(); playedMessagesCount.Clear(); stopBackgroundPlayer(); }
public void Clear() { values.Clear(); }
public void Reset() => _objects.Clear();
/// <summary> /// Reset the data held by this database. /// </summary> protected override void reset() => idToMove.Clear();
public void Values_Count() { var dict = new OrderedDictionary<string, int> { { "1", 2 }, { "2", 3 }, { "3", 4 } }; Assert.AreEqual(3, dict.Values.Count); dict.Add("4", 5); dict.Add("5", 6); Assert.AreEqual(5, dict.Values.Count); dict.Clear(); Assert.AreEqual(0, dict.Values.Count); }