System.Collections.Generic.List.Remove(ulong)

Here are the examples of the csharp api System.Collections.Generic.List.Remove(ulong) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

28 Examples 7

19 Source : MarketDepth.cs
with MIT License
from centaurus-project

private bool RemoveOrder(OrderInfo order)
        {
            if (order == null)
                throw new ArgumentNullException(nameof(order));

            var price = NormalizePrice(order.Price);
            var source = prices[order.Side];
            var currentPrice = source.FirstOrDefault(p => p.Price == price);
            if (currentPrice == null)
                return false;
            currentPrice.Amount += -order.AmountDiff;
            currentPrice.Orders.Remove(order.OrderId);
            if (currentPrice.Amount == 0)
                source.Remove(currentPrice);
            return true;
        }

19 Source : PoolManager.cs
with GNU General Public License v3.0
from CypherCore

void SpawnQuestObject(ActivePoolData spawns, uint limit, ulong triggerFrom)
        {
            Log.outDebug(LogFilter.Pool, "PoolGroup<Quest>: Spawning pool {0}", poolId);
            // load state from db
            if (triggerFrom == 0)
            {
                PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_POOL_QUEST_SAVE);
                stmt.AddValue(0, poolId);
                SQLResult result = DB.Characters.Query(stmt);

                if (!result.IsEmpty())
                {
                    do
                    {
                        uint questId = result.Read<uint>(0);
                        spawns.ActivateObject<Quest>(questId, poolId);
                        PoolObject tempObj = new(questId, 0.0f);
                        Spawn1Object(tempObj);
                        --limit;
                    } while (result.NextRow() && limit != 0);
                    return;
                }
            }

            List<ulong> currentQuests = spawns.GetActiveQuests();
            List<ulong> newQuests = new();

            // always try to select different quests
            foreach (var poolObject in EqualChanced)
            {
                if (spawns.IsActiveObject<Quest>(poolObject.guid))
                    continue;
                newQuests.Add(poolObject.guid);
            }

            // clear the pool
            DespawnObject(spawns);

            // recycle minimal amount of quests if possible count is lower than limit
            while (limit > newQuests.Count && !currentQuests.Empty())
            {
                ulong questId = currentQuests.SelectRandom();
                newQuests.Add(questId);
                currentQuests.Remove(questId);
            }

            if (newQuests.Empty())
                return;

            // activate <limit> random quests
            do
            {
                ulong questId = newQuests.SelectRandom();
                spawns.ActivateObject<Quest>(questId, poolId);
                PoolObject tempObj = new(questId, 0.0f);
                Spawn1Object(tempObj);
                newQuests.Remove(questId);
                --limit;
            } while (limit != 0 && !newQuests.Empty());

            // if we are here it means the pool is initialized at startup and did not have previous saved state
            if (triggerFrom == 0)
                Global.PoolMgr.SaveQuestsToDB();
        }

19 Source : PoolManager.cs
with GNU General Public License v3.0
from CypherCore

public void RemoveObject<T>(ulong db_guid, uint pool_id)
        {
            switch (typeof(T).Name)
            {
                case "Creature":
                    mSpawnedCreatures.Remove(db_guid);
                    break;
                case "GameObject":
                    mSpawnedGameobjects.Remove(db_guid);
                    break;
                case "Pool":
                    mSpawnedPools.Remove(db_guid);
                    break;
                case "Quest":
                    mActiveQuests.Remove(db_guid);
                    break;
                default:
                    return;
            }

            if (mSpawnedPools[pool_id] > 0)
                --mSpawnedPools[pool_id];
        }

19 Source : AbnormalityTracker.cs
with MIT License
from Foglio1024

public static void CheckMarkingOnDespawn(ulong target)
        {
            if (!MarkedTargets.Contains(target)) return;
            MarkedTargets.Remove(target);
            if (MarkedTargets.Count == 0) InvokeMarkingExpired();
        }

19 Source : HashCalculatorForm.cs
with GNU General Public License v3.0
from KillzXGaming

private void BruteForceHashes(STProgressBar progressBar, string hashType)
        {
            if (bruteForceHashTB.Text.Length == 0)
                return;

            var characterSet = SetupCharacters();

            CancelOperation = false;

            List<ulong> hashes = new List<ulong>();
            foreach (var line in bruteForceHashTB.Lines)
            {
                ulong hash = 0;
                ulong.TryParse(line, out hash);
                if (hash == 0) continue;

                hashes.Add(hash);
            }

            if (hashes.Count == 0) return;



            int maxLength = (int)maxLengthUD.Value;

            char lastChar = 'z';
            var firstChar = characterSet.FirstOrDefault();

            int charIndex = 0;
            bool useSpace = true;
            for (int length = 1; length <= maxLength; ++length)
            {
                UpdateProgressbar(progressBar, length, maxLength);

                StringBuilder Sb = new StringBuilder(new String(' ', length));
                while (true && CancelOperation == false && hashes.Count > 0)
                {
                    String value = Sb.ToString();

                    ulong calculatedHash = CalculateHash(hashType, $"{characterStartTB.Text}{value}");
                    if (hashes.Contains(calculatedHash))
                    {
                        UpdateTextbox($"{characterStartTB.Text}{value}");
                        hashes.Remove(calculatedHash);

                        if (hashes.Count == 0)
                        {
                            if (progressBar.InvokeRequired)
                            {
                                progressBar.Invoke((MethodInvoker)delegate {
                                    progressBar.Close();
                                });
                            }
                            return;
                        }
                    }

                    foreach (var line in characterStartTB.Lines)
                    {
                        ulong calculatedHash2 = CalculateHash(hashType, $"{line}{value}");
                        if (hashes.Contains(calculatedHash2))
                        {
                            UpdateTextbox($"{line}{value}");
                            hashes.Remove(calculatedHash2);

                            if (hashes.Count == 0)
                            {
                                if (progressBar.InvokeRequired)
                                {
                                    progressBar.Invoke((MethodInvoker)delegate {
                                        progressBar.Close();
                                    });
                                }
                                return;
                            }
                        }
                    }

                    if (value.All(item => item == lastChar))
                        break;

                    // Add one: aaa -> aab -> ... aaz -> aba -> ... -> zzz
                    for (int i = length - 1; i >= 0; --i)
                        if (Sb[i] == ' ')
                        {
                            Sb[i] = '/';
                            break;
                        }
                        else if (Sb[i] == '/')
                        {
                            if (UseNumbered)
                                Sb[i] = '0';
                            else
                            {
                                if (UseUppercase)
                                    Sb[i] = 'A';
                                else
                                    Sb[i] = 'a';
                            }
                            break;
                        }
                        else if (Sb[i] == '0') { Sb[i] = '1'; break; }
                        else if (Sb[i] == '1') { Sb[i] = '2'; break; }
                        else if (Sb[i] == '2') { Sb[i] = '3'; break; }
                        else if (Sb[i] == '3') { Sb[i] = '4'; break; }
                        else if (Sb[i] == '4') { Sb[i] = '5'; break; }
                        else if (Sb[i] == '5') { Sb[i] = '6'; break; }
                        else if (Sb[i] == '6') { Sb[i] = '7'; break; }
                        else if (Sb[i] == '7') { Sb[i] = '8'; break; }
                        else if (Sb[i] == '8') { Sb[i] = '9'; break; }
                        else if (Sb[i] == '9')
                        {
                            if (UseUppercase)
                                Sb[i] = 'A';
                            else
                                Sb[i] = 'a';
                            break;
                        }
                        else if (Sb[i] == 'Z')
                        {
                            Sb[i] = 'a';
                            break;
                        }
                        else if (Sb[i] != lastChar)
                        {
                            Sb[i] = (Char)(Sb[i] + 1);
                            break;
                        }
                        else
                        {
                            Sb[i] = ' ';
                        }
                }
            }

            progressBar.Close();
        }

19 Source : LeagueFileIndex.cs
with GNU General Public License v3.0
from LoL-Fantome

public void RemoveModdedEntry(ulong hash, string modId)
        {
            if (this._modIndex.ContainsKey(hash))
            {
                this._modIndex.Remove(hash);
            }
            else
            {
                Log.Warning("Unable to remove Entry: {0} installed by {1} in the Mod Index", hash, modId);
            }

            if (this._modEntryMap.ContainsKey(modId))
            {
                this._modEntryMap[modId].Remove(hash);
            }
            else
            {
                Log.Warning("Unable to remove Mod: {0} from Mod Entry Map", modId);
            }

            if (this._entryModMap.ContainsKey(hash))
            {
                this._entryModMap.Remove(hash);
            }
            else
            {
                Log.Warning("Unable to remove Entry: {0} from Entry Mod Map", hash);
            }

            //Remove Mod entry since it's empty
            if (this._modEntryMap.ContainsKey(modId) && this._modEntryMap[modId].Count == 0)
            {
                this._modEntryMap.Remove(modId);
            }

            if (!this._isEditing)
            {
                Write();
            }
        }

19 Source : WS_Handler_Channels.cs
with GNU General Public License v3.0
from MangosServer

public virtual void UnBan(WcHandlerCharacter.CharacterObject character, string name)
            {
                ulong victimGuid = _clusterServiceLocator.WcHandlerCharacter.GetCharacterGuidByName(name);
                if (!Joined.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Moderators.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_MODERATOR, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!_clusterServiceLocator.WorldCluster.CharacteRs.ContainsKey(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Banned.Contains(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_BANNED, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else
                {
                    Banned.Remove(victimGuid);

                    // DONE: [%s] Player %s unbanned by %s.
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_UNBANNED, victimGuid, character.Guid, default);
                    Broadcast(packet);
                    packet.Dispose();
                }
            }

19 Source : WS_Handler_Channels.cs
with GNU General Public License v3.0
from MangosServer

public virtual void Part(WcHandlerCharacter.CharacterObject character)
            {
                // DONE: Check if not on this channel
                if (!Joined.Contains(character.Guid))
                {
                    if (character.Client is object)
                    {
                        PacketClreplaced p = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON, character.Guid, default, default);
                        character.Client.Send(p);
                        p.Dispose();
                    }

                    return;
                }

                // DONE: You Left channel
                if (character.Client is object)
                {
                    PacketClreplaced p = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_YOU_LEFT, character.Guid, default, default);
                    character.Client.Send(p);
                    p.Dispose();
                }

                Joined.Remove(character.Guid);
                JoinedMode.Remove(character.Guid);
                character.JoinedChannels.Remove(ChannelName);

                // DONE: {0} Left channel
                if (Announce)
                {
                    PacketClreplaced response = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_LEFT, character.Guid, default, default);
                    Broadcast(response);
                    response.Dispose();
                }

                // DONE: Set new owner
                if (_clusterServiceLocator.Functions.HaveFlags(ChannelFlags, (byte)CHANNEL_FLAG.CHANNEL_FLAG_CUSTOM) && Owner == character.Guid && Joined.Count > 0)
                {
                    IEnumerator tmp = Joined.GetEnumerator();
                    tmp.MoveNext();
                    Dictionary<ulong, WcHandlerCharacter.CharacterObject> tmp1 = _clusterServiceLocator.WorldCluster.CharacteRs;
                    WcHandlerCharacter.CharacterObject argCharacter = tmp1[Conversions.ToULong(tmp.Current)];
                    SetOwner(argCharacter);
                    tmp1[Conversions.ToULong(tmp.Current)] = argCharacter;
                }

                // DONE: If free and not global - clear channel
                if (_clusterServiceLocator.Functions.HaveFlags(ChannelFlags, (byte)CHANNEL_FLAG.CHANNEL_FLAG_CUSTOM) && Joined.Count == 0)
                {
                    _clusterServiceLocator.WsHandlerChannels.ChatChanneLs.Remove(ChannelName);
                    Dispose();
                }
            }

19 Source : WS_Handler_Channels.cs
with GNU General Public License v3.0
from MangosServer

public void SetUnMute(WcHandlerCharacter.CharacterObject character, string name)
            {
                if (!Joined.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Moderators.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_MODERATOR, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else
                {
                    foreach (ulong guid in Joined.ToArray())
                    {
                        if ((_clusterServiceLocator.WorldCluster.CharacteRs[guid].Name.ToUpper() ?? "") == (name.ToUpper() ?? ""))
                        {
                            byte flags = JoinedMode[guid];
                            JoinedMode[guid] = (byte)((CHANNEL_USER_FLAG)JoinedMode[guid] ^ CHANNEL_USER_FLAG.CHANNEL_FLAG_MUTED);
                            Muted.Remove(guid);
                            PacketClreplaced response = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_MODE_CHANGE, guid, flags, default);
                            Broadcast(response);
                            response.Dispose();
                            return;
                        }
                    }

                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
            }

19 Source : WS_Handler_Channels.cs
with GNU General Public License v3.0
from MangosServer

public virtual void Kick(WcHandlerCharacter.CharacterObject character, string name)
            {
                ulong victimGuid = _clusterServiceLocator.WcHandlerCharacter.GetCharacterGuidByName(name);
                if (!Joined.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Moderators.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_MODERATOR, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!_clusterServiceLocator.WorldCluster.CharacteRs.ContainsKey(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Joined.Contains(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else
                {
                    // DONE: You Left channel
                    PacketClreplaced packet1 = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_YOU_LEFT, character.Guid, default, default);
                    _clusterServiceLocator.WorldCluster.CharacteRs[victimGuid].Client.Send(packet1);
                    packet1.Dispose();
                    Joined.Remove(victimGuid);
                    JoinedMode.Remove(victimGuid);
                    _clusterServiceLocator.WorldCluster.CharacteRs[victimGuid].JoinedChannels.Remove(ChannelName.ToUpper());

                    // DONE: [%s] Player %s kicked by %s.
                    PacketClreplaced packet2 = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_KICKED, victimGuid, character.Guid, default);
                    Broadcast(packet2);
                    packet2.Dispose();
                }
            }

19 Source : WS_Handler_Channels.cs
with GNU General Public License v3.0
from MangosServer

public virtual void Ban(WcHandlerCharacter.CharacterObject character, string name)
            {
                ulong victimGuid = _clusterServiceLocator.WcHandlerCharacter.GetCharacterGuidByName(name);
                if (!Joined.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Moderators.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_MODERATOR, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!_clusterServiceLocator.WorldCluster.CharacteRs.ContainsKey(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Joined.Contains(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (Banned.Contains(victimGuid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_PLAYER_INVITE_BANNED, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else
                {
                    Banned.Add(victimGuid);

                    // DONE: [%s] Player %s banned by %s.
                    PacketClreplaced packet2 = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_BANNED, victimGuid, character.Guid, default);
                    Broadcast(packet2);
                    packet2.Dispose();
                    Joined.Remove(victimGuid);
                    JoinedMode.Remove(victimGuid);
                    _clusterServiceLocator.WorldCluster.CharacteRs[victimGuid].JoinedChannels.Remove(ChannelName.ToUpper());

                    // DONE: You Left channel
                    PacketClreplaced packet1 = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_YOU_LEFT, character.Guid, default, default);
                    _clusterServiceLocator.WorldCluster.CharacteRs[victimGuid].Client.Send(packet1);
                    packet1.Dispose();
                }
            }

19 Source : WS_Handler_Channels.cs
with GNU General Public License v3.0
from MangosServer

public void SetUnModerator(WcHandlerCharacter.CharacterObject character, string name)
            {
                if (!Joined.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else if (!Moderators.Contains(character.Guid))
                {
                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_MODERATOR, character.Guid, default, default);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
                else
                {
                    foreach (ulong guid in Joined.ToArray())
                    {
                        if ((_clusterServiceLocator.WorldCluster.CharacteRs[guid].Name.ToUpper() ?? "") == (name.ToUpper() ?? ""))
                        {
                            byte flags = JoinedMode[guid];
                            JoinedMode[guid] = (byte)((CHANNEL_USER_FLAG)JoinedMode[guid] ^ CHANNEL_USER_FLAG.CHANNEL_FLAG_MODERATOR);
                            Moderators.Remove(guid);
                            PacketClreplaced response = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_MODE_CHANGE, guid, flags, default);
                            Broadcast(response);
                            response.Dispose();
                            return;
                        }
                    }

                    PacketClreplaced packet = BuildChannelNotify(CHANNEL_NOTIFY_FLAGS.CHANNEL_NOT_ON_FOR_NAME, character.Guid, default, name);
                    character.Client.Send(packet);
                    packet.Dispose();
                }
            }

19 Source : CustomCommands.cs
with MIT License
from Marilyth

public async Task RemoveRestriction(string command, SocketRole role){
            if(!RoleRestrictions.ContainsKey(command)){
                return;
            }
            RoleRestrictions[command].Remove(role.Id);
            await InsertOrUpdateAsync();
        }

19 Source : ReactionGiveaway.cs
with MIT License
from Marilyth

private async Task LeaveGiveaway(ulong userId, IUserMessage message)
        {
            if (!Giveaways[message.Channel.Id][message.Id].First().Equals(userId))
            {
                Giveaways[message.Channel.Id][message.Id].Remove(userId);
                await UpdateDBAsync(message.Channel.Id);
                await updateMessage(message);
            }
        }

19 Source : DiscordClientConfiguration.cs
with MIT License
from MarkusKgit

public void RemoveOwner(ulong ownerId)
        {
            if (owners.Contains(ownerId))
            {
                owners.Remove(ownerId);
            }
        }

19 Source : SpriteSystem.cs
with MIT License
from Mirsario

protected internal override void RenderUpdate()
		{
			var enreplacediesSpan = enreplacedies.ReadEnreplacedies();
			ref var geometryPreplacedData = ref GlobalGet<GeometryPreplacedData>();

			static ulong GetBatchIndex(uint materialId, uint layerId)
				=> (layerId << 32) | materialId;

			// Enumerate enreplacedies to define batches and count enreplacedies for them
			foreach (var enreplacedy in enreplacediesSpan) {
				if (enreplacedy.Get<Sprite>().Material?.TryGetOrRequestValue(out var material) != true) {
					continue;
				}

				var layer = enreplacedy.Has<Layer>() ? enreplacedy.Get<Layer>() : Layers.DefaultLayer;
				ulong batchKey = GetBatchIndex((uint)material.Id, (uint)layer.Index);

				if (!batches.TryGetValue(batchKey, out var batch)) {
					batches[batchKey] = batch = new() {
						Material = material,
						LayerMask = layer.Mask
					};
				}

				batch.EnreplacedyCount++;
			}

			var batchKeysToRemove = new List<ulong>();

			// Prepare batches
			foreach (var pair in batches) {
				var batch = pair.Value;

				// Mark unused last-frame batches for removal
				if (batch.EnreplacedyCount == 0) {
					batchKeysToRemove.Add(pair.Key);
					continue;
				}

				// Create enreplacedy arrays for batches
				batch.Enreplacedies = new Enreplacedy[batch.EnreplacedyCount];
				// Reset enreplacedy count, as it'll be reused as a counter on the second enreplacedy enumeration
				batch.EnreplacedyCount = 0;
			}

			// Cleanup batches that existed in the previous frame but are unneeded in this one
			foreach (ulong key in batchKeysToRemove) {
				if (batches.Remove(key, out var batch)) {
					batch.Dispose();
				}
			}

			// Enumerate enreplacedies for the second time to fill batches' enreplacedy arrays
			foreach (var enreplacedy in enreplacediesSpan) {
				if (enreplacedy.Get<Sprite>().Material?.TryGetOrRequestValue(out var material) != true) {
					continue;
				}

				uint layerId = enreplacedy.Has<Layer>() ? (uint)enreplacedy.Get<Layer>().Index : 0u;
				ulong batchKey = GetBatchIndex((uint)material.Id, layerId);
				var batchData = batches[batchKey];

				batchData.Enreplacedies[batchData.EnreplacedyCount++] = enreplacedy;
			}

			// Enumerate and run batches
			foreach (var pair in batches) {
				ulong key = pair.Key;
				var batch = pair.Value;

				if (batch.CompoundMesh == null) {
					batch.CompoundMesh = new Mesh() {
						BufferUsage = BufferUsageHint.DynamicDraw
					};
				}

				batchKeysToRemove.Remove(key);

				var compoundMesh = batch.CompoundMesh;
				var enreplacedies = batch.Enreplacedies;

				var vertices = compoundMesh.Vertices = new Vector3[enreplacedies.Length * 4];
				var uv0 = compoundMesh.Uv0 = new Vector2[enreplacedies.Length * 4];
				uint[] indices = compoundMesh.Indices = new uint[enreplacedies.Length * 6];

				uint vertex = 0;
				uint index = 0;

				foreach (var enreplacedy in enreplacedies) {
					ref var sprite = ref enreplacedy.Get<Sprite>();
					var transform = enreplacedy.Get<Transform>();
					var mesh = PrimitiveMeshes.Quad;
					var worldMatrix = transform.WorldMatrix;

					var sourceRect = sprite.SourceRectangle;
					var sourceUV = new Vector4(
						sourceRect.X,
						sourceRect.Y,
						sourceRect.Right,
						sourceRect.Bottom
					);
					var uvPoints = sprite.Effects switch {
						Sprite.SpriteEffects.FlipHorizontally | Sprite.SpriteEffects.FlipVertically => new Vector4(sourceUV.Z, sourceUV.W, sourceUV.X, sourceUV.Y),
						Sprite.SpriteEffects.FlipHorizontally => new Vector4(sourceUV.Z, sourceUV.Y, sourceUV.X, sourceUV.W),
						Sprite.SpriteEffects.FlipVertically => new Vector4(sourceUV.X, sourceUV.W, sourceUV.Z, sourceUV.Y),
						_ => sourceUV
					};

					if (sprite.verticesNeedRecalculation) {
						RecalculateVertices(ref sprite);
					}

					vertices[vertex] = worldMatrix * new Vector3(sprite.vertices.X, sprite.vertices.Y, 0f);
					vertices[vertex + 1] = worldMatrix * new Vector3(sprite.vertices.Z, sprite.vertices.Y, 0f);
					vertices[vertex + 2] = worldMatrix * new Vector3(sprite.vertices.Z, sprite.vertices.W, 0f);
					vertices[vertex + 3] = worldMatrix * new Vector3(sprite.vertices.X, sprite.vertices.W, 0f);

					uv0[vertex] = new Vector2(uvPoints.X, uvPoints.W);
					uv0[vertex + 1] = new Vector2(uvPoints.Z, uvPoints.W);
					uv0[vertex + 2] = new Vector2(uvPoints.Z, uvPoints.Y);
					uv0[vertex + 3] = new Vector2(uvPoints.X, uvPoints.Y);

					indices[index] = vertex + 2;
					indices[index + 1] = vertex + 1;
					indices[index + 2] = vertex;
					indices[index + 3] = vertex + 3;
					indices[index + 4] = vertex + 2;
					indices[index + 5] = vertex;

					vertex += 4;
					index += 6;
				}

				compoundMesh.Apply();

				geometryPreplacedData.RenderEntries.Add(new(new Transform(), compoundMesh, batch.Material, batch.LayerMask));

				batch.EnreplacedyCount = 0; // Reset enreplacedy count once again, will be used for disposing the batch in the next frame
			}

19 Source : GlobalGuildManager.cs
with GNU Affero General Public License v3.0
from NexusForever

public void UntrackCharacterGuild(ulong characterId, ulong guildId)
        {
            if (guildMemberCache.TryGetValue(characterId, out List<ulong> characterGuilds))
                characterGuilds.Remove(guildId);
        }

19 Source : GuildBase.cs
with GNU Affero General Public License v3.0
from NexusForever

protected virtual void MemberOffline(GuildMember member)
        {
            onlineMembers.Remove(member.CharacterId);
        }

19 Source : GlobalChatManager.cs
with GNU Affero General Public License v3.0
from NexusForever

public void UntrackCharacterChatChannel(ulong characterId, ChatChannelType type, ulong chatId)
        {
            if (characterChatChannels[type].TryGetValue(characterId, out List<ulong> channels))
                channels.Remove(chatId);
        }

19 Source : PlayerState.cs
with MIT License
from oakwarrior

public void RemoveCurrentDayItem(ulong id)
    {
        CurrentDayItems.Remove(id);
    }

19 Source : EmulatedSharedMemoryWindows.cs
with MIT License
from Ryujinx

public bool Unmap(ulong baseAddress)
        {
            lock (_lock)
            {
                if (_mappedBases.Remove(baseAddress))
                {
                    int lastBlock = -1;

                    foreach (SharedMemoryMapping mapping in _mappings)
                    {
                        ulong blockAddress = mapping.Address & (~MappingMask);
                        foreach (int block in mapping.Blocks)
                        {
                            if (block != lastBlock)
                            {
                                DecommitFromMap(baseAddress, blockAddress);

                                lastBlock = block;
                            }

                            blockAddress += MappingGranularity;
                        }
                    }

                    if (!VirtualFree((IntPtr)baseAddress, (IntPtr)0, AllocationType.Release))
                    {
                        throw new InvalidOperationException("Couldn't free mapping placeholder.");
                    }

                    return true;
                }

                return false;
            }
        }

19 Source : SceneEventProgress.cs
with MIT License
from Unity-Technologies

internal void RemoveClientAsDone(ulong clientId)
        {
            DoneClients.Remove(clientId);
            CheckCompletion();
        }

19 Source : SnapshotSystem.cs
with MIT License
from Unity-Technologies

internal void ProcessSingleAck(ushort ackSequence, ulong clientId, ClientData clientData, ConnectionRtt connection)
        {
            // look through the spawns sent
            for (int index = 0; index < clientData.SentSpawns.Count; /*no increment*/)
            {
                // needless copy, but I didn't find a way around
                ClientData.SentSpawn sent = clientData.SentSpawns[index];

                // for those with the sequence number being ack'ed
                if (sent.SequenceNumber == ackSequence)
                {
                    // remember the tick
                    if (!clientData.SpawnAck.ContainsKey(sent.ObjectId))
                    {
                        clientData.SpawnAck.Add(sent.ObjectId, sent.Tick);
                    }
                    else
                    {
                        clientData.SpawnAck[sent.ObjectId] = sent.Tick;
                    }

                    // check the spawn and despawn commands, find them, and if this is the last connection
                    // to ack, let's remove them
                    for (var i = 0; i < NumSpawns; i++)
                    {
                        if (Spawns[i].TickWritten == sent.Tick &&
                            Spawns[i].NetworkObjectId == sent.ObjectId)
                        {
                            Spawns[i].TargetClientIds.Remove(clientId);

                            if (Spawns[i].TargetClientIds.Count == 0)
                            {
                                // remove by moving the last spawn over
                                Spawns[i] = Spawns[NumSpawns - 1];
                                NumSpawns--;
                                break;
                            }
                        }
                    }
                    for (var i = 0; i < NumDespawns; i++)
                    {
                        if (Despawns[i].TickWritten == sent.Tick &&
                            Despawns[i].NetworkObjectId == sent.ObjectId)
                        {
                            Despawns[i].TargetClientIds.Remove(clientId);

                            if (Despawns[i].TargetClientIds.Count == 0)
                            {
                                // remove by moving the last spawn over
                                Despawns[i] = Despawns[NumDespawns - 1];
                                NumDespawns--;
                                break;
                            }
                        }
                    }

                    // remove current `sent`, by moving last over,
                    // as it was acknowledged.
                    // skip incrementing index
                    clientData.SentSpawns[index] = clientData.SentSpawns[clientData.SentSpawns.Count - 1];
                    clientData.SentSpawns.RemoveAt(clientData.SentSpawns.Count - 1);
                }
                else
                {
                    index++;
                }
            }

            // keep track of RTTs, using the sequence number acknowledgement as a marker
            connection.NotifyAck(ackSequence, Time.unscaledTime);
        }

19 Source : StatsDisplay.cs
with MIT License
from Unity-Technologies

[ServerRpc(RequireOwnership = false)]
        public void GetStatsServerRPC(ulong clientId)
        {
            if (!m_ClientsToUpdate.Contains(clientId))
            {
                m_ClientsToUpdate.Add(clientId);
            }
            else if (m_ClientsToUpdate.Contains(clientId))
            {
                m_ClientsToUpdate.Remove(clientId);
            }
        }

19 Source : RpcQueueManualTests.cs
with MIT License
from Unity-Technologies

private void OnClientDisconnectCallback(ulong clientId)
        {
            if (m_ClientSpecificCounters.ContainsKey(clientId))
            {
                m_ClientSpecificCounters.Remove(clientId);
            }
            if (m_ClientIds.Contains(clientId))
            {
                m_ClientIds.Remove(clientId);
            }
        }

19 Source : RoleAssignment.cs
with MIT License
from ValkyrjaProject

public async Task ReactionreplacedignedRoles(SocketReaction reaction, bool replacedignRoles)
		{
			Server server;
			if( !(reaction.Channel is SocketTextChannel channel) || !this.Client.Servers.ContainsKey(channel.Guild.Id) || (server = this.Client.Servers[channel.Guild.Id]) == null || server.Config == null )
				return;

			if( this.ReactionUsers.Contains(reaction.UserId) )
				return;

			server.ReactionRolesLock.Wait();
			if( this.ReactionUsers.Contains(reaction.UserId) )
			{
				server.ReactionRolesLock.Release();
				return;
			}
			this.ReactionUsers.Add(reaction.UserId);

			try
			{
				IEnumerable<ReactionreplacedignedRole> roles;
				roles = server.ReactionreplacedignedRoles.Where(r => r.MessageId == reaction.MessageId && r.Emoji == reaction.Emote.Name).ToList();

				if( roles.Any() )
				{
					IGuildUser user = null;
					if( !reaction.User.IsSpecified || (user = reaction.User.Value as SocketGuildUser) == null )
					{
						user = server.Guild.GetUser(reaction.UserId);
						if( user == null )
						{
							user = await this.Client.DiscordClient.Rest.GetGuildUserAsync(server.Id, reaction.UserId);
						}
						if( user == null )
						{
							this.ReactionUsers.Remove(reaction.UserId);
							server.ReactionRolesLock.Release();
							return;
						}
					}

					string name = "unknown";
					try
					{
						foreach( ReactionreplacedignedRole role in roles )
						{
							if( replacedignRoles == user.RoleIds.Any(rId => rId == role.RoleId) )
								continue;

							IRole discordRole = server.Guild.GetRole(role.RoleId);
							if( discordRole == null )
								continue;

							name = discordRole.Name;

							if( !replacedignRoles )
							{
								await user.RemoveRoleAsync(discordRole);
								this.ReactionUsers.Remove(reaction.UserId);
								server.ReactionRolesLock.Release();
								return;
							}

							//else...
							Int64 groupId = server.Roles.ContainsKey(discordRole.Id) ? server.Roles[discordRole.Id].PublicRoleGroupId : 0;
							if( groupId != 0 )
							{
								List<guid> groupRoleIds = server.Roles.Where(r => r.Value.PermissionLevel == RolePermissionLevel.Public && r.Value.PublicRoleGroupId == groupId).Select(r => r.Value.RoleId).ToList();
								int userHasCount = user.RoleIds.Count(rId => groupRoleIds.Any(id => id == rId));

								RoleGroupConfig groupConfig = null;
								if( userHasCount > 0 )
								{
									ServerContext dbContext = ServerContext.Create(this.Client.DbConnectionString);
									groupConfig = dbContext.PublicRoleGroups.AsQueryable().FirstOrDefault(g => g.ServerId == server.Id && g.GroupId == groupId);
									dbContext.Dispose();

									while( userHasCount >= groupConfig.RoleLimit && groupRoleIds.Any() )
									{
										IRole roleToRemove = server.Guild.GetRole(groupRoleIds.Last());
										groupRoleIds.Remove(groupRoleIds.Last());
										if( roleToRemove == null || user.RoleIds.All(rId => rId != roleToRemove.Id) )
											continue;

										await user.RemoveRoleAsync(roleToRemove);
										try
										{
											if( await reaction.Channel.GetMessageAsync(reaction.MessageId) is SocketUserMessage sMsg )
												await sMsg.RemoveReactionAsync(reaction.Emote, reaction.UserId);
											if( await reaction.Channel.GetMessageAsync(reaction.MessageId) is RestUserMessage rMsg )
												await rMsg.RemoveReactionAsync(reaction.Emote, reaction.UserId);
										}
										catch( Exception e )
										{
											await this.HandleException(e, "Failed to remove reaction.", server.Id);
										}

										userHasCount--;
									}
								}
							}

							await user.AddRoleAsync(discordRole);
						}
					}
					catch( HttpException e )
					{
						await server.HandleHttpException(e, $"This happened in <#{channel.Id}> when trying to change reactions or replacedign roles based on emojis.");
					}
					catch( Exception e )
					{
						await this.HandleException(e, "Reaction replacedigned Roles", server.Id);
					}
				}
			}
			catch( Exception e )
			{
				await this.HandleException(e, "Reaction replacedigned Roles", server.Id);
			}

			this.ReactionUsers.Remove(reaction.UserId);
			server.ReactionRolesLock.Release();
		}

19 Source : RoleAssignment.cs
with MIT License
from ValkyrjaProject

public async Task ReactionreplacedignedRoles(SocketReaction reaction, bool replacedignRoles)
		{
			Server server;
			if( !(reaction.Channel is SocketTextChannel channel) || !this.Client.Servers.ContainsKey(channel.Guild.Id) || (server = this.Client.Servers[channel.Guild.Id]) == null || server.Config == null )
				return;

			if( this.ReactionUsers.Contains(reaction.UserId) )
				return;

			server.ReactionRolesLock.Wait();
			if( this.ReactionUsers.Contains(reaction.UserId) )
			{
				server.ReactionRolesLock.Release();
				return;
			}
			this.ReactionUsers.Add(reaction.UserId);

			try
			{
				IEnumerable<ReactionreplacedignedRole> roles;
				roles = server.ReactionreplacedignedRoles.Where(r => r.MessageId == reaction.MessageId && r.Emoji == reaction.Emote.Name).ToList();

				if( roles.Any() )
				{
					IGuildUser user = null;
					if( !reaction.User.IsSpecified || (user = reaction.User.Value as SocketGuildUser) == null )
					{
						user = server.Guild.GetUser(reaction.UserId);
						if( user == null )
						{
							user = await this.Client.DiscordClient.Rest.GetGuildUserAsync(server.Id, reaction.UserId);
						}
						if( user == null )
						{
							this.ReactionUsers.Remove(reaction.UserId);
							server.ReactionRolesLock.Release();
							return;
						}
					}

					string name = "unknown";
					try
					{
						foreach( ReactionreplacedignedRole role in roles )
						{
							if( replacedignRoles == user.RoleIds.Any(rId => rId == role.RoleId) )
								continue;

							IRole discordRole = server.Guild.GetRole(role.RoleId);
							if( discordRole == null )
								continue;

							name = discordRole.Name;

							if( !replacedignRoles )
							{
								await user.RemoveRoleAsync(discordRole);
								this.ReactionUsers.Remove(reaction.UserId);
								server.ReactionRolesLock.Release();
								return;
							}

							//else...
							Int64 groupId = server.Roles.ContainsKey(discordRole.Id) ? server.Roles[discordRole.Id].PublicRoleGroupId : 0;
							if( groupId != 0 )
							{
								List<guid> groupRoleIds = server.Roles.Where(r => r.Value.PermissionLevel == RolePermissionLevel.Public && r.Value.PublicRoleGroupId == groupId).Select(r => r.Value.RoleId).ToList();
								int userHasCount = user.RoleIds.Count(rId => groupRoleIds.Any(id => id == rId));

								RoleGroupConfig groupConfig = null;
								if( userHasCount > 0 )
								{
									ServerContext dbContext = ServerContext.Create(this.Client.DbConnectionString);
									groupConfig = dbContext.PublicRoleGroups.AsQueryable().FirstOrDefault(g => g.ServerId == server.Id && g.GroupId == groupId);
									dbContext.Dispose();

									while( userHasCount >= groupConfig.RoleLimit && groupRoleIds.Any() )
									{
										IRole roleToRemove = server.Guild.GetRole(groupRoleIds.Last());
										groupRoleIds.Remove(groupRoleIds.Last());
										if( roleToRemove == null || user.RoleIds.All(rId => rId != roleToRemove.Id) )
											continue;

										await user.RemoveRoleAsync(roleToRemove);
										try
										{
											if( await reaction.Channel.GetMessageAsync(reaction.MessageId) is SocketUserMessage sMsg )
												await sMsg.RemoveReactionAsync(reaction.Emote, reaction.UserId);
											if( await reaction.Channel.GetMessageAsync(reaction.MessageId) is RestUserMessage rMsg )
												await rMsg.RemoveReactionAsync(reaction.Emote, reaction.UserId);
										}
										catch( Exception e )
										{
											await this.HandleException(e, "Failed to remove reaction.", server.Id);
										}

										userHasCount--;
									}
								}
							}

							await user.AddRoleAsync(discordRole);
						}
					}
					catch( HttpException e )
					{
						await server.HandleHttpException(e, $"This happened in <#{channel.Id}> when trying to change reactions or replacedign roles based on emojis.");
					}
					catch( Exception e )
					{
						await this.HandleException(e, "Reaction replacedigned Roles", server.Id);
					}
				}
			}
			catch( Exception e )
			{
				await this.HandleException(e, "Reaction replacedigned Roles", server.Id);
			}

			this.ReactionUsers.Remove(reaction.UserId);
			server.ReactionRolesLock.Release();
		}

19 Source : AkAudioListener.cs
with MIT License
from wetstreet

public virtual bool Remove(AkAudioListener listener)
		{
			if (listener == null)
				return false;

			var gameObjectId = listener.GetAkGameObjectID();
			if (!listenerIdList.Contains(gameObjectId))
				return false;

			listenerIdList.Remove(gameObjectId);
			listenerList.Remove(listener);
			return true;
		}