Exemplo n.º 1
0
        public void Start()
        {
            _lastvalues.Clear();
            _taskbars.Clear();
            _taskbarChildren.Clear();

            // Setting up the condition to find AutomationElements
            OrCondition condition = new OrCondition(new PropertyCondition(AutomationElement.ClassNameProperty, "Shell_TrayWnd"), new PropertyCondition(AutomationElement.ClassNameProperty, "Shell_SecondaryTrayWnd"));

            // Setting up cache request
            CacheRequest cacheRequest = new CacheRequest();

            cacheRequest.Add(AutomationElement.NameProperty);
            cacheRequest.Add(AutomationElement.BoundingRectangleProperty);

            // Activating cache request
            using (cacheRequest.Activate())
            {
                // Finding tray windows
                AutomationElementCollection lists = _desktop.FindAll(TreeScope.Children, condition);
                if (lists == null)
                {
                    return;
                }

                _lastvalues.Clear();

                // Looping through all found trays
                foreach (AutomationElement trayWnd in lists)
                {
                    // Finding MSTaskListWClass
                    AutomationElement tasklist = trayWnd.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, "MSTaskListWClass"));
                    if (tasklist == null)
                    {
                        continue;
                    }

                    // Adding an event handler on changed properties
                    Automation.AddAutomationPropertyChangedEventHandler(tasklist, TreeScope.Element, TellTrayToUpdate, AutomationElement.BoundingRectangleProperty);

                    // Saving this taskbar
                    _taskbars.Add(trayWnd);
                    // saving this taskbar AND its tasks
                    while (!_taskbarChildren.TryAdd(trayWnd, tasklist))
                    {
                    }                                                      // Ensuring it's getting added.
                }
            }

            // Adding event handlers to the desktop opening / closing.
            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, _desktop, TreeScope.Subtree, TellTrayToUpdate);
            Automation.AddAutomationEventHandler(WindowPattern.WindowClosedEvent, _desktop, TreeScope.Subtree, TellTrayToUpdate);

            // Starting taskbar thread
            _cancel        = new CancellationTokenSource();
            _taskbarThread = new Thread(new ThreadStart(taskbarLoop));
            _taskbarThread.Start();
        }
        public IRelayBoard On()
        {
            foreach (var relay in _relayCollection)
            {
                On(relay, false);
            }

            _relayCollection.Clear();

            UpdateReportedProperties();

            return(this);
        }
Exemplo n.º 3
0
        public void Clear()
        {
            using (new WriteLock(ClearLock))
            {
                _keyTracker.Clear();

                if (_memoryCache != null)
                {
                    _memoryCache.DisposeIfDisposable();
                    _memoryCache = new MemoryCache("in-memory");
                }
                else
                {
                    foreach (DictionaryEntry c in HttpRuntime.Cache)
                    {
                        if (c.Key is string && ((string)c.Key).InvariantStartsWith(CacheItemPrefix))
                        {
                            if (HttpRuntime.Cache[(string)c.Key] == null)
                            {
                                return;
                            }
                            HttpRuntime.Cache.Remove((string)c.Key);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
            public static async Task FlowerReactionEvent(CommandContext Context)
            {
                var msg = await Context.Channel.SendConfirmAsync("Flower reaction event started!",
                                                                 "Add 🌸 reaction to this message to get 100" + NadekoBot.BotConfig.CurrencySign,
                                                                 footer : "This event is active for 24 hours.")
                          .ConfigureAwait(false);

                try { await msg.AddReactionAsync("🌸").ConfigureAwait(false); }
                catch
                {
                    try { await msg.AddReactionAsync("🌸").ConfigureAwait(false); }
                    catch
                    {
                        try { await msg.DeleteAsync().ConfigureAwait(false); }
                        catch { return; }
                    }
                }
                using (msg.OnReaction(async(r) =>
                {
                    try
                    {
                        if (r.Emoji.Name == "🌸" && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _flowerReactionAwardedUsers.Add(r.User.Value.Id))
                        {
                            try { await CurrencyHandler.AddCurrencyAsync(r.User.Value, "Flower Reaction Event", 100, false).ConfigureAwait(false); } catch { }
                        }
                    }
                    catch { }
                }))
                {
                    await Task.Delay(TimeSpan.FromHours(24)).ConfigureAwait(false);

                    try { await msg.DeleteAsync().ConfigureAwait(false); } catch { }
                    _flowerReactionAwardedUsers.Clear();
                }
            }
        private static void ExerciseFullApi(ConcurrentHashSet <int> hashSet, int[] numbersToAdd)
        {
            dynamic _;

            foreach (var number in numbersToAdd)
            {
                hashSet.Add(number);
            }

            var index             = 0;
            var genericEnumerator = hashSet.GetEnumerator();

            while (index < numbersToAdd.Length && genericEnumerator.MoveNext())
            {
                _ = genericEnumerator.Current;
            }

            index = 0;
            var nongenericEnumerator = ((IEnumerable)hashSet).GetEnumerator();

            while (index < numbersToAdd.Length && nongenericEnumerator.MoveNext())
            {
                _ = nongenericEnumerator.Current;
            }

            _ = hashSet.Count;
            var destinationArray = new int[500];

            hashSet.CopyTo(destinationArray, 0);
            _ = hashSet.Contains(numbersToAdd.First());
            hashSet.Remove(numbersToAdd.First());
            hashSet.Clear();
        }
Exemplo n.º 6
0
 internal void ClearCollected()
 {
     _collected.Clear();
     foreach (var e in _emojis)
     {
         _collected.Add(new PollEmoji(e));
     }
 }
Exemplo n.º 7
0
        // This is the main execute method called by the engine
        public void Execute(Engine engine, Guid executionId)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(nameof(ExecutionPipeline));
            }

            // Setup for pipeline execution
            _documentSources.Clear();
            ResetClonedDocuments();
            _previouslyProcessedCache?.ResetEntryHits();
            _processedSources?.Clear();

            // Execute all modules in the pipeline
            IReadOnlyList <IDocument> resultDocuments;

            using (ExecutionContext context = new ExecutionContext(engine, executionId, this))
            {
                ImmutableArray <IDocument> inputs = new[] { engine.DocumentFactory.GetDocument(context) }.ToImmutableArray();
                resultDocuments = Execute(context, _modules, inputs);
            }

            // Dispose documents that aren't part of the final collection for this pipeline,
            // but don't dispose any documents that are referenced directly or indirectly from the final ones
            HashSet <IDocument> flattenedResultDocuments = new HashSet <IDocument>();

            FlattenResultDocuments(resultDocuments, flattenedResultDocuments);
            Parallel.ForEach(_clonedDocuments.Where(x => !flattenedResultDocuments.Contains(x)), x => x.Dispose());
            _clonedDocuments = new ConcurrentBag <IDocument>(flattenedResultDocuments);

            // Check the previously processed cache for any previously processed documents that need to be added
            if (_previouslyProcessedCache != null && _processedSources != null)
            {
                // Dispose the previously processed documents that we didn't get this time around
                Parallel.ForEach(_previouslyProcessedCache.ClearUnhitEntries().SelectMany(x => x), x => x.Dispose());

                // Trace the number of previously processed documents
                Trace.Verbose("{0} previously processed document(s) were not reprocessed", _previouslyProcessedCache.GetValues().Sum(x => x.Count));

                // Add new result documents to the cache
                foreach (IDocument resultDocument in _clonedDocuments)
                {
                    List <IDocument> processedResultDocuments;
                    if (_processedSources.TryGetValue(resultDocument.Source, out processedResultDocuments))
                    {
                        processedResultDocuments.Add(resultDocument);
                    }
                    else
                    {
                        Trace.Warning("Could not find processed document cache for source {0}, please report this warning to the developers", resultDocument.SourceString());
                    }
                }

                // Reset cloned documents (since we're tracking them in the previously processed cache now) and set new aggregate results
                _clonedDocuments = new ConcurrentBag <IDocument>();
                engine.DocumentCollection.Set(Name, _previouslyProcessedCache.GetValues().SelectMany(x => x).ToList().AsReadOnly());
            }
        }
Exemplo n.º 8
0
        public void Clear()
        {
            using (new WriteLock(ClearLock))
            {
                _keyTracker.Clear();

                ClearDataCache();
            }
        }
Exemplo n.º 9
0
        private static void InitConsoleLoggers()
        {
            ConsoleLoggingRules.Clear();

            foreach (LoggingRule loggingRule in LogManager.Configuration.LoggingRules.Where(loggingRule => loggingRule.Targets.Any(target => target is ColoredConsoleTarget || target is ConsoleTarget)))
            {
                ConsoleLoggingRules.Add(loggingRule);
            }
        }
Exemplo n.º 10
0
    public override void OnActionExecuted(ActionExecutedContext c)
    {
        string key = c.HttpContext.Items["CacheKey"].ToString();

        if (!cache.TryRemove(key))
        {
            cache.Clear();
        }
    }
Exemplo n.º 11
0
        internal void ConnectVoiceServer(string myName)
        {
            IsVoiceEnabled = true;
            _MutedClients.Clear();
            _UnmutedClients.Clear();

            var cls = ClientMap.Values.Where(cl => cl.ID != LocalClientId && cl.ChannelID == IngameChannel).Select(cl => cl.ID).ToArray();

            _MutedClients = new ConcurrentHashSet <ushort>(cls);
            DoMuteList(cls);
            _MuteTimer.Start();
            var c = GetClient(LocalClientId);

            if (c != null)
            {
                c.JoinChannel(IngameChannel, IngameChannelPassword);
                c.SetNickName(myName);
            }
        }
Exemplo n.º 12
0
        public void ClearReferences()
        {
            foreach (MutableEntity entity in referencedBy)
            {
                entity.referencing.TryRemove(this);
            }

            referencedBy.Clear();
            referencing.Clear();
        }
Exemplo n.º 13
0
        public void ClearEmptyTest()
        {
            var people = new ConcurrentHashSet <PersonProper>(RandomData.GeneratePersonRefCollection <PersonProper>(100));

            people.Clear();

            Assert.IsTrue(people.Count == 0);

            Assert.IsTrue(people.IsEmpty);
        }
Exemplo n.º 14
0
 public void Clear()
 {
     lock (Lock)
     {
         if (ConcurrentHashSet.Count > 0)
         {
             ConcurrentHashSet.Clear();
             CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
         }
     }
 }
        /// <summary>
        /// 清空所有缓存
        /// </summary>
        public void Flush()
        {
            WriteLog($"Flush");

            foreach (var key in _cacheKeys)
            {
                _cache.Remove(key);
            }

            _cacheKeys.Clear();
        }
Exemplo n.º 16
0
 public void Clear()
 {
     lock (Lock)
     {
         if (ConcurrentHashSet.Count > 0)
         {
             ConcurrentHashSet.Clear();
             HashSetChanged?.Invoke(this, EventArgs.Empty);
         }
     }
 }
Exemplo n.º 17
0
        public void Clear_RemovesAllItems()
        {
            var hashSet = new ConcurrentHashSet <int>();

            hashSet.Add(5);
            hashSet.Add(8);

            Assert.AreEqual(2, hashSet.Count);

            hashSet.Clear();
            Assert.AreEqual(0, hashSet.Count);
        }
Exemplo n.º 18
0
        public void Clear()
        {
            // Arrange
            var list = new ConcurrentHashSet <int>();

            // Act
            list.Clear();

            // Assert
            Assert.Empty(list);
            list.Dispose();
        }
        public void ConcurrentHashSetClearRemovesAllItemsFromSet()
        {
            var items = new List <string> {
                "Frodo", "Sam", "Merry", "Pippin"
            };

            var set = new ConcurrentHashSet <string>(items);

            set.Clear();

            Assert.IsEmpty(set);
        }
Exemplo n.º 20
0
            public async Task SneakyGameStatusEvent(ICommandContext context, int?arg)
            {
                int num;

                if (arg == null || arg < 5)
                {
                    num = 60;
                }
                else
                {
                    num = arg.Value;
                }

                if (_secretCode != string.Empty)
                {
                    return;
                }
                var rng = new NadekoRandom();

                for (var i = 0; i < 5; i++)
                {
                    _secretCode += SneakyGameStatusChars[rng.Next(0, SneakyGameStatusChars.Length)];
                }

                await _client.SetGameAsync($"type {_secretCode} for " + _bc.BotConfig.CurrencyPluralName)
                .ConfigureAwait(false);

                try
                {
                    var title = GetText("sneakygamestatus_title");
                    var desc  = GetText("sneakygamestatus_desc", Format.Bold(100.ToString()) + _bc.BotConfig.CurrencySign, Format.Bold(num.ToString()));
                    await context.Channel.SendConfirmAsync(title, desc).ConfigureAwait(false);
                }
                catch
                {
                    // ignored
                }


                _client.MessageReceived += SneakyGameMessageReceivedEventHandler;
                await Task.Delay(num * 1000);

                _client.MessageReceived -= SneakyGameMessageReceivedEventHandler;

                var cnt = SneakyGameAwardedUsers.Count;

                SneakyGameAwardedUsers.Clear();
                _secretCode = string.Empty;

                await _client.SetGameAsync(GetText("sneakygamestatus_end", cnt))
                .ConfigureAwait(false);
            }
        public void ConcurrentHashSet_FunctionsAsNormalHashSet_ForSingleThreadedAccess(params int[] numbersToAdd)
        {
            // Because we're not doing anything interesting with the hashset itself, it seems reasonable to just wrap all of the basic hashset API tests into one test
            var distinctNumbers = numbersToAdd.Distinct().ToList();

            // Add
            foreach (var number in numbersToAdd)
            {
                _concurrentHashSet.Add(number);
            }

            // GetEnumerator<T>
            var index             = 0;
            var genericEnumerator = _concurrentHashSet.GetEnumerator();

            while (index < numbersToAdd.Length && genericEnumerator.MoveNext())
            {
                Assert.AreEqual(distinctNumbers[index++], genericEnumerator.Current);
            }
            Assert.AreEqual(distinctNumbers.Count, index);

            // GetEnumerator
            index = 0;
            var nongenericEnumerator = ((IEnumerable)_concurrentHashSet).GetEnumerator();

            while (index < numbersToAdd.Length && nongenericEnumerator.MoveNext())
            {
                Assert.AreEqual(distinctNumbers[index++], nongenericEnumerator.Current);
            }
            Assert.AreEqual(distinctNumbers.Count, index);

            // Count
            Assert.AreEqual(_concurrentHashSet.Count, distinctNumbers.Count);

            // CopyTo
            var destinationArray = new int[distinctNumbers.Count];

            _concurrentHashSet.CopyTo(destinationArray, 0);
            Assert.True(distinctNumbers.SequenceEqual(destinationArray));

            // Contains
            Assert.True(distinctNumbers.All(_concurrentHashSet.Contains));

            // Remove
            _concurrentHashSet.Remove(distinctNumbers.First());
            Assert.False(_concurrentHashSet.Contains(distinctNumbers.First()));

            // Clear
            _concurrentHashSet.Clear();
            Assert.AreEqual(0, _concurrentHashSet.Count);
            Assert.False(distinctNumbers.Any(_concurrentHashSet.Contains));
        }
        /// <summary>
        /// </summary>
        /// <param name="waitPendingMS">Time to wait before cancellation.</param>
        /// <param name="waitCancellationMS">Time to wait after cancellation.
        /// Default is one second to allow threads cancel work normally before UpdateContext disposed.</param>
        /// <returns>Task to await pending tasks.</returns>
        public async Task Stop(int waitPendingMS = 0, int waitCancellationMS = 1000)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(nameof(BotManager));
            }

            try
            {
                if (!IsRunning)
                {
                    return;
                }

                StopReceivingEvents();

                //Wait before cancel.
                if (waitPendingMS > 0)
                {
                    _logger.LogTrace("Waiting pending normally finished.");
                    await ExecutionManager.AwaitAllPending(TimeSpan.FromMilliseconds(waitPendingMS));
                }

                foreach (var item in _pendingUpdateContexts)
                {
                    var cancellationTokenSource = item.HiddenContext().UpdateProcessingAbortedSource;
                    cancellationTokenSource.Cancel();
                }

                //Wait after cancel.
                if (waitCancellationMS > 0)
                {
                    _logger.LogTrace("Waiting cancellation.");
                    await ExecutionManager.AwaitAllPending(TimeSpan.FromMilliseconds(waitCancellationMS));
                }

                //Dispose.
                foreach (var item in _pendingUpdateContexts)
                {
                    item.Dispose();
                }

                _pendingUpdateContexts.Clear();
                IsRunning = false;
                _logger.LogTrace("BotManager stopped.");
            }
            catch (Exception ex)
            {
                throw new TelegramAspException($"Error while stopping {nameof(BotManager)}.");
            }
        }
Exemplo n.º 23
0
            public static async Task SneakyGameStatusEvent(CommandContext Context, int?arg)
            {
                int num;

                if (arg == null || arg < 5)
                {
                    num = 60;
                }
                else
                {
                    num = arg.Value;
                }

                if (_secretCode != String.Empty)
                {
                    return;
                }
                var rng = new NadekoRandom();

                for (int i = 0; i < 5; i++)
                {
                    _secretCode += _sneakyGameStatusChars[rng.Next(0, _sneakyGameStatusChars.Length)];
                }

                var game = NadekoBot.Client.Game?.Name;
                await NadekoBot.Client.SetGameAsync($"type {_secretCode} for " + NadekoBot.BotConfig.CurrencyPluralName)
                .ConfigureAwait(false);

                try
                {
                    await Context.Channel.SendConfirmAsync($"SneakyGameStatus event started",
                                                           $"Users must type a secret code to get 100 currency.\n" +
                                                           $"Lasts {num} seconds. Don't tell anyone. Shhh.")
                    .ConfigureAwait(false);
                }
                catch { }


                NadekoBot.Client.MessageReceived += SneakyGameMessageReceivedEventHandler;
                await Task.Delay(num * 1000);

                NadekoBot.Client.MessageReceived -= SneakyGameMessageReceivedEventHandler;

                var cnt = _sneakyGameAwardedUsers.Count;

                _sneakyGameAwardedUsers.Clear();
                _secretCode = String.Empty;

                await NadekoBot.Client.SetGameAsync($"SneakyGame event ended. {cnt} users received a reward.")
                .ConfigureAwait(false);
            }
Exemplo n.º 24
0
        public void UnSubscribeAll()
        {
            //Monitor.Enter(_childListener);
            _childListener.Clear();
            //Monitor.Exit(_childListener);

            //Monitor.Enter(_dataListener);
            _dataListener.Clear();
            //Monitor.Exit(_dataListener);

            //Monitor.Enter(_stateListener);
            _stateListener.Clear();
            //Monitor.Exit(_stateListener);
        }
Exemplo n.º 25
0
        public void Add_MultipleTimes_AddsCorrectly()
        {
            var hashSet = new ConcurrentHashSet <int>();

            hashSet.Add(5);
            hashSet.Add(8);

            Assert.IsTrue(hashSet.Contains(5));
            Assert.IsTrue(hashSet.Contains(8));
            Assert.AreEqual(2, hashSet.Count);

            hashSet.Clear();
            Assert.AreEqual(0, hashSet.Count);
        }
Exemplo n.º 26
0
        /// <summary>
        /// Disposes this EventWaiter
        /// </summary>
        public void Dispose()
        {
            this._client = null;

            this._reactionAddEvent.Unregister(this._reactionAddHandler);
            this._reactionRemoveEvent.Unregister(this._reactionRemoveHandler);

            this._reactionAddEvent      = null;
            this._reactionAddHandler    = null;
            this._reactionRemoveEvent   = null;
            this._reactionRemoveHandler = null;

            _requests.Clear();
            _requests = null;
        }
Exemplo n.º 27
0
 public override async Task Stop()
 {
     try
     {
         _client.MessageReceived -= SneakyGameMessageReceivedEventHandler;
         Code = string.Empty;
         _sneakyGameAwardedUsers.Clear();
         await _client.SetGameAsync(null).ConfigureAwait(false);
     }
     catch { }
     finally
     {
         OnEnded?.Invoke();
     }
 }
Exemplo n.º 28
0
        public async Task Flush()
        {
            foreach (var contextData in Store.Values)
            {
                await _decoratedRepository.Save(await contextData);
            }

            foreach (var removedHandler in _removed)
            {
                await _decoratedRepository.Remove(removedHandler);
            }

            Store.Clear();
            _removed.Clear();
        }
        public void UnsubscribeAll()
        {
            lock (_childListener)
            {
                _childListener.Clear();
            }

            lock (_dataListener)
            {
                _dataListener.Clear();
            }

            lock (_stateListener)
            {
                _stateListener.Clear();
            }
        }
        public override Task OnDisconnectedAsync(HubConnectionContext connection)
        {
            Connections.Remove(connection);
            if (!string.IsNullOrEmpty(connection.UserIdentifier))
            {
                Users.RemoveSubscription(connection.UserIdentifier, connection);
            }

            // Also unsubscrube from any groups
            ConcurrentHashSet <string> groups = connection.Features.Get <IMassTransitFeature>().Groups;

            if (groups != null)
            {
                groups.Clear(); // Removes connection from all groups locally
            }
            return(Task.CompletedTask);
        }
Exemplo n.º 31
0
        static void Main(string[] args)
        {
            int startRaw = Environment.TickCount;
            HashSet<int> testRaw = new HashSet<int>();
            for (int i = 0; i < 4000000; i++)
                testRaw.Add(i);
            int timeRaw = Environment.TickCount - startRaw;
            for (int i = 0; i < 4000000; i++)
                testRaw.Contains(i);
            int timeRaw2 = Environment.TickCount - startRaw;

            Console.WriteLine(timeRaw.ToString());
            Console.WriteLine(timeRaw2.ToString());

            //Action<int, int> fnOutput = (total, start) =>
            //    Enumerable.Range(start, total).ForEach(i => Console.WriteLine(i));

            //for (int i = 0; i < 40; i++)
            //    Console.WriteLine(i);

            ////fnOutput(40, 0);

            //Action<int> fnOutput40 = fnOutput.Curry()(40);

            //fnOutput40(0);
            //fnOutput40(30);

            //ICollection<int> coll = new HashSet<int>(); 
            //int[] data = { 42, 46, 77, 345, -12 }; 
            //foreach (var local in data)
            //    coll.Add(local);

            //int test5 = TestFunctions.fnThunk(new HashSet<int>(), 1);
            //Console.Write("None\t");
            //Console.WriteLine(test5);

            //var test6 = TestFunctions.CalcP<LockFreeList<int>>();
            //Console.Write("LFLS\t");
            //Console.WriteLine(test6);

            //var test1 = TestFunctions.CalcP<CourseGrainedICollectionWrapper<int>, HashSet<int>>();
            //Console.Write("Lock\t");
            //Console.WriteLine(test1);
            //var test2 = TestFunctions.CalcP<ReadWriteICollectionWrapper<int>, HashSet<int>>();
            //Console.Write("RWLS\t");
            //Console.WriteLine(test2);
            //var test3 = TestFunctions.CalcP<InterlockedICollectionWrapper<int>, HashSet<int>>();
            //Console.Write("Intr\t");
            //Console.WriteLine(test3);

            CollectionWrapperCourseGrained<int> wrp = new CollectionWrapperCourseGrained<int>();
            wrp.Collection = new HashSet<int>();
            var resultn = TestFunctions.fnTest4MAdd(wrp, 4);
            Console.WriteLine(resultn.ToString());

            var resultnc = TestFunctions.fnTest4MContains(wrp, 4);
            Console.WriteLine(resultnc.ToString());

            var resultnr = TestFunctions.fnTest4MRemove(wrp, 4);
            Console.WriteLine(resultnr.ToString());

            int start = Environment.TickCount;

            //LockFreeList<int> list = new LockFreeList<int>();
            //ConcurrentHashSet<int> list = new ConcurrentHashSet<int>(4100000,true);
            ConcurrentHashSet<int> list = new ConcurrentHashSet<int>(4100000, true);

            var result2 = TestFunctions.fnTest4MAdd(list, 4);
            Console.Write("INSERTS = ");
            Console.WriteLine(result2.ToString());

            Console.Write("TICKS = ");
            Console.WriteLine(Environment.TickCount - start);

#if (DEBUG)
            Console.WriteLine(list.DebugDump);
            list.DebugReset();

            //list.DebugDataValidate();

            bool success = list.Contains(1000000);
#endif
            start = Environment.TickCount;

            var resultnc2 = TestFunctions.fnTest4MContains(list, 4);
            Console.Write("CONTAIN = ");
            Console.WriteLine(resultnc2.ToString());

            Console.Write("TICKS = ");
            Console.WriteLine(Environment.TickCount - start);

#if (DEBUG)
            Console.WriteLine(list.DebugDump);
#endif
            //start = Environment.TickCount;

            //var resultnr2 = TestFunctions.fnTest4MRemove(list, 4);
            //Console.Write("REMOVE = ");
            //Console.WriteLine(resultnr2.ToString());

            //Console.Write("TICKS = ");
            //Console.WriteLine(Environment.TickCount - start);

            //start = Environment.TickCount;

            list.Clear();
            Console.Write("CLEAR = ");
            Console.WriteLine(Environment.TickCount - start);

#if (DEBUG)
            //Console.WriteLine(list.DebugEmpty);
#endif
            start = Environment.TickCount;

            var result2b = TestFunctions.fnTest4MAdd(list, 4);
            Console.Write("INSERTS = ");
            Console.WriteLine(result2b.ToString());

            Console.Write("TICKS = ");
            Console.WriteLine(Environment.TickCount - start);
#if (DEBUG)
            Console.WriteLine(list.DebugDump);
#endif
            Console.ReadLine();
        }