System.Collections.Generic.Dictionary.Remove(string)

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

4162 Examples 7

19 View Source File : ReanimatorState.cs
License : MIT License
Project Creator : aarthificial

public void Remove(string name)
        {
            _drivers.Remove(name);
        }

19 View Source File : PropertiesCollection.cs
License : MIT License
Project Creator : actions

public Boolean Remove(String key)
        {
            return m_innerDictionary.Remove(key);
        }

19 View Source File : ASN1.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 3gstudent

protected static void UpdateLength(RdpPacket packet, string Identifier)
        {
            Fixup fixup = m_Fixup[Identifier];
            m_Fixup.Remove(Identifier);
            long position = packet.Position;

            if (fixup.Length != -1)
            {
                long num2 = packet.Position - fixup.Offset;

                if (num2 != fixup.Length)
                {
                    throw new Exception("DER Tag length invalid");
                }
            }
            else
            {
                long num3 = packet.Position - (fixup.Offset + 1L);
                byte[] bytes = BitConverter.GetBytes(num3);
                packet.Position = fixup.Offset;

                if (num3 > 0xffffffL)
                {
                    packet.WriteByte(0x84);
                    packet.InsertByte(bytes[3]);
                    position += 1L;
                    packet.InsertByte(bytes[2]);
                    position += 1L;
                    packet.InsertByte(bytes[1]);
                    position += 1L;
                    packet.InsertByte(bytes[0]);
                    position += 1L;
                }
                else if (num3 > 0xffffL)
                {
                    packet.WriteByte(0x83);
                    packet.InsertByte(bytes[2]);
                    position += 1L;
                    packet.InsertByte(bytes[1]);
                    position += 1L;
                    packet.InsertByte(bytes[0]);
                    position += 1L;
                }
                else if (num3 > 0xffL)
                {
                    packet.WriteByte(130);
                    packet.InsertByte(bytes[1]);
                    position += 1L;
                    packet.InsertByte(bytes[0]);
                    position += 1L;
                }
                else if (num3 > 0x7fL)
                {
                    packet.WriteByte(0x81);
                    packet.InsertByte(bytes[0]);
                    position += 1L;
                }
                else
                {
                    packet.WriteByte(bytes[0]);
                }

                packet.Position = position;
            }
        }

19 View Source File : DynamicDNAConverterBehaviour.cs
License : Apache License 2.0
Project Creator : A7ocin

public bool RemoveDnaCallbackDelegate(UnityAction<string, float> callback, string targetDnaName)
		{
			bool removed = false;

			if (!_dnaCallbackDelegates.ContainsKey(targetDnaName))
			{
				removed = true;
			}
			else
			{
				int removeIndex = -1;
				for (int i = 0; i < _dnaCallbackDelegates[targetDnaName].Count; i++)
				{
					if (_dnaCallbackDelegates[targetDnaName][i] == callback)
					{
						removeIndex = i;
						break;
					}
				}
				if (removeIndex > -1)
				{
					_dnaCallbackDelegates[targetDnaName].RemoveAt(removeIndex);
					if(_dnaCallbackDelegates[targetDnaName].Count == 0)
					{
						_dnaCallbackDelegates.Remove(targetDnaName);
					}
					removed = true;
				}
			}
			return removed;
		}

19 View Source File : SimpleJSON.cs
License : MIT License
Project Creator : 71

public override JSONNode Remove(int aIndex)
        {
            if (aIndex < 0 || aIndex >= m_Dict.Count)
                return null;
            var item = m_Dict.ElementAt(aIndex);
            m_Dict.Remove(item.Key);
            return item.Value;
        }

19 View Source File : TypeExtension.cs
License : MIT License
Project Creator : 2881099

public static string ToMethod(this MethodInfo method)
        {
            if (method == null) return null;
            var sb = new StringBuilder();
            sb.Append("        public static ");

            var returnType = method.ReturnType;
            var isNoResultAsync = returnType == typeof(Task) || returnType == typeof(ValueTask);
            var isGenericAsync = returnType.IsGenericType && (returnType.GetGenericTypeDefinition() == typeof(ValueTask<>) || returnType.GetGenericTypeDefinition() == typeof(Task<>));
            var isAsync = isGenericAsync || isNoResultAsync;

            var isResult = false;

            if (isAsync)
                sb.Append("async ");

            var funcInfo = method.ToInterface(false);
            sb.AppendLine(funcInfo);
            sb.AppendLine("        {");

            if (isAsync)
            {
                if (isNoResultAsync)
                    sb.Append("            await _redisClient.").Append(method.Name);
                else
                {
                    isResult = true;
                    sb.Append("            var result = await _redisClient.").Append(method.Name);
                }
            }
            else
            {
                if (returnType == typeof(void))
                {
                    sb.Append("            _redisClient.").Append(method.Name);
                }
                else
                {
                    isResult = true;
                    sb.Append("            var result = _redisClient.").Append(method.Name);
                }
            }

            var genericParameters = method.GetGenericArguments();
            if (method.DeclaringType.IsNested && method.DeclaringType.DeclaringType.IsGenericType)
            {
                var dic = genericParameters.ToDictionary(a => a.Name);
                foreach (var nestedGenericParameter in method.DeclaringType.DeclaringType.GetGenericArguments())
                    if (dic.ContainsKey(nestedGenericParameter.Name))
                        dic.Remove(nestedGenericParameter.Name);
                genericParameters = dic.Values.ToArray();
            }
            if (genericParameters.Any())
                sb.Append("<")
                    .Append(string.Join(", ", genericParameters.Select(a => a.DisplayCsharp())))
                    .Append(">");

            sb.Append("(").Append(string.Join(", ", method.GetParameters().Select(a => $" {a.Name}"))).AppendLine(");");

            if (isResult)
                sb.AppendLine("            return result;");

            sb.Append("        }\r\n\r\n");
            return sb.ToString();
        }

19 View Source File : Fellowship.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

public void UpdateLock(bool isLocked, string lockName)
        {
            // Unlocking a fellowship is not possible without disbanding in retail worlds, so in all likelihood, this is only firing for fellowships being locked by emotemanager

            IsLocked = isLocked;

            if (string.IsNullOrWhiteSpace(lockName))
                lockName = "Undefined";

            if (isLocked)
            {
                Open = false;

                DepartedMembers.Clear();

                var timestamp = Time.GetUnixTime();
                if (!FellowshipLocks.TryAdd(lockName, new FellowshipLockData(timestamp)))
                    FellowshipLocks[lockName].UpdateTimestamp(timestamp);

                SendBroadcastAndUpdate("Your fellowship is now locked.  You may not recruit new members.  If you leave the fellowship, you have 15 minutes to be recruited back into the fellowship.");
            }
            else
            {
                // Unlocking a fellowship is not possible without disbanding in retail worlds, so in all likelihood, this never occurs

                DepartedMembers.Clear();

                FellowshipLocks.Remove(lockName);

                SendBroadcastAndUpdate("Your fellowship is now unlocked.");
            }
        }

19 View Source File : ClientSideCaching.cs
License : MIT License
Project Creator : 2881099

long GetOrAddClusterTrackingRedirectId(string host, RedisClientPool pool)
            {
                var poolkey = pool.Key;
                //return _sub.RedisSocket.ClientId;
                if (_cli.Adapter.UseType != RedisClient.UseType.Cluster) return _sub.RedisSocket.ClientId;

                ClusterTrackingInfo tracking = null;
                lock (_clusterTrackingsLock)
                {
                    if (_clusterTrackings.TryGetValue(poolkey, out tracking) == false)
                    {
                        tracking = new ClusterTrackingInfo
                        {
                            Client = new RedisClient(new ConnectionStringBuilder
                            {
                                Host = host,
                                MaxPoolSize = 1,
                                Preplacedword = pool._policy._connectionStringBuilder.Preplacedword,
                                ClientName = "client_tracking_redirect",
                                ConnectTimeout = pool._policy._connectionStringBuilder.ConnectTimeout,
                                IdleTimeout = pool._policy._connectionStringBuilder.IdleTimeout,
                                ReceiveTimeout = pool._policy._connectionStringBuilder.ReceiveTimeout,
                                SendTimeout = pool._policy._connectionStringBuilder.SendTimeout,
                                Ssl = pool._policy._connectionStringBuilder.Ssl,
                                User = pool._policy._connectionStringBuilder.User,
                            })
                        };
                        tracking.Client.Unavailable += (_, e) =>
                        {
                            lock (_dictLock) _dictSort.Clear();
                            _dict.Clear();
                            lock (_clusterTrackingsLock)
                            {
                                if (_clusterTrackings.TryGetValue(e.Pool.Key, out var localTracking))
                                {
                                    _clusterTrackings.Remove(e.Pool.Key);
                                    localTracking.Client.Dispose();
                                }
                            }
                        };
                        tracking.PubSub = tracking.Client.Subscribe("__redis__:invalidate", InValidate) as IPubSubSubscriber;
                        _clusterTrackings.Add(poolkey, tracking);
                    }
                }
                return tracking.PubSub.RedisSocket.ClientId;
            }

19 View Source File : VssOAuthTokenParameters.cs
License : MIT License
Project Creator : actions

private void RemoveOrSetValue(
            String key,
            String value)
        {
            if (value == null)
            {
                this.Remove(key);
            }
            else
            {
                this[key] = value;
            }
        }

19 View Source File : DynamicProxyExtensions.cs
License : MIT License
Project Creator : 2881099

internal static string DisplayCsharp(this MethodInfo method, bool isOverride)
        {
            if (method == null) return null;
            var sb = new StringBuilder();
            if (method.IsPublic) sb.Append("public ");
            if (method.Isreplacedembly) sb.Append("internal ");
            if (method.IsFamily) sb.Append("protected ");
            if (method.IsPrivate) sb.Append("private ");
            if (method.IsPrivate) sb.Append("private ");
            if (method.IsStatic) sb.Append("static ");
            if (method.IsAbstract && method.DeclaringType.IsInterface == false) sb.Append("abstract ");
            if (method.IsVirtual && method.DeclaringType.IsInterface == false) sb.Append(isOverride ? "override " : "virtual ");
            sb.Append(method.ReturnType.DisplayCsharp()).Append(" ").Append(method.Name);

            var genericParameters = method.GetGenericArguments();
            if (method.DeclaringType.IsNested && method.DeclaringType.DeclaringType.IsGenericType)
            {
                var dic = genericParameters.ToDictionary(a => a.Name);
                foreach (var nestedGenericParameter in method.DeclaringType.DeclaringType.GetGenericArguments())
                    if (dic.ContainsKey(nestedGenericParameter.Name))
                        dic.Remove(nestedGenericParameter.Name);
                genericParameters = dic.Values.ToArray();
            }
            if (genericParameters.Any())
                sb.Append("<")
                    .Append(string.Join(", ", genericParameters.Select(a => a.DisplayCsharp())))
                    .Append(">");

            sb.Append("(").Append(string.Join(", ", method.GetParameters().Select(a => $"{a.ParameterType.DisplayCsharp()} {a.Name}"))).Append(")");
            return sb.ToString();
        }

19 View Source File : Monitor.cs
License : Apache License 2.0
Project Creator : A7ocin

public static void RemoveValue(Transform target, string key)
    {
        if (target == null)
        {
            target = canvas.transform;
        }
        if (displayTransformValues.Keys.Contains(target))
        {
            if (displayTransformValues[target].ContainsKey(key))
            {
                displayTransformValues[target].Remove(key);
                if (displayTransformValues[target].Keys.Count == 0)
                {
                    displayTransformValues.Remove(target);
                }
            }
        }

    }

19 View Source File : SimpleJSON.cs
License : MIT License
Project Creator : 734843327

public override JSONNode Remove(string aKey)
        {
            if (!m_Dict.ContainsKey(aKey))
                return null;
            JSONNode tmp = m_Dict[aKey];
            m_Dict.Remove(aKey);
            return tmp;        
        }

19 View Source File : TemplateEngin.cs
License : MIT License
Project Creator : 2881099

void ViewDirChange(object sender, FileSystemEventArgs e) {
			string filename = e.FullPath.ToLower();
			lock (_cache_lock) {
				_cache.Remove(filename);
			}
		}

19 View Source File : AssetBundleManager.cs
License : Apache License 2.0
Project Creator : A7ocin

static protected void UnloadreplacedetBundleInternal(string replacedetBundleName, bool disregardRefrencedStatus = false)
		{
			string error;
			LoadedreplacedetBundle bundle = GetLoadedreplacedetBundle(replacedetBundleName, out error);
			if (bundle == null)
				return;

			if (--bundle.m_ReferencedCount == 0 || disregardRefrencedStatus)
			{
				bundle.OnUnload();
				m_LoadedreplacedetBundles.Remove(replacedetBundleName);

				Log(LogType.Info, replacedetBundleName + " has been unloaded successfully");
			}
		}

19 View Source File : ContextDataSlots.cs
License : MIT License
Project Creator : 1996v

public bool RemoveNamedDataSlot(string name)
        {
            if (storeSlots != null)
            {
                return storeSlots.Remove(name);
            }

            return false;
        }

19 View Source File : InMemoryEventBusSubscriptionsManager.cs
License : MIT License
Project Creator : Abdulrhman5

private void DoRemoveHandler(string eventName, SubscriptionInfo subsToRemove)
        {
            if (subsToRemove != null)
            {
                _handlers[eventName].Remove(subsToRemove);
                if (!_handlers[eventName].Any())
                {
                    _handlers.Remove(eventName);
                    var eventType = _eventTypes.SingleOrDefault(e => e.Name == eventName);
                    if (eventType != null)
                    {
                        _eventTypes.Remove(eventType);
                    }
                    RaiseOnEventRemoved(eventName);
                }

            }
        }

19 View Source File : InternalExtensions.cs
License : MIT License
Project Creator : 2881099

static string DisplayCsharp(this MethodInfo method, bool isOverride)
    {
        if (method == null) return null;
        var sb = new StringBuilder();
        if (method.IsPublic) sb.Append("public ");
        if (method.Isreplacedembly) sb.Append("internal ");
        if (method.IsFamily) sb.Append("protected ");
        if (method.IsPrivate) sb.Append("private ");
        if (method.IsPrivate) sb.Append("private ");
        if (method.IsStatic) sb.Append("static ");
        if (method.IsAbstract && method.DeclaringType.IsInterface == false) sb.Append("abstract ");
        if (method.IsVirtual && method.DeclaringType.IsInterface == false) sb.Append(isOverride ? "override " : "virtual ");
        sb.Append(method.ReturnType.DisplayCsharp()).Append(" ").Append(method.Name);

        var genericParameters = method.GetGenericArguments();
        if (method.DeclaringType.IsNested && method.DeclaringType.DeclaringType.IsGenericType)
        {
            var dic = genericParameters.ToDictionary(a => a.Name);
            foreach (var nestedGenericParameter in method.DeclaringType.DeclaringType.GetGenericArguments())
                if (dic.ContainsKey(nestedGenericParameter.Name))
                    dic.Remove(nestedGenericParameter.Name);
            genericParameters = dic.Values.ToArray();
        }
        if (genericParameters.Any())
            sb.Append("<")
                .Append(string.Join(", ", genericParameters.Select(a => a.DisplayCsharp())))
                .Append(">");

        sb.Append("(").Append(string.Join(", ", method.GetParameters().Select(a => $"{a.ParameterType.DisplayCsharp()} {a.Name}"))).Append(")");
        return sb.ToString();
    }

19 View Source File : CommandSettings.cs
License : MIT License
Project Creator : actions

private void RemoveArg(string name)
        {
            if (_parser.Args.ContainsKey(name))
            {
                _parser.Args.Remove(name);
            }

            if (_envArgs.ContainsKey(name))
            {
                _envArgs.Remove(name);
            }
        }

19 View Source File : StringMap.cs
License : MIT License
Project Creator : 0x0ade

public void CountRead(string value) {
            if (value.Length <= MinLength)
                return;

            lock (Pending) {
                if (MappedRead.Contains(value) || Pending.Contains(value))
                    return;

                if (!Counting.TryGetValue(value, out int count))
                    count = 0;
                if (++count >= PromotionCount) {
                    Counting.Remove(value);
                    Pending.Add(value);
                } else {
                    Counting[value] = count;
                }

                if (Counting.Count >= MaxCounting)
                    Cleanup();
            }
        }

19 View Source File : LocationCacheManager.cs
License : MIT License
Project Creator : actions

public void RemoveAccessMapping(String moniker)
        {
            EnsureDiskCacheLoaded();

            m_accessLock.EnterWriteLock();

            try
            {
                // Remove it from the access mappings
                m_accessMappings.Remove(moniker);

                // Remove each instance from the service definitions
                foreach (Dictionary<Guid, ServiceDefinition> serviceGroup in m_services.Values)
                {
                    foreach (ServiceDefinition definition in serviceGroup.Values)
                    {
                        // We know that it is illegal to delete an access mapping that is the default access mapping of 
                        // a service definition so we don't have to update any of those values.

                        // Remove the mapping that has the removed access mapping
                        for (int i = 0; i < definition.LocationMappings.Count; i++)
                        {
                            // If this one needs to be removed, swap it with the end and update the end counter
                            if (VssStringComparer.AccessMappingMoniker.Equals(moniker, definition.LocationMappings[i].AccessMappingMoniker))
                            {
                                definition.LocationMappings.RemoveAt(i);
                                break;
                            }
                        }
                    }
                }

                WriteCacheToDisk();
            }
            finally
            {
                m_accessLock.ExitWriteLock();
            }
        }

19 View Source File : AssetManager.cs
License : MIT License
Project Creator : 404Lcc

public void Unloadreplacedets()
        {
            string replacedetNames = string.Empty;
            foreach (string item in replacedetDict.Keys)
            {
                if (!replacedetDict[item].isKeep)
                {
                    replacedetNames = $"{replacedetNames}{item},";
                }
            }
            foreach (string item in replacedetNames.Split(','))
            {
                if (string.IsNullOrEmpty(item)) continue;
                replacedetData replacedetData = replacedetDict[item];
                Unloadreplacedet(replacedetData);
                replacedetDict.Remove(item);
            }
        }

19 View Source File : SimpleJSON.cs
License : MIT License
Project Creator : 71

public override JSONNode Remove(string aKey)
        {
            if (!m_Dict.ContainsKey(aKey))
                return null;
            JSONNode tmp = m_Dict[aKey];
            m_Dict.Remove(aKey);
            return tmp;
        }

19 View Source File : StringMap.cs
License : MIT License
Project Creator : 0x0ade

public void Cleanup() {
            lock (Pending) {
                foreach (KeyValuePair<string, int> entry in Counting) {
                    int score = entry.Value - DemotionScore;
                    if (score <= 0) {
                        CountingUpdateKeys.Add(entry.Key);
                        CountingUpdateValues.Add(0);
                    } else if (score >= PromotionTreshold) {
                        CountingUpdateKeys.Add(entry.Key);
                        CountingUpdateValues.Add(0);
                        Pending.Add(entry.Key);
                    } else {
                        CountingUpdateKeys.Add(entry.Key);
                        CountingUpdateValues.Add(score);
                    }
                }
                for (int i = 0; i < CountingUpdateKeys.Count; i++) {
                    string key = CountingUpdateKeys[i];
                    int value = CountingUpdateValues[i];
                    if (value == 0)
                        Counting.Remove(key);
                    else
                        Counting[key] = value;
                }
                CountingUpdateKeys.Clear();
                CountingUpdateValues.Clear();
            }
        }

19 View Source File : SimpleJSON.cs
License : MIT License
Project Creator : 71

public override JSONNode Remove(JSONNode aNode)
        {
            try
            {
                var item = m_Dict.Where(k => k.Value == aNode).First();
                m_Dict.Remove(item.Key);
                return aNode;
            }
            catch
            {
                return null;
            }
        }

19 View Source File : TaskBuild.cs
License : MIT License
Project Creator : 2881099

[JSFunction]
        public async Task CodeGenerate(string id)
        {
            if (stateKeyValues.ContainsKey(id))
            {
                InvokeJS("Helper.ui.message.error('当前任务未结束,请稍后再试.');");
            }
            else
            {
                if (Guid.TryParse(id, out Guid gid) && gid != Guid.Empty)
                {
                    stateKeyValues.Add(id, true);
                    var model = Curd.TaskBuild.Select.WhereDynamic(gid)
                       .LeftJoin(a => a.Templates.Id == a.TemplatesId)
                       .IncludeMany(a => a.TaskBuildInfos, b => b.Include(p => p.DataBaseConfig))
                       .ToOne();
                    var res = await new CodeGenerate().Setup(model);
                    InvokeJS($"Helper.ui.message.info('[{model.TaskName}]{res}');");
                    stateKeyValues.Remove(id);
                }
                else
                {
                    InvokeJS("Helper.ui.alert.error('生成失败','参数不是有效的.');");
                }

            }
        }

19 View Source File : PublisherSessionService.cs
License : MIT License
Project Creator : a1q123456

internal void RemovePublisher(LivingStream session)
        {
            if (_sessionMapToPath.TryGetValue(session, out var publishingName))
            {
                _sessionMapToPath.Remove(session);
                _pathMapToSession.Remove(publishingName);
            }
        }

19 View Source File : UnityARAnchorManager.cs
License : MIT License
Project Creator : 734843327

public void RemoveAnchor(ARPlaneAnchor arPlaneAnchor)
		{
			if (planeAnchorMap.ContainsKey (arPlaneAnchor.identifier)) {
				ARPlaneAnchorGameObject arpag = planeAnchorMap [arPlaneAnchor.identifier];
				GameObject.Destroy (arpag.gameObject);
				planeAnchorMap.Remove (arPlaneAnchor.identifier);
			}
		}

19 View Source File : TypeExtension.cs
License : MIT License
Project Creator : 2881099

public static string ToProxy(this MethodInfo method)
        {
            if (method == null) return null;
            var sb = new StringBuilder();
            sb.Append("        public ");

            var returnType = method.ReturnType;
            var isNoResultAsync = returnType == typeof(Task) || returnType == typeof(ValueTask);
            var isGenericAsync = returnType.IsGenericType && (returnType.GetGenericTypeDefinition() == typeof(ValueTask<>) || returnType.GetGenericTypeDefinition() == typeof(Task<>));
            var isAsync = isGenericAsync || isNoResultAsync;

            if (isAsync)
                sb.Append("async ");

            var funcInfo = method.ToInterface(false);
            sb.AppendLine(funcInfo);
            sb.AppendLine("        {");

            var isResult = false;

            if (isAsync)
            {
                sb.AppendLine($"            await _context.BeforeAsync(typeof(RedisClient).GetMethod({method.Name}))");
            }
            else
            {
                sb.AppendLine($"            _context.Before(typeof(RedisClient).GetMethod({method.Name}))");
            }

            if (isAsync)
            {
                if (isNoResultAsync)
                    sb.Append("            await _redisClient.").Append(method.Name);
                else
                {
                    isResult = true;
                    sb.Append("            var result = await _redisClient.").Append(method.Name);
                }
            }
            else
            {
                if (returnType == typeof(void))
                {
                    sb.Append("            _redisClient.").Append(method.Name);
                }
                else
                {
                    isResult = true;
                    sb.Append("            var result = _redisClient.").Append(method.Name);
                }
            }

            var genericParameters = method.GetGenericArguments();
            if (method.DeclaringType.IsNested && method.DeclaringType.DeclaringType.IsGenericType)
            {
                var dic = genericParameters.ToDictionary(a => a.Name);
                foreach (var nestedGenericParameter in method.DeclaringType.DeclaringType.GetGenericArguments())
                    if (dic.ContainsKey(nestedGenericParameter.Name))
                        dic.Remove(nestedGenericParameter.Name);
                genericParameters = dic.Values.ToArray();
            }
            if (genericParameters.Any())
                sb.Append("<")
                    .Append(string.Join(", ", genericParameters.Select(a => a.DisplayCsharp())))
                    .Append(">");

            sb.Append("(").Append(string.Join(", ", method.GetParameters().Select(a => $" {a.Name}"))).AppendLine(");");

            if (isAsync)
            {
                sb.AppendLine($"            await _context.AfterAsync(typeof(RedisClient).GetMethod({method.Name}))");
            }
            else
            {
                sb.AppendLine($"            _context.After(typeof(RedisClient).GetMethod({method.Name}))");
            }

            if (isResult)
                sb.AppendLine("            return result;");

            sb.Append("        }\r\n\r\n");
            return sb.ToString();
        }

19 View Source File : DynamicCharacterSystem.cs
License : Apache License 2.0
Project Creator : A7ocin

public void AddRecipes(UMATextRecipe[] uparts, string filename = "")
		{
			foreach (UMATextRecipe u in uparts)
			{
				if (filename == "" || (filename != "" && filename.Trim() == u.name))
				{
					var thisWardrobeSlot = u.wardrobeSlot;
					if (u.GetType() == typeof(UMAWardrobeCollection))
					{
						//we have a problem here because when the placeholder replacedet is returned its wardrobeCollection.sets.Count == 0
						//so we need to do it the other way round i.e. add it when its downloading but if the libraries contain it when its downloaded and the sets count is 0 remove it
						if ((u as UMAWardrobeCollection).wardrobeCollection.sets.Count == 0)
						{
							if (RecipeIndex.ContainsKey(u.name))
							{
								Debug.LogWarning("DCS removed " + u.name + " from RecipeIndex");
								RecipeIndex.Remove(u.name);
							}
							else if (!DynamicreplacedetLoader.Instance.downloadingreplacedetsContains(u.name))
							{
								continue;
							}
						}
						thisWardrobeSlot = "WardrobeCollection";
					}
					//we might be refreshing so check its not already there
					if (!RecipeIndex.ContainsKey(u.name))
						RecipeIndex.Add(u.name, u);
					else
					{
						RecipeIndex[u.name] = u;
					}
					for (int i = 0; i < u.compatibleRaces.Count; i++)
					{
						if (u.GetType() == typeof(UMAWardrobeCollection) && (u as UMAWardrobeCollection).wardrobeCollection.sets.Count > 0)
						{
							//if the collection doesn't have a wardrobeSet for this race continue
							//again when its downloading this data isn't there
							if ((u as UMAWardrobeCollection).wardrobeCollection[u.compatibleRaces[i]].Count == 0)
							{
								if (Recipes.ContainsKey(u.compatibleRaces[i]))
								{
									if (Recipes[u.compatibleRaces[i]].ContainsKey("WardrobeCollection"))
									{
										if (Recipes[u.compatibleRaces[i]]["WardrobeCollection"].Contains(u))
										{
											Debug.LogWarning("DCS removed " + u.name + " from Recipes");
											Recipes[u.compatibleRaces[i]]["WardrobeCollection"].Remove(u);
											if (RecipeIndex.ContainsKey(u.name))
											{
												Debug.LogWarning("DCS removed " + u.name + " from RecipeIndex");
												RecipeIndex.Remove(u.name);
											}
											continue;
										}
									}
								}
								if (DynamicreplacedetLoader.Instance != null)
									if (!DynamicreplacedetLoader.Instance.downloadingreplacedetsContains(u.name))
									{
										continue;
									}
							}
						}
						//When recipes that are compatible with multiple races are downloaded we may not have all the races actually downloaded
						//but that should not stop DCS making an index of recipes that are compatible with that race for when it becomes available
						if (!Recipes.ContainsKey(u.compatibleRaces[i]))
						{
							Recipes.Add(u.compatibleRaces[i], new Dictionary<string, List<UMATextRecipe>>());
						}
						if (Recipes.ContainsKey(u.compatibleRaces[i]))
						{
							Dictionary<string, List<UMATextRecipe>> RaceRecipes = Recipes[u.compatibleRaces[i]];

							if (!RaceRecipes.ContainsKey(thisWardrobeSlot))
							{
								RaceRecipes.Add(thisWardrobeSlot, new List<UMATextRecipe>());
							}
							//we might be refreshing so replace anything that is already there with the downloaded versions- else add
							bool added = false;
							for (int ir = 0; ir < RaceRecipes[thisWardrobeSlot].Count; ir++)
							{
								if (RaceRecipes[thisWardrobeSlot][ir].name == u.name)
								{
									RaceRecipes[thisWardrobeSlot][ir] = u;
									added = true;
								}
							}
							if (!added)
							{
								RaceRecipes[thisWardrobeSlot].Add(u);
							}
						}
						//backwards compatible race slots
						foreach (string racekey in Recipes.Keys)
						{
							//here we also need to check that the race itself has a wardrobe slot that matches the one in the compatible race
							//11012017 Dont trigger backwards compatible races to download
							RaceData raceKeyRace = (context.raceLibrary as DynamicRaceLibrary).GetRace(racekey, false);
							if (raceKeyRace == null)
								continue;
							if (raceKeyRace.IsCrossCompatibleWith(u.compatibleRaces[i]) && (raceKeyRace.wardrobeSlots.Contains(thisWardrobeSlot) || thisWardrobeSlot == "WardrobeCollection"))
                            {
								Dictionary<string, List<UMATextRecipe>> RaceRecipes = Recipes[racekey];
								if (!RaceRecipes.ContainsKey(thisWardrobeSlot))
								{
									RaceRecipes.Add(thisWardrobeSlot, new List<UMATextRecipe>());
								}
								//we might be refreshing so replace anything that is already there with the downloaded versions- else add
								bool added = false;
								for (int ir = 0; ir < RaceRecipes[thisWardrobeSlot].Count; ir++)
								{
									if (RaceRecipes[thisWardrobeSlot][ir].name == u.name)
									{
										RaceRecipes[thisWardrobeSlot][ir] = u;
										added = true;
									}
								}
								if (!added)
								{
									RaceRecipes[thisWardrobeSlot].Add(u);
								}
							}
						}
					}
				}
			}
			//This doesn't actually seem to do anything apart from slow things down
			//StartCoroutine(CleanFilesFromResourcesAndBundles());
		}

19 View Source File : DataContext.cs
License : MIT License
Project Creator : 0x0ade

public void RemoveDataTypes(Type[] types) {
            foreach (Type type in types) {
                if (!DataTypeToID.TryGetValue(type, out string? id))
                    continue;

                Logger.Log(LogLevel.INF, "data", $"Removing data type {type.FullName} with ID {id}");
                IDToDataType.Remove(id);
                DataTypeToID.Remove(type);
            }
        }

19 View Source File : AssetBundleManager.cs
License : Apache License 2.0
Project Creator : A7ocin

static protected void UnloadDependencies(string replacedetBundleName)
		{
			string[] dependencies = null;
			if (!m_Dependencies.TryGetValue(replacedetBundleName, out dependencies))
				return;

			// Loop dependencies.
			foreach (var dependency in dependencies)
			{
				UnloadreplacedetBundleInternal(dependency);
			}

			m_Dependencies.Remove(replacedetBundleName);
		}

19 View Source File : DynamicProxyExtensions.cs
License : MIT License
Project Creator : 2881099

internal static string DisplayCsharp(this Type type, bool isNameSpace = true)
        {
            if (type == null) return null;
            if (type == typeof(void)) return "void";
            if (type.IsGenericParameter) return type.Name;
            if (type.IsArray) return $"{DisplayCsharp(type.GetElementType())}[]";
            var sb = new StringBuilder();
            var nestedType = type;
            while (nestedType.IsNested)
            {
                sb.Insert(0, ".").Insert(0, DisplayCsharp(nestedType.DeclaringType, false));
                nestedType = nestedType.DeclaringType;
            }
            if (isNameSpace && string.IsNullOrEmpty(nestedType.Namespace) == false)
                sb.Insert(0, ".").Insert(0, nestedType.Namespace);

            if (type.IsGenericType == false)
                return sb.Append(type.Name).ToString();

            var genericParameters = type.GetGenericArguments();
            if (type.IsNested && type.DeclaringType.IsGenericType)
            {
                var dic = genericParameters.ToDictionary(a => a.Name);
                foreach (var nestedGenericParameter in type.DeclaringType.GetGenericArguments())
                    if (dic.ContainsKey(nestedGenericParameter.Name))
                        dic.Remove(nestedGenericParameter.Name);
                genericParameters = dic.Values.ToArray();
            }
            if (genericParameters.Any() == false)
                return sb.Append(type.Name).ToString();

            sb.Append(type.Name.Remove(type.Name.IndexOf('`'))).Append("<");
            var genericTypeIndex = 0;
            foreach (var genericType in genericParameters)
            {
                if (genericTypeIndex++ > 0) sb.Append(", ");
                sb.Append(DisplayCsharp(genericType, true));
            }
            return sb.Append(">").ToString();
        }

19 View Source File : Reanimator.cs
License : MIT License
Project Creator : aarthificial

public void RemoveListener(string driverName, ReanimatorListener listener)
        {
            if (!_listeners.ContainsKey(driverName)) return;

            _listeners[driverName] -= listener;
            if (_listeners[driverName] == null)
                _listeners.Remove(driverName);
        }

19 View Source File : SpamContext.cs
License : MIT License
Project Creator : 0x0ade

public bool Add() {
                lock (Spam.Timeouts) {
                    if (Count < Spam.Chat.Settings.SpamCountMax) {
                        Count++;

                        Task.Run(async () => {
                            await Task.Delay(TimeSpan.FromSeconds(Spam.Chat.Settings.SpamTimeoutAdd));
                            lock (Spam.Timeouts) {
                                if (Unspammed)
                                    return;
                                Count--;
                                if ((!Spammed || Timeout.Ticks <= 0) && Count <= 0)
                                    Spam.Timeouts.Remove(Text);
                            }
                        });
                    }

                    if (Spammed || Count >= Spam.Chat.Settings.SpamCount) {
                        if (!Spammed)
                            Start = DateTime.UtcNow;
                        Spammed = true;
                        Task.Run(async () => {
                            TimeSpan timeout = Timeout;
                            if (timeout.Ticks > 0)
                                await Task.Delay(timeout);
                            lock (Spam.Timeouts) {
                                if (Unspammed)
                                    return;
                                if (Count <= 0) {
                                    Unspammed = true;
                                    Spam.Timeouts.Remove(Text);
                                }
                            }
                        });
                        return true;
                    }

                    return false;
                }
            }

19 View Source File : MatchingEngine.cs
License : Apache License 2.0
Project Creator : Aaronontheweb

private static void UpdateOrder(Order bid, Fill bidFill, Dictionary<string, Order> orderBook)
        {
            var newBid = bid.WithFill(bidFill);
            if (newBid.Completed) // order was completely filled
            {
                // remove from matching engine - can't be matched again
                orderBook.Remove(newBid.OrderId);
                return;
            }

            // order was only partially filled. Need to keep it in matching engine
            orderBook[newBid.OrderId] = newBid;
        }

19 View Source File : InternalExtensions.cs
License : MIT License
Project Creator : 2881099

internal static string DisplayCsharp(this Type type, bool isNameSpace = true)
    {
        if (type == null) return null;
        if (type == typeof(void)) return "void";
        if (type.IsGenericParameter) return type.Name;
        if (type.IsArray) return $"{DisplayCsharp(type.GetElementType())}[]";
        var sb = new StringBuilder();
        var nestedType = type;
        while (nestedType.IsNested)
        {
            sb.Insert(0, ".").Insert(0, DisplayCsharp(nestedType.DeclaringType, false));
            nestedType = nestedType.DeclaringType;
        }
        if (isNameSpace && string.IsNullOrWhiteSpace(nestedType.Namespace) == false)
            sb.Insert(0, ".").Insert(0, nestedType.Namespace);

        if (type.IsGenericType == false)
            return sb.Append(type.Name).ToString();

        var genericParameters = type.GetGenericArguments();
        if (type.IsNested && type.DeclaringType.IsGenericType)
        {
            var dic = genericParameters.ToDictionary(a => a.Name);
            foreach (var nestedGenericParameter in type.DeclaringType.GetGenericArguments())
                if (dic.ContainsKey(nestedGenericParameter.Name))
                    dic.Remove(nestedGenericParameter.Name);
            genericParameters = dic.Values.ToArray();
        }
        if (genericParameters.Any() == false)
            return sb.Append(type.Name).ToString();

        sb.Append(type.Name.Remove(type.Name.IndexOf('`'))).Append("<");
        var genericTypeIndex = 0;
        foreach (var genericType in genericParameters)
        {
            if (genericTypeIndex++ > 0) sb.Append(", ");
            sb.Append(DisplayCsharp(genericType, true));
        }
        return sb.Append(">").ToString();
    }

19 View Source File : UnityJoystickManager.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

protected virtual void RemoveController(string joystickName)
        {
            ActiveControllers.Remove(joystickName);
        }

19 View Source File : ClientSideCaching.cs
License : MIT License
Project Creator : 2881099

public void Start()
            {
                _sub = _cli.Subscribe("__redis__:invalidate", InValidate) as IPubSubSubscriber;
                _cli.Interceptors.Add(() => new MemoryCacheAop(this));
                _cli.Unavailable += (_, e) =>
                {
                    lock (_dictLock) _dictSort.Clear();
                    _dict.Clear();
                    lock (_clusterTrackingsLock)
                    {
                        if (_clusterTrackings.TryGetValue(e.Pool.Key, out var localTracking))
                        {
                            _clusterTrackings.Remove(e.Pool.Key);
                            localTracking.Client.Dispose();
                        }
                    }
                };
                _cli.Connected += (_, e) =>
                {
                    var redirectId = GetOrAddClusterTrackingRedirectId(e.Host, e.Pool);
                    e.Client.ClientTracking(true, redirectId, null, false, false, false, false);
                };
            }

19 View Source File : FeatureModel.cs
License : Microsoft Public License
Project Creator : achimismaili

[Command]
        public string RemoveFeatureDefinition(string uniqueIdentifier)
        {
            var definitionToRemove = FeatureDefinitions[uniqueIdentifier];

            if (definitionToRemove != null)
            {
                if (FeatureDefinitions.Remove(uniqueIdentifier))
                {
                    return null;
                }
                else
                {
                    return string.Format("Repository problem when removing feature definition with unique id '{0}' - Please 'Reload'", uniqueIdentifier);
                }
            }
            else
            {
                return string.Format("Feature definition not found with unique id '{0}' - Please 'Reload'", uniqueIdentifier);
            }
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : 2881099

private void superTabControl1_TabItemClose(object sender, SuperTabStripTabItemCloseEventArgs e)
        {
            if (e.Tab.Text == "首页")
            {
                e.Cancel = true;
                ToastNotification.ToastBackColor = Color.Red;
                ToastNotification.ToastForeColor = Color.White;
                ToastNotification.ToastFont = new Font("微软雅黑", 15);
                ToastNotification.Show(superTabControl1, "默认页不允许关闭", null, 3000, eToastGlowColor.Red, eToastPosition.TopCenter);
            }
            if (pairs.ContainsKey(e.Tab.Text)) pairs.Remove(e.Tab.Text);
            if (pairs.Count == 0) buttonItem19.Enabled = false;

        }

19 View Source File : VssFileStorage.cs
License : MIT License
Project Creator : actions

public void WriteEntries(IEnumerable<KeyValuePair<string, object>> entries)
            {
                if (entries.Any())
                {
                    using (GetNewMutexScope())
                    {
                        bool changesMade = false;
                        Dictionary<string, JRaw> originalSettings = LoadFile();
                        Dictionary<string, JRaw> newSettings = new Dictionary<string, JRaw>(PathComparer);
                        if (originalSettings.Any())
                        {
                            originalSettings.Copy(newSettings);
                        }
                        foreach (KeyValuePair<string, object> kvp in entries)
                        {
                            string path = NormalizePath(kvp.Key);
                            if (kvp.Value != null)
                            {
                                JRaw jRawValue = new JRaw(JsonConvert.SerializeObject(kvp.Value));
                                if (!newSettings.ContainsKey(path) || !newSettings[path].Equals(jRawValue))
                                {
                                    newSettings[path] = jRawValue;
                                    changesMade = true;
                                }
                            }
                            else
                            {
                                if (newSettings.Remove(path))
                                {
                                    changesMade = true;
                                }
                            }
                        }
                        if (changesMade)
                        {
                            SaveFile(originalSettings, newSettings);
                        }
                    }
                }
            }

19 View Source File : Channels.cs
License : MIT License
Project Creator : 0x0ade

public void Remove(CelesteNetPlayerSession session) {
            using (Lock.W())
                if (!Players.Remove(session))
                    return;

            // Hopefully nobody will get stuck in channel limbo...
            session.OnEnd -= RemoveByDC;

            if (ID == 0)
                return;

            lock (Ctx.All) {
                if (Players.Count > 0)
                    return;

                Ctx.All.Remove(this);
                Ctx.ByName.Remove(Name);
                Ctx.ByID.Remove(ID);
            }
        }

19 View Source File : LocationCacheManager.cs
License : MIT License
Project Creator : actions

public void RemoveServices(IEnumerable<ServiceDefinition> serviceDefinitions, Int32 lastChangeId)
        {
            EnsureDiskCacheLoaded();

            m_accessLock.EnterWriteLock();

            try
            {
                foreach (ServiceDefinition serviceDefinition in serviceDefinitions)
                {
                    Dictionary<Guid, ServiceDefinition> definitions = null;
                    if (!m_services.TryGetValue(serviceDefinition.ServiceType, out definitions))
                    {
                        continue;
                    }

                    // If the entry is removed and there are no more definitions of this type, remove that
                    // entry from the services structure
                    if (definitions.Remove(serviceDefinition.Identifier) && definitions.Count == 0)
                    {
                        m_services.Remove(serviceDefinition.ServiceType);
                    }
                }

                SetLastChangeId(lastChangeId, false);
                Debug.replacedert(m_lastChangeId == -1 || m_services.Count > 0);
                WriteCacheToDisk();
            }
            finally
            {
                m_accessLock.ExitWriteLock();
            }
        }

19 View Source File : AssetManager.cs
License : MIT License
Project Creator : 404Lcc

public void Unloadreplacedet(string name, params string[] types)
        {
            string path = GetreplacedetPath(name, types);
            if (replacedetDict.ContainsKey(path))
            {
                replacedetData replacedetData = replacedetDict[path];
                Unloadreplacedet(replacedetData);
                replacedetDict.Remove(path);
            }
        }

19 View Source File : TypeExtension.cs
License : MIT License
Project Creator : 2881099

public static string DisplayCsharp(this Type type, bool isNameSpace = true)
        {
            if (type == null) return null;
            if (type == typeof(void)) return "void";
            if (type.IsGenericParameter) return type.Name;
            if (type.IsArray) return $"{DisplayCsharp(type.GetElementType())}[]";
            var sb = new StringBuilder();
            var nestedType = type;
            while (nestedType.IsNested)
            {
                sb.Insert(0, ".").Insert(0, DisplayCsharp(nestedType.DeclaringType, false));
                nestedType = nestedType.DeclaringType;
            }
            if (isNameSpace && string.IsNullOrWhiteSpace(nestedType.Namespace) == false)
                sb.Insert(0, ".").Insert(0, nestedType.Namespace);

            if (type.IsGenericType == false)
                return sb.Append(type.Name).ToString();

            var genericParameters = type.GetGenericArguments();
            if (type.IsNested && type.DeclaringType.IsGenericType)
            {
                var dic = genericParameters.ToDictionary(a => a.Name);
                foreach (var nestedGenericParameter in type.DeclaringType.GetGenericArguments())
                    if (dic.ContainsKey(nestedGenericParameter.Name))
                        dic.Remove(nestedGenericParameter.Name);
                genericParameters = dic.Values.ToArray();
            }
            if (genericParameters.Any() == false)
                return sb.Append(type.Name).ToString();

            sb.Append(type.Name.Remove(type.Name.IndexOf('`'))).Append("<");
            var genericTypeIndex = 0;
            foreach (var genericType in genericParameters)
            {
                if (genericTypeIndex++ > 0) sb.Append(", ");
                sb.Append(DisplayCsharp(genericType, true));
            }
            return sb.Append(">").ToString();
        }

19 View Source File : CacheManager.cs
License : MIT License
Project Creator : 0ffffffffh

internal static void RemoveKeysetContext(KeysetId setId)
        {
            lock (setLock)
            {
                if (CacheSetKeys.ContainsKey(setId.SetId))
                    CacheSetKeys.Remove(setId.SetId);
            }
        }

19 View Source File : FileSystemUserData.cs
License : MIT License
Project Creator : 0x0ade

public override void RevokeKey(string key) {
            lock (GlobalLock) {
                Global global = LoadRaw<Global>(GlobalPath);
                if (!global.UIDs.TryGetValue(key, out string? uid))
                    return;

                global.UIDs.Remove(key);
                SaveRaw(GlobalPath, global);

                Delete<PrivateUserInfo>(uid);
            }
        }

19 View Source File : CelesteNetConnection.cs
License : MIT License
Project Creator : 0x0ade

protected virtual void ThreadLoop() {
            try {
                while (Con.IsAlive) {
                    DedupeTimestamp++;

                    int waited = 0;
                    if (Interlocked.CompareExchange(ref QueueCount, 0, 0) == 0)
                        waited = WaitHandle.WaitAny(EventHandles, 1000);

                    if ((waited == WaitHandle.WaitTimeout || DedupeTimestamp % 10 == 0) && LastSent.Count > 0) {
                        for (int i = Dedupes.Count - 1; i >= 0; --i) {
                            DataDedupe slot = Dedupes[i];
                            if (!slot.Update(DedupeTimestamp)) {
                                Dedupes.RemoveAt(i);
                                if (LastSent.TryGetValue(slot.Type, out Dictionary<uint, DataDedupe>? slotByID)) {
                                    slotByID.Remove(slot.ID);
                                    if (slotByID.Count == 0) {
                                        LastSent.Remove(slot.Type);
                                    }
                                }
                            }
                        }
                    }

                    if (!Con.IsAlive)
                        return;

                    DateTime now = DateTime.UtcNow;

                    while (Interlocked.CompareExchange(ref QueueCount, 0, 0) != 0) {
                        DataType? data;
                        lock (QueueLock) {
                            int next = QueueSendNext;
                            data = Queue[next];
                            Queue[next] = null;
                            QueueSendNext = (next + 1) % Queue.Length;
                            Interlocked.Decrement(ref QueueCount);
                        }

                        if (data == null)
                            continue;

                        if (data is DataInternalDisconnect) {
                            Con.Dispose();
                            return;
                        }

                        if ((data.DataFlags & DataFlags.OnlyLatest) == DataFlags.OnlyLatest) {
                            string type = data.GetTypeID(Con.Data);
                            uint id = data.GetDuplicateFilterID();

                            lock (QueueLock) {
                                int next = QueueSendNext;
                                int count = Interlocked.CompareExchange(ref QueueCount, 0, 0);
                                int length = Queue.Length;
                                for (int ii = 0; ii < count; ii++) {
                                    int i = (next + ii) % length;
                                    DataType? d = Queue[i];
                                    if (d != null && d.GetTypeID(Con.Data) == type && d.GetDuplicateFilterID() == id) {
                                        data = d;
                                        Queue[i] = null;
                                    }
                                }
                            }
                        }

                        if ((data.DataFlags & DataFlags.SkipDuplicate) == DataFlags.SkipDuplicate) {
                            string type = data.GetTypeID(Con.Data);
                            uint id = data.GetDuplicateFilterID();

                            if (!LastSent.TryGetValue(type, out Dictionary<uint, DataDedupe>? slotByID))
                                LastSent[type] = slotByID = new();

                            if (slotByID.TryGetValue(id, out DataDedupe? slot)) {
                                if (slot.Data.ConsideredDuplicate(data))
                                    continue;
                                slot.Data = data;
                                slot.Timestamp = DedupeTimestamp;
                                slot.Iterations = 0;
                            } else {
                                Dedupes.Add(slotByID[id] = new(type, id, data, DedupeTimestamp));
                            }

                        }

                        Con.SendRaw(this, data);

                        if ((data.DataFlags & DataFlags.Update) == DataFlags.Update)
                            LastUpdate = now;
                        else
                            LastNonUpdate = now;
                    }

                    if (Con.SendStringMap) {
                        List<Tuple<string, int>> added = Strings.PromoteRead();
                        if (added.Count > 0) {
                            foreach (Tuple<string, int> mapping in added)
                                Con.SendRaw(this, new DataLowLevelStringMapping {
                                    IsUpdate = SendStringMapUpdate,
                                    StringMap = Strings.Name,
                                    Value = mapping.Item1,
                                    ID = mapping.Item2
                                });
                            if (SendStringMapUpdate)
                                LastUpdate = now;
                            else
                                LastNonUpdate = now;
                        }
                    }

                    if (Con.SendKeepAlive) {
                        if (SendKeepAliveUpdate && (now - LastUpdate).TotalSeconds >= 1D) {
                            Con.SendRaw(this, new DataLowLevelKeepAlive {
                                IsUpdate = true
                            });
                            LastUpdate = now;
                        }
                        if (SendKeepAliveNonUpdate && (now - LastNonUpdate).TotalSeconds >= 1D) {
                            Con.SendRaw(this, new DataLowLevelKeepAlive {
                                IsUpdate = false
                            });
                            LastNonUpdate = now;
                        }
                    }

                    Con.SendRawFlush();

                    lock (QueueLock)
                        if (Interlocked.CompareExchange(ref QueueCount, 0, 0) == 0)
                            Event.Reset();
                }

            } catch (ThreadInterruptedException) {

            } catch (ThreadAbortException) {

            } catch (Exception e) {
                if (!(e is IOException) && !(e is ObjectDisposedException))
                    Logger.Log(LogLevel.CRI, "conqueue", $"Failed sending data:\n{e}");

                Con.Dispose();

            } finally {
                Event.Dispose();
            }
        }

19 View Source File : TypeExtension.cs
License : MIT License
Project Creator : 2881099

public static string ToInterface(this MethodInfo method, bool isAlign = true)
        {
            if (method == null) return null;
            var sb = new StringBuilder();
            //if (method.IsPublic) sb.Append("public ");
            //if (method.Isreplacedembly) sb.Append("internal ");
            //if (method.IsFamily) sb.Append("protected ");
            //if (method.IsPrivate) sb.Append("private ");
            //if (method.IsPrivate) sb.Append("private ");
            //if (method.IsStatic) sb.Append("static ");
            //if (method.IsAbstract && method.DeclaringType.IsInterface == false) sb.Append("abstract ");
            //if (method.IsVirtual && method.DeclaringType.IsInterface == false) sb.Append(isOverride ? "override " : "virtual ");
            if (isAlign)
                sb.Append("        ");
            sb.Append(method.ReturnType.DisplayCsharp()).Append(" ").Append(method.Name);

            var genericParameters = method.GetGenericArguments();
            if (method.DeclaringType.IsNested && method.DeclaringType.DeclaringType.IsGenericType)
            {
                var dic = genericParameters.ToDictionary(a => a.Name);
                foreach (var nestedGenericParameter in method.DeclaringType.DeclaringType.GetGenericArguments())
                    if (dic.ContainsKey(nestedGenericParameter.Name))
                        dic.Remove(nestedGenericParameter.Name);
                genericParameters = dic.Values.ToArray();
            }
            if (genericParameters.Any())
                sb.Append("<")
                    .Append(string.Join(", ", genericParameters.Select(a => a.DisplayCsharp())))
                    .Append(">");

            sb.Append("(").Append(string.Join(", ", method.GetParameters().Select(a => $"{a.ParameterType.DisplayCsharp()} {a.Name}"))).Append(")");

            if (isAlign)
                sb.Append(";\r\n\r\n");

            return sb.ToString();
        }

19 View Source File : Iterator.cs
License : MIT License
Project Creator : 7Bytes-Studio

public static void Cancel(string name)
        {
            if (s_Dic.ContainsKey(name))
            {
                var enumerator = s_Dic[name];
                s_Dic.Remove(name);
                s_IteratorCancelCallback.Invoke(name,enumerator);
            }
        }

See More Examples